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">
6 foot_right_recto="&chaptertitle; (&chapternumber;)"
7 foot_right_verso="&chaptertitle; (&chapternumber;)"
8 toc_chapter_blanks="yes,yes"
9 table_warn_overflow="overprint"
13 <title>Specification of the Exim Mail Transfer Agent</title>
14 <titleabbrev>The Exim MTA</titleabbrev>
15 <date>29 May 2010</date>
16 <author><firstname>Exim</firstname><surname>Maintainers</surname></author>
17 <authorinitials>EM</authorinitials>
18 <revhistory><revision>
19 <revnumber>4.72</revnumber>
20 <date>29 May 2010</date>
21 <authorinitials>EM</authorinitials>
22 </revision></revhistory>
23 <copyright><year>2009</year><holder>University of Cambridge</holder></copyright>
26 <title>Introduction</title>
28 <indexterm role="variable">
29 <primary>$1, $2, etc.</primary>
30 <see><emphasis>numerical variables</emphasis></see>
32 <indexterm role="concept">
33 <primary>address</primary>
34 <secondary>rewriting</secondary>
35 <see><emphasis>rewriting</emphasis></see>
37 <indexterm role="concept">
38 <primary>Bounce Address Tag Validation</primary>
39 <see><emphasis>BATV</emphasis></see>
41 <indexterm role="concept">
42 <primary>Client SMTP Authorization</primary>
43 <see><emphasis>CSA</emphasis></see>
45 <indexterm role="concept">
46 <primary>CR character</primary>
47 <see><emphasis>carriage return</emphasis></see>
49 <indexterm role="concept">
50 <primary>CRL</primary>
51 <see><emphasis>certificate revocation list</emphasis></see>
53 <indexterm role="concept">
54 <primary>delivery</primary>
55 <secondary>failure report</secondary>
56 <see><emphasis>bounce message</emphasis></see>
58 <indexterm role="concept">
59 <primary>dialup</primary>
60 <see><emphasis>intermittently connected hosts</emphasis></see>
62 <indexterm role="concept">
63 <primary>exiscan</primary>
64 <see><emphasis>content scanning</emphasis></see>
66 <indexterm role="concept">
67 <primary>failover</primary>
68 <see><emphasis>fallback</emphasis></see>
70 <indexterm role="concept">
71 <primary>fallover</primary>
72 <see><emphasis>fallback</emphasis></see>
74 <indexterm role="concept">
75 <primary>filter</primary>
76 <secondary>Sieve</secondary>
77 <see><emphasis>Sieve filter</emphasis></see>
79 <indexterm role="concept">
80 <primary>ident</primary>
81 <see><emphasis>RFC 1413</emphasis></see>
83 <indexterm role="concept">
84 <primary>LF character</primary>
85 <see><emphasis>linefeed</emphasis></see>
87 <indexterm role="concept">
88 <primary>maximum</primary>
89 <seealso><emphasis>limit</emphasis></seealso>
91 <indexterm role="concept">
92 <primary>monitor</primary>
93 <see><emphasis>Exim monitor</emphasis></see>
95 <indexterm role="concept">
96 <primary>no_<emphasis>xxx</emphasis></primary>
97 <see>entry for xxx</see>
99 <indexterm role="concept">
100 <primary>NUL</primary>
101 <see><emphasis>binary zero</emphasis></see>
103 <indexterm role="concept">
104 <primary>passwd file</primary>
105 <see><emphasis>/etc/passwd</emphasis></see>
107 <indexterm role="concept">
108 <primary>process id</primary>
109 <see><emphasis>pid</emphasis></see>
111 <indexterm role="concept">
112 <primary>RBL</primary>
113 <see><emphasis>DNS list</emphasis></see>
115 <indexterm role="concept">
116 <primary>redirection</primary>
117 <see><emphasis>address redirection</emphasis></see>
119 <indexterm role="concept">
120 <primary>return path</primary>
121 <seealso><emphasis>envelope sender</emphasis></seealso>
123 <indexterm role="concept">
124 <primary>scanning</primary>
125 <see><emphasis>content scanning</emphasis></see>
127 <indexterm role="concept">
128 <primary>SSL</primary>
129 <see><emphasis>TLS</emphasis></see>
131 <indexterm role="concept">
132 <primary>string</primary>
133 <secondary>expansion</secondary>
134 <see><emphasis>expansion</emphasis></see>
136 <indexterm role="concept">
137 <primary>top bit</primary>
138 <see><emphasis>8-bit characters</emphasis></see>
140 <indexterm role="concept">
141 <primary>variables</primary>
142 <see><emphasis>expansion, variables</emphasis></see>
144 <indexterm role="concept">
145 <primary>zero, binary</primary>
146 <see><emphasis>binary zero</emphasis></see>
150 Exim is a mail transfer agent (MTA) for hosts that are running Unix or
151 Unix-like operating systems. It was designed on the assumption that it would be
152 run on hosts that are permanently connected to the Internet. However, it can be
153 used on intermittently connected hosts with suitable configuration adjustments.
156 Configuration files currently exist for the following operating systems: AIX,
157 BSD/OS (aka BSDI), Darwin (Mac OS X), DGUX, Dragonfly, FreeBSD, GNU/Hurd,
158 GNU/Linux, HI-OSF (Hitachi), HI-UX, HP-UX, IRIX, MIPS RISCOS, NetBSD, OpenBSD,
159 OpenUNIX, QNX, SCO, SCO SVR4.2 (aka UNIX-SV), Solaris (aka SunOS5), SunOS4,
160 Tru64-Unix (formerly Digital UNIX, formerly DEC-OSF1), Ultrix, and Unixware.
161 Some of these operating systems are no longer current and cannot easily be
162 tested, so the configuration files may no longer work in practice.
165 There are also configuration files for compiling Exim in the Cygwin environment
166 that can be installed on systems running Windows. However, this document does
167 not contain any information about running Exim in the Cygwin environment.
170 The terms and conditions for the use and distribution of Exim are contained in
171 the file <filename>NOTICE</filename>. Exim is distributed under the terms of the GNU General
172 Public Licence, a copy of which may be found in the file <filename>LICENCE</filename>.
175 The use, supply or promotion of Exim for the purpose of sending bulk,
176 unsolicited electronic mail is incompatible with the basic aims of the program,
177 which revolve around the free provision of a service that enhances the quality
178 of personal communications. The author of Exim regards indiscriminate
179 mass-mailing as an antisocial, irresponsible abuse of the Internet.
182 Exim owes a great deal to Smail 3 and its author, Ron Karr. Without the
183 experience of running and working on the Smail 3 code, I could never have
184 contemplated starting to write a new MTA. Many of the ideas and user interfaces
185 were originally taken from Smail 3, though the actual code of Exim is entirely
186 new, and has developed far beyond the initial concept.
189 Many people, both in Cambridge and around the world, have contributed to the
190 development and the testing of Exim, and to porting it to various operating
191 systems. I am grateful to them all. The distribution now contains a file called
192 <filename>ACKNOWLEDGMENTS</filename>, in which I have started recording the names of
195 <section id="SECID1">
196 <title>Exim documentation</title>
197 <para revisionflag="changed">
198 <indexterm role="concept">
199 <primary>documentation</primary>
201 This edition of the Exim specification applies to version 4.72 of Exim.
202 Substantive changes from the 4.71 edition are marked in some
203 renditions of the document; this paragraph is so marked if the rendition is
204 capable of showing a change indicator.
207 This document is very much a reference manual; it is not a tutorial. The reader
208 is expected to have some familiarity with the SMTP mail transfer protocol and
209 with general Unix system administration. Although there are some discussions
210 and examples in places, the information is mostly organized in a way that makes
211 it easy to look up, rather than in a natural order for sequential reading.
212 Furthermore, the manual aims to cover every aspect of Exim in detail, including
213 a number of rarely-used, special-purpose features that are unlikely to be of
217 <indexterm role="concept">
218 <primary>books about Exim</primary>
220 An <quote>easier</quote> discussion of Exim which provides more in-depth explanatory,
221 introductory, and tutorial material can be found in a book entitled <emphasis>The Exim
222 SMTP Mail Server</emphasis> (second edition, 2007), published by UIT Cambridge
223 (<emphasis role="bold"><ulink url="http://www.uit.co.uk/exim-book/">http://www.uit.co.uk/exim-book/</ulink></emphasis>).
226 This book also contains a chapter that gives a general introduction to SMTP and
227 Internet mail. Inevitably, however, the book is unlikely to be fully up-to-date
228 with the latest release of Exim. (Note that the earlier book about Exim,
229 published by O’Reilly, covers Exim 3, and many things have changed in Exim 4.)
232 <indexterm role="concept">
233 <primary>Debian</primary>
234 <secondary>information sources</secondary>
236 If you are using a Debian distribution of Exim, you will find information about
237 Debian-specific features in the file
238 <filename>/usr/share/doc/exim4-base/README.Debian</filename>.
239 The command <command>man update-exim.conf</command> is another source of Debian-specific
243 <indexterm role="concept">
244 <primary><filename>doc/NewStuff</filename></primary>
246 <indexterm role="concept">
247 <primary><filename>doc/ChangeLog</filename></primary>
249 <indexterm role="concept">
250 <primary>change log</primary>
252 As the program develops, there may be features in newer versions that have not
253 yet made it into this document, which is updated only when the most significant
254 digit of the fractional part of the version number changes. Specifications of
255 new features that are not yet in this manual are placed in the file
256 <filename>doc/NewStuff</filename> in the Exim distribution.
259 Some features may be classified as <quote>experimental</quote>. These may change
260 incompatibly while they are developing, or even be withdrawn. For this reason,
261 they are not documented in this manual. Information about experimental features
262 can be found in the file <filename>doc/experimental.txt</filename>.
265 All changes to the program (whether new features, bug fixes, or other kinds of
266 change) are noted briefly in the file called <filename>doc/ChangeLog</filename>.
269 <indexterm role="concept">
270 <primary><filename>doc/spec.txt</filename></primary>
272 This specification itself is available as an ASCII file in <filename>doc/spec.txt</filename> so
273 that it can easily be searched with a text editor. Other files in the <filename>doc</filename>
276 <informaltable frame="none">
277 <tgroup cols="2" colsep="0" rowsep="0">
278 <colspec colwidth="100pt" align="left"/>
279 <colspec colwidth="254pt" align="left"/>
282 <entry><filename>OptionLists.txt</filename></entry>
283 <entry>list of all options in alphabetical order</entry>
286 <entry><filename>dbm.discuss.txt</filename></entry>
287 <entry>discussion about DBM libraries</entry>
290 <entry><filename>exim.8</filename></entry>
291 <entry>a man page of Exim’s command line options</entry>
294 <entry><filename>experimental.txt</filename></entry>
295 <entry>documentation of experimental features</entry>
298 <entry><filename>filter.txt</filename></entry>
299 <entry>specification of the filter language</entry>
302 <entry><filename>Exim3.upgrade</filename></entry>
303 <entry>upgrade notes from release 2 to release 3</entry>
306 <entry><filename>Exim4.upgrade</filename></entry>
307 <entry>upgrade notes from release 3 to release 4</entry>
313 The main specification and the specification of the filtering language are also
314 available in other formats (HTML, PostScript, PDF, and Texinfo). Section
315 <xref linkend="SECTavail"/> below tells you how to get hold of these.
318 <section id="SECID2">
319 <title>FTP and web sites</title>
321 <indexterm role="concept">
322 <primary>web site</primary>
324 <indexterm role="concept">
325 <primary>FTP site</primary>
327 The primary site for Exim source distributions is currently the University of
328 Cambridge’s FTP site, whose contents are described in <emphasis>Where to find the Exim
329 distribution</emphasis> below. In addition, there is a web site and an FTP site at
330 <option>exim.org</option>. These are now also hosted at the University of Cambridge. The
331 <option>exim.org</option> site was previously hosted for a number of years by Energis
332 Squared, formerly Planet Online Ltd, whose support I gratefully acknowledge.
335 <indexterm role="concept">
336 <primary>wiki</primary>
338 <indexterm role="concept">
339 <primary>FAQ</primary>
341 As well as Exim distribution tar files, the Exim web site contains a number of
342 differently formatted versions of the documentation. A recent addition to the
343 online information is the Exim wiki (<emphasis role="bold"><ulink url="http://wiki.exim.org">http://wiki.exim.org</ulink></emphasis>),
344 which contains what used to be a separate FAQ, as well as various other
345 examples, tips, and know-how that have been contributed by Exim users.
348 <indexterm role="concept">
349 <primary>Bugzilla</primary>
351 An Exim Bugzilla exists at <emphasis role="bold"><ulink url="http://bugs.exim.org">http://bugs.exim.org</ulink></emphasis>. You can use
352 this to report bugs, and also to add items to the wish list. Please search
353 first to check that you are not duplicating a previous entry.
356 <section id="SECID3">
357 <title>Mailing lists</title>
359 <indexterm role="concept">
360 <primary>mailing lists</primary>
361 <secondary>for Exim users</secondary>
363 The following Exim mailing lists exist:
365 <informaltable frame="none">
366 <tgroup cols="2" colsep="0" rowsep="0">
367 <colspec colwidth="140pt" align="left"/>
368 <colspec colwidth="254pt" align="left"/>
371 <entry><emphasis>exim-users@exim.org</emphasis></entry>
372 <entry>General discussion list</entry>
375 <entry><emphasis>exim-dev@exim.org</emphasis></entry>
376 <entry>Discussion of bugs, enhancements, etc.</entry>
379 <entry><emphasis>exim-announce@exim.org</emphasis></entry>
380 <entry>Moderated, low volume announcements list</entry>
383 <entry><emphasis>exim-future@exim.org</emphasis></entry>
384 <entry>Discussion of long-term development</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
408 <section id="SECID4">
409 <title>Exim training</title>
411 <indexterm role="concept">
412 <primary>training courses</primary>
414 Training courses in Cambridge (UK) used to be run annually by the author of
415 Exim, before he retired. At the time of writing, there are no plans to run
416 further Exim courses in Cambridge. However, if that changes, relevant
417 information will be posted at <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>.
420 <section id="SECID5">
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 can be emailed to <emphasis>bugs@exim.org</emphasis> or reported
430 via the Bugzilla (<emphasis role="bold"><ulink url="http://bugs.exim.org">http://bugs.exim.org</ulink></emphasis>). However, if you are unsure
431 whether some behaviour is a bug or not, the best thing to do is to post a
432 message to the <emphasis>exim-dev</emphasis> mailing list and have it discussed.
435 <section id="SECTavail">
436 <title>Where to find the Exim distribution</title>
438 <indexterm role="concept">
439 <primary>FTP site</primary>
441 <indexterm role="concept">
442 <primary>distribution</primary>
443 <secondary>ftp site</secondary>
445 The master ftp site for the Exim distribution is
448 <emphasis role="bold">ftp://ftp.csx.cam.ac.uk/pub/software/email/exim</emphasis>
454 <emphasis role="bold">ftp://ftp.exim.org/pub/exim</emphasis>
457 The file references that follow are relative to the <filename>exim</filename> directories at
458 these sites. There are now quite a number of independent mirror sites around
459 the world. Those that I know about are listed in the file called <filename>Mirrors</filename>.
462 Within the <filename>exim</filename> directory there are subdirectories called <filename>exim3</filename> (for
463 previous Exim 3 distributions), <filename>exim4</filename> (for the latest Exim 4
464 distributions), and <filename>Testing</filename> for testing versions. In the <filename>exim4</filename>
465 subdirectory, the current release can always be found in files called
468 <filename>exim-n.nn.tar.gz</filename>
469 <filename>exim-n.nn.tar.bz2</filename>
472 where <emphasis>n.nn</emphasis> is the highest such version number in the directory. The two
473 files contain identical data; the only difference is the type of compression.
474 The <filename>.bz2</filename> file is usually a lot smaller than the <filename>.gz</filename> file.
477 <indexterm role="concept">
478 <primary>distribution</primary>
479 <secondary>signing details</secondary>
481 <indexterm role="concept">
482 <primary>distribution</primary>
483 <secondary>public key</secondary>
485 <indexterm role="concept">
486 <primary>public key for signed distribution</primary>
488 The distributions are currently signed with Nigel Metheringham’s GPG key. The
489 corresponding public key is available from a number of keyservers, and there is
490 also a copy in the file <filename>nigel-pubkey.asc</filename>. The signatures for the tar bundles are
494 <filename>exim-n.nn.tar.gz.asc</filename>
495 <filename>exim-n.nn.tar.bz2.asc</filename>
498 For each released version, the log of changes is made separately available in a
499 separate file in the directory <filename>ChangeLogs</filename> so that it is possible to
500 find out what has changed without having to download the entire distribution.
503 <indexterm role="concept">
504 <primary>documentation</primary>
505 <secondary>available formats</secondary>
507 The main distribution contains ASCII versions of this specification and other
508 documentation; other formats of the documents are available in separate files
509 inside the <filename>exim4</filename> directory of the FTP site:
512 <filename>exim-html-n.nn.tar.gz</filename>
513 <filename>exim-pdf-n.nn.tar.gz</filename>
514 <filename>exim-postscript-n.nn.tar.gz</filename>
515 <filename>exim-texinfo-n.nn.tar.gz</filename>
518 These tar files contain only the <filename>doc</filename> directory, not the complete
519 distribution, and are also available in <filename>.bz2</filename> as well as <filename>.gz</filename> forms.
522 <section id="SECID6">
523 <title>Limitations</title>
527 <indexterm role="concept">
528 <primary>limitations of Exim</primary>
530 <indexterm role="concept">
531 <primary>bang paths</primary>
532 <secondary>not handled by Exim</secondary>
534 Exim is designed for use as an Internet MTA, and therefore handles addresses in
535 RFC 2822 domain format only. It cannot handle UUCP <quote>bang paths</quote>, though
536 simple two-component bang paths can be converted by a straightforward rewriting
537 configuration. This restriction does not prevent Exim from being interfaced to
538 UUCP as a transport mechanism, provided that domain addresses are used.
543 <indexterm role="concept">
544 <primary>domainless addresses</primary>
546 <indexterm role="concept">
547 <primary>address</primary>
548 <secondary>without domain</secondary>
550 Exim insists that every address it handles has a domain attached. For incoming
551 local messages, domainless addresses are automatically qualified with a
552 configured domain value. Configuration options specify from which remote
553 systems unqualified addresses are acceptable. These are then qualified on
559 <indexterm role="concept">
560 <primary>transport</primary>
561 <secondary>external</secondary>
563 <indexterm role="concept">
564 <primary>external transports</primary>
566 The only external transport mechanisms that are currently implemented are SMTP
567 and LMTP over a TCP/IP network (including support for IPv6). However, a pipe
568 transport is available, and there are facilities for writing messages to files
569 and pipes, optionally in <emphasis>batched SMTP</emphasis> format; these facilities can be used
570 to send messages to other transport mechanisms such as UUCP, provided they can
571 handle domain-style addresses. Batched SMTP input is also catered for.
576 Exim is not designed for storing mail for dial-in hosts. When the volumes of
577 such mail are large, it is better to get the messages <quote>delivered</quote> into files
578 (that is, off Exim’s queue) and subsequently passed on to the dial-in hosts by
584 Although Exim does have basic facilities for scanning incoming messages, these
585 are not comprehensive enough to do full virus or spam scanning. Such operations
586 are best carried out using additional specialized software packages. If you
587 compile Exim with the content-scanning extension, straightforward interfaces to
588 a number of common scanners are provided.
593 <section id="SECID7">
594 <title>Run time configuration</title>
596 Exim’s run time configuration is held in a single text file that is divided
597 into a number of sections. The entries in this file consist of keywords and
598 values, in the style of Smail 3 configuration files. A default configuration
599 file which is suitable for simple online installations is provided in the
600 distribution, and is described in chapter <xref linkend="CHAPdefconfil"/> below.
603 <section id="SECID8">
604 <title>Calling interface</title>
606 <indexterm role="concept">
607 <primary>Sendmail compatibility</primary>
608 <secondary>command line interface</secondary>
610 Like many MTAs, Exim has adopted the Sendmail command line interface so that it
611 can be a straight replacement for <filename>/usr/lib/sendmail</filename> or
612 <filename>/usr/sbin/sendmail</filename> when sending mail, but you do not need to know anything
613 about Sendmail in order to run Exim. For actions other than sending messages,
614 Sendmail-compatible options also exist, but those that produce output (for
615 example, <option>-bp</option>, which lists the messages on the queue) do so in Exim’s own
616 format. There are also some additional options that are compatible with Smail
617 3, and some further options that are new to Exim. Chapter <xref linkend="CHAPcommandline"/>
618 documents all Exim’s command line options. This information is automatically
619 made into the man page that forms part of the Exim distribution.
622 Control of messages on the queue can be done via certain privileged command
623 line options. There is also an optional monitor program called <emphasis>eximon</emphasis>,
624 which displays current information in an X window, and which contains a menu
625 interface to Exim’s command line administration options.
628 <section id="SECID9">
629 <title>Terminology</title>
631 <indexterm role="concept">
632 <primary>terminology definitions</primary>
634 <indexterm role="concept">
635 <primary>body of message</primary>
636 <secondary>definition of</secondary>
638 The <emphasis>body</emphasis> of a message is the actual data that the sender wants to transmit.
639 It is the last part of a message, and is separated from the <emphasis>header</emphasis> (see
640 below) by a blank line.
643 <indexterm role="concept">
644 <primary>bounce message</primary>
645 <secondary>definition of</secondary>
647 When a message cannot be delivered, it is normally returned to the sender in a
648 delivery failure message or a <quote>non-delivery report</quote> (NDR). The term
649 <emphasis>bounce</emphasis> is commonly used for this action, and the error reports are often
650 called <emphasis>bounce messages</emphasis>. This is a convenient shorthand for <quote>delivery
651 failure error report</quote>. Such messages have an empty sender address in the
652 message’s <emphasis>envelope</emphasis> (see below) to ensure that they cannot themselves give
653 rise to further bounce messages.
656 The term <emphasis>default</emphasis> appears frequently in this manual. It is used to qualify a
657 value which is used in the absence of any setting in the configuration. It may
658 also qualify an action which is taken unless a configuration setting specifies
662 The term <emphasis>defer</emphasis> is used when the delivery of a message to a specific
663 destination cannot immediately take place for some reason (a remote host may be
664 down, or a user’s local mailbox may be full). Such deliveries are <emphasis>deferred</emphasis>
668 The word <emphasis>domain</emphasis> is sometimes used to mean all but the first component of a
669 host’s name. It is <emphasis>not</emphasis> used in that sense here, where it normally refers to
670 the part of an email address following the @ sign.
673 <indexterm role="concept">
674 <primary>envelope, definition of</primary>
676 <indexterm role="concept">
677 <primary>sender</primary>
678 <secondary>definition of</secondary>
680 A message in transit has an associated <emphasis>envelope</emphasis>, as well as a header and a
681 body. The envelope contains a sender address (to which bounce messages should
682 be delivered), and any number of recipient addresses. References to the
683 sender or the recipients of a message usually mean the addresses in the
684 envelope. An MTA uses these addresses for delivery, and for returning bounce
685 messages, not the addresses that appear in the header lines.
688 <indexterm role="concept">
689 <primary>message</primary>
690 <secondary>header, definition of</secondary>
692 <indexterm role="concept">
693 <primary>header section</primary>
694 <secondary>definition of</secondary>
696 The <emphasis>header</emphasis> of a message is the first part of a message’s text, consisting
697 of a number of lines, each of which has a name such as <emphasis>From:</emphasis>, <emphasis>To:</emphasis>,
698 <emphasis>Subject:</emphasis>, etc. Long header lines can be split over several text lines by
699 indenting the continuations. The header is separated from the body by a blank
703 <indexterm role="concept">
704 <primary>local part</primary>
705 <secondary>definition of</secondary>
707 <indexterm role="concept">
708 <primary>domain</primary>
709 <secondary>definition of</secondary>
711 The term <emphasis>local part</emphasis>, which is taken from RFC 2822, is used to refer to that
712 part of an email address that precedes the @ sign. The part that follows the
713 @ sign is called the <emphasis>domain</emphasis> or <emphasis>mail domain</emphasis>.
716 <indexterm role="concept">
717 <primary>local delivery</primary>
718 <secondary>definition of</secondary>
720 <indexterm role="concept">
721 <primary>remote delivery, definition of</primary>
723 The terms <emphasis>local delivery</emphasis> and <emphasis>remote delivery</emphasis> are used to distinguish
724 delivery to a file or a pipe on the local host from delivery by SMTP over
725 TCP/IP to another host. As far as Exim is concerned, all hosts other than the
726 host it is running on are <emphasis>remote</emphasis>.
729 <indexterm role="concept">
730 <primary>return path</primary>
731 <secondary>definition of</secondary>
733 <emphasis>Return path</emphasis> is another name that is used for the sender address in a
734 message’s envelope.
737 <indexterm role="concept">
738 <primary>queue</primary>
739 <secondary>definition of</secondary>
741 The term <emphasis>queue</emphasis> is used to refer to the set of messages awaiting delivery,
742 because this term is in widespread use in the context of MTAs. However, in
743 Exim’s case the reality is more like a pool than a queue, because there is
744 normally no ordering of waiting messages.
747 <indexterm role="concept">
748 <primary>queue runner</primary>
749 <secondary>definition of</secondary>
751 The term <emphasis>queue runner</emphasis> is used to describe a process that scans the queue
752 and attempts to deliver those messages whose retry times have come. This term
753 is used by other MTAs, and also relates to the command <option>runq</option>, but in Exim
754 the waiting messages are normally processed in an unpredictable order.
757 <indexterm role="concept">
758 <primary>spool directory</primary>
759 <secondary>definition of</secondary>
761 The term <emphasis>spool directory</emphasis> is used for a directory in which Exim keeps the
762 messages on its queue – that is, those that it is in the process of
763 delivering. This should not be confused with the directory in which local
764 mailboxes are stored, which is called a <quote>spool directory</quote> by some people. In
765 the Exim documentation, <quote>spool</quote> is always used in the first sense.
771 <title>Incorporated code</title>
773 <indexterm role="concept">
774 <primary>incorporated code</primary>
776 <indexterm role="concept">
777 <primary>regular expressions</primary>
778 <secondary>library</secondary>
780 <indexterm role="concept">
781 <primary>PCRE</primary>
783 A number of pieces of external code are included in the Exim distribution.
788 Regular expressions are supported in the main Exim program and in the
789 Exim monitor using the freely-distributable PCRE library, copyright
790 © University of Cambridge. The source to PCRE is no longer shipped with
791 Exim, so you will need to use the version of PCRE shipped with your system,
792 or obtain and install the full version of the library from
793 <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>.
798 <indexterm role="concept">
799 <primary>cdb</primary>
800 <secondary>acknowledgment</secondary>
802 Support for the cdb (Constant DataBase) lookup method is provided by code
803 contributed by Nigel Metheringham of (at the time he contributed it) Planet
804 Online Ltd. The implementation is completely contained within the code of Exim.
805 It does not link against an external cdb library. The code contains the
806 following statements:
810 Copyright © 1998 Nigel Metheringham, Planet Online Ltd
813 This program is free software; you can redistribute it and/or modify it under
814 the terms of the GNU General Public License as published by the Free Software
815 Foundation; either version 2 of the License, or (at your option) any later
817 This code implements Dan Bernstein’s Constant DataBase (cdb) spec. Information,
818 the spec and sample code for cdb can be obtained from
819 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>. This implementation borrows
820 some code from Dan Bernstein’s implementation (which has no license
821 restrictions applied to it).
827 <indexterm role="concept">
828 <primary>SPA authentication</primary>
830 <indexterm role="concept">
831 <primary>Samba project</primary>
833 <indexterm role="concept">
834 <primary>Microsoft Secure Password Authentication</primary>
836 Client support for Microsoft’s <emphasis>Secure Password Authentication</emphasis> is provided
837 by code contributed by Marc Prud’hommeaux. Server support was contributed by
838 Tom Kistner. This includes code taken from the Samba project, which is released
844 <indexterm role="concept">
845 <primary>Cyrus</primary>
847 <indexterm role="concept">
848 <primary><emphasis>pwcheck</emphasis> daemon</primary>
850 <indexterm role="concept">
851 <primary><emphasis>pwauthd</emphasis> daemon</primary>
853 Support for calling the Cyrus <emphasis>pwcheck</emphasis> and <emphasis>saslauthd</emphasis> daemons is provided
854 by code taken from the Cyrus-SASL library and adapted by Alexander S.
855 Sabourenkov. The permission notice appears below, in accordance with the
856 conditions expressed therein.
860 Copyright © 2001 Carnegie Mellon University. All rights reserved.
863 Redistribution and use in source and binary forms, with or without
864 modification, are permitted provided that the following conditions
867 <orderedlist numeration="arabic">
870 Redistributions of source code must retain the above copyright
871 notice, this list of conditions and the following disclaimer.
876 Redistributions in binary form must reproduce the above copyright
877 notice, this list of conditions and the following disclaimer in
878 the documentation and/or other materials provided with the
884 The name <quote>Carnegie Mellon University</quote> must not be used to
885 endorse or promote products derived from this software without
886 prior written permission. For permission or any other legal
887 details, please contact
890 Office of Technology Transfer
891 Carnegie Mellon University
893 Pittsburgh, PA 15213-3890
894 (412) 268-4387, fax: (412) 268-7395
895 tech-transfer@andrew.cmu.edu
900 Redistributions of any form whatsoever must retain the following
904 <quote>This product includes software developed by Computing Services
905 at Carnegie Mellon University (<emphasis role="bold"><ulink url="http://www.cmu.edu/computing/">http://www.cmu.edu/computing/</ulink></emphasis>.</quote>
908 CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
909 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
910 AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
911 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
912 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
913 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
914 OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
922 <indexterm role="concept">
923 <primary>Exim monitor</primary>
924 <secondary>acknowledgment</secondary>
926 <indexterm role="concept">
927 <primary>X-windows</primary>
929 <indexterm role="concept">
930 <primary>Athena</primary>
932 The Exim Monitor program, which is an X-Window application, includes
933 modified versions of the Athena StripChart and TextPop widgets.
934 This code is copyright by DEC and MIT, and their permission notice appears
935 below, in accordance with the conditions expressed therein.
939 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
940 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
946 Permission to use, copy, modify, and distribute this software and its
947 documentation for any purpose and without fee is hereby granted,
948 provided that the above copyright notice appear in all copies and that
949 both that copyright notice and this permission notice appear in
950 supporting documentation, and that the names of Digital or MIT not be
951 used in advertising or publicity pertaining to distribution of the
952 software without specific, written prior permission.
955 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
956 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
957 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
958 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
959 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
960 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
967 Many people have contributed code fragments, some large, some small, that were
968 not covered by any specific licence requirements. It is assumed that the
969 contributors are happy to see their code incorporated into Exim under the GPL.
975 <chapter id="CHID11">
976 <title>How Exim receives and delivers mail</title>
977 <titleabbrev>Receiving and delivering mail</titleabbrev>
978 <section id="SECID10">
979 <title>Overall philosophy</title>
981 <indexterm role="concept">
982 <primary>design philosophy</primary>
984 Exim is designed to work efficiently on systems that are permanently connected
985 to the Internet and are handling a general mix of mail. In such circumstances,
986 most messages can be delivered immediately. Consequently, Exim does not
987 maintain independent queues of messages for specific domains or hosts, though
988 it does try to send several messages in a single SMTP connection after a host
989 has been down, and it also maintains per-host retry information.
992 <section id="SECID11">
993 <title>Policy control</title>
995 <indexterm role="concept">
996 <primary>policy control</primary>
997 <secondary>overview</secondary>
999 Policy controls are now an important feature of MTAs that are connected to the
1000 Internet. Perhaps their most important job is to stop MTAs being abused as
1001 <quote>open relays</quote> by misguided individuals who send out vast amounts of
1002 unsolicited junk, and want to disguise its source. Exim provides flexible
1003 facilities for specifying policy controls on incoming mail:
1008 <indexterm role="concept">
1009 <primary>access control lists (ACLs)</primary>
1010 <secondary>introduction</secondary>
1012 Exim 4 (unlike previous versions of Exim) implements policy controls on
1013 incoming mail by means of <emphasis>Access Control Lists</emphasis> (ACLs). Each list is a
1014 series of statements that may either grant or deny access. ACLs can be used at
1015 several places in the SMTP dialogue while receiving a message from a remote
1016 host. However, the most common places are after each RCPT command, and at the
1017 very end of the message. The sysadmin can specify conditions for accepting or
1018 rejecting individual recipients or the entire message, respectively, at these
1019 two points (see chapter <xref linkend="CHAPACL"/>). Denial of access results in an SMTP
1025 An ACL is also available for locally generated, non-SMTP messages. In this
1026 case, the only available actions are to accept or deny the entire message.
1031 When Exim is compiled with the content-scanning extension, facilities are
1032 provided in the ACL mechanism for passing the message to external virus and/or
1033 spam scanning software. The result of such a scan is passed back to the ACL,
1034 which can then use it to decide what to do with the message.
1039 When a message has been received, either from a remote host or from the local
1040 host, but before the final acknowledgment has been sent, a locally supplied C
1041 function called <function>local_scan()</function> can be run to inspect the message and decide
1042 whether to accept it or not (see chapter <xref linkend="CHAPlocalscan"/>). If the message
1043 is accepted, the list of recipients can be modified by the function.
1048 Using the <function>local_scan()</function> mechanism is another way of calling external scanner
1049 software. The <option>SA-Exim</option> add-on package works this way. It does not require
1050 Exim to be compiled with the content-scanning extension.
1055 After a message has been accepted, a further checking mechanism is available in
1056 the form of the <emphasis>system filter</emphasis> (see chapter <xref linkend="CHAPsystemfilter"/>). This
1057 runs at the start of every delivery process.
1062 <section id="SECID12">
1063 <title>User filters</title>
1065 <indexterm role="concept">
1066 <primary>filter</primary>
1067 <secondary>introduction</secondary>
1069 <indexterm role="concept">
1070 <primary>Sieve filter</primary>
1072 In a conventional Exim configuration, users are able to run private filters by
1073 setting up appropriate <filename>.forward</filename> files in their home directories. See
1074 chapter <xref linkend="CHAPredirect"/> (about the <command>redirect</command> router) for the
1075 configuration needed to support this, and the separate document entitled
1076 <emphasis>Exim’s interfaces to mail filtering</emphasis> for user details. Two different kinds
1077 of filtering are available:
1082 Sieve filters are written in the standard filtering language that is defined
1088 Exim filters are written in a syntax that is unique to Exim, but which is more
1089 powerful than Sieve, which it pre-dates.
1094 User filters are run as part of the routing process, described below.
1097 <section id="SECTmessiden">
1098 <title>Message identification</title>
1100 <indexterm role="concept">
1101 <primary>message ids</primary>
1102 <secondary>details of format</secondary>
1104 <indexterm role="concept">
1105 <primary>format</primary>
1106 <secondary>of message id</secondary>
1108 <indexterm role="concept">
1109 <primary>id of message</primary>
1111 <indexterm role="concept">
1112 <primary>base62</primary>
1114 <indexterm role="concept">
1115 <primary>base36</primary>
1117 <indexterm role="concept">
1118 <primary>Darwin</primary>
1120 <indexterm role="concept">
1121 <primary>Cygwin</primary>
1123 Every message handled by Exim is given a <emphasis>message id</emphasis> which is sixteen
1124 characters long. It is divided into three parts, separated by hyphens, for
1125 example <literal>16VDhn-0001bo-D3</literal>. Each part is a sequence of letters and digits,
1126 normally encoding numbers in base 62. However, in the Darwin operating
1127 system (Mac OS X) and when Exim is compiled to run under Cygwin, base 36
1128 (avoiding the use of lower case letters) is used instead, because the message
1129 id is used to construct file names, and the names of files in those systems are
1130 not always case-sensitive.
1133 <indexterm role="concept">
1134 <primary>pid (process id)</primary>
1135 <secondary>re-use of</secondary>
1137 The detail of the contents of the message id have changed as Exim has evolved.
1138 Earlier versions relied on the operating system not re-using a process id (pid)
1139 within one second. On modern operating systems, this assumption can no longer
1140 be made, so the algorithm had to be changed. To retain backward compatibility,
1141 the format of the message id was retained, which is why the following rules are
1147 The first six characters of the message id are the time at which the message
1148 started to be received, to a granularity of one second. That is, this field
1149 contains the number of seconds since the start of the epoch (the normal Unix
1150 way of representing the date and time of day).
1155 After the first hyphen, the next six characters are the id of the process that
1156 received the message.
1161 There are two different possibilities for the final two characters:
1163 <orderedlist numeration="arabic">
1166 <indexterm role="option">
1167 <primary><option>localhost_number</option></primary>
1169 If <option>localhost_number</option> is not set, this value is the fractional part of the
1170 time of reception, normally in units of 1/2000 of a second, but for systems
1171 that must use base 36 instead of base 62 (because of case-insensitive file
1172 systems), the units are 1/1000 of a second.
1177 If <option>localhost_number</option> is set, it is multiplied by 200 (100) and added to
1178 the fractional part of the time, which in this case is in units of 1/200
1179 (1/100) of a second.
1186 After a message has been received, Exim waits for the clock to tick at the
1187 appropriate resolution before proceeding, so that if another message is
1188 received by the same process, or by another process with the same (re-used)
1189 pid, it is guaranteed that the time will be different. In most cases, the clock
1190 will already have ticked while the message was being received.
1193 <section id="SECID13">
1194 <title>Receiving mail</title>
1196 <indexterm role="concept">
1197 <primary>receiving mail</primary>
1199 <indexterm role="concept">
1200 <primary>message</primary>
1201 <secondary>reception</secondary>
1203 The only way Exim can receive mail from another host is using SMTP over
1204 TCP/IP, in which case the sender and recipient addresses are transferred using
1205 SMTP commands. However, from a locally running process (such as a user’s MUA),
1206 there are several possibilities:
1211 If the process runs Exim with the <option>-bm</option> option, the message is read
1212 non-interactively (usually via a pipe), with the recipients taken from the
1213 command line, or from the body of the message if <option>-t</option> is also used.
1218 If the process runs Exim with the <option>-bS</option> option, the message is also read
1219 non-interactively, but in this case the recipients are listed at the start of
1220 the message in a series of SMTP RCPT commands, terminated by a DATA
1221 command. This is so-called <quote>batch SMTP</quote> format,
1222 but it isn’t really SMTP. The SMTP commands are just another way of passing
1223 envelope addresses in a non-interactive submission.
1228 If the process runs Exim with the <option>-bs</option> option, the message is read
1229 interactively, using the SMTP protocol. A two-way pipe is normally used for
1230 passing data between the local process and the Exim process.
1231 This is <quote>real</quote> SMTP and is handled in the same way as SMTP over TCP/IP. For
1232 example, the ACLs for SMTP commands are used for this form of submission.
1237 A local process may also make a TCP/IP call to the host’s loopback address
1238 (127.0.0.1) or any other of its IP addresses. When receiving messages, Exim
1239 does not treat the loopback address specially. It treats all such connections
1240 in the same way as connections from other hosts.
1245 <indexterm role="concept">
1246 <primary>message sender, constructed by Exim</primary>
1248 <indexterm role="concept">
1249 <primary>sender</primary>
1250 <secondary>constructed by Exim</secondary>
1252 In the three cases that do not involve TCP/IP, the sender address is
1253 constructed from the login name of the user that called Exim and a default
1254 qualification domain (which can be set by the <option>qualify_domain</option> configuration
1255 option). For local or batch SMTP, a sender address that is passed using the
1256 SMTP MAIL command is ignored. However, the system administrator may allow
1257 certain users (<quote>trusted users</quote>) to specify a different sender address
1258 unconditionally, or all users to specify certain forms of different sender
1259 address. The <option>-f</option> option or the SMTP MAIL command is used to specify these
1260 different addresses. See section <xref linkend="SECTtrustedadmin"/> for details of trusted
1261 users, and the <option>untrusted_set_sender</option> option for a way of allowing untrusted
1262 users to change sender addresses.
1265 Messages received by either of the non-interactive mechanisms are subject to
1266 checking by the non-SMTP ACL, if one is defined. Messages received using SMTP
1267 (either over TCP/IP, or interacting with a local process) can be checked by a
1268 number of ACLs that operate at different times during the SMTP session. Either
1269 individual recipients, or the entire message, can be rejected if local policy
1270 requirements are not met. The <function>local_scan()</function> function (see chapter
1271 <xref linkend="CHAPlocalscan"/>) is run for all incoming messages.
1274 Exim can be configured not to start a delivery process when a message is
1275 received; this can be unconditional, or depend on the number of incoming SMTP
1276 connections or the system load. In these situations, new messages wait on the
1277 queue until a queue runner process picks them up. However, in standard
1278 configurations under normal conditions, delivery is started as soon as a
1279 message is received.
1282 <section id="SECID14">
1283 <title>Handling an incoming message</title>
1285 <indexterm role="concept">
1286 <primary>spool directory</primary>
1287 <secondary>files that hold a message</secondary>
1289 <indexterm role="concept">
1290 <primary>file</primary>
1291 <secondary>how a message is held</secondary>
1293 When Exim accepts a message, it writes two files in its spool directory. The
1294 first contains the envelope information, the current status of the message, and
1295 the header lines, and the second contains the body of the message. The names of
1296 the two spool files consist of the message id, followed by <literal>-H</literal> for the
1297 file containing the envelope and header, and <literal>-D</literal> for the data file.
1300 <indexterm role="concept">
1301 <primary>spool directory</primary>
1302 <secondary><filename>input</filename> sub-directory</secondary>
1304 By default all these message files are held in a single directory called
1305 <filename>input</filename> inside the general Exim spool directory. Some operating systems do
1306 not perform very well if the number of files in a directory gets large; to
1307 improve performance in such cases, the <option>split_spool_directory</option> option can be
1308 used. This causes Exim to split up the input files into 62 sub-directories
1309 whose names are single letters or digits. When this is done, the queue is
1310 processed one sub-directory at a time instead of all at once, which can improve
1311 overall performance even when there are not enough files in each directory to
1312 affect file system performance.
1315 The envelope information consists of the address of the message’s sender and
1316 the addresses of the recipients. This information is entirely separate from
1317 any addresses contained in the header lines. The status of the message includes
1318 a list of recipients who have already received the message. The format of the
1319 first spool file is described in chapter <xref linkend="CHAPspool"/>.
1322 <indexterm role="concept">
1323 <primary>rewriting</primary>
1324 <secondary>addresses</secondary>
1326 Address rewriting that is specified in the rewrite section of the configuration
1327 (see chapter <xref linkend="CHAPrewrite"/>) is done once and for all on incoming addresses,
1328 both in the header lines and the envelope, at the time the message is accepted.
1329 If during the course of delivery additional addresses are generated (for
1330 example, via aliasing), these new addresses are rewritten as soon as they are
1331 generated. At the time a message is actually delivered (transported) further
1332 rewriting can take place; because this is a transport option, it can be
1333 different for different forms of delivery. It is also possible to specify the
1334 addition or removal of certain header lines at the time the message is
1335 delivered (see chapters <xref linkend="CHAProutergeneric"/> and
1336 <xref linkend="CHAPtransportgeneric"/>).
1339 <section id="SECID15">
1340 <title>Life of a message</title>
1342 <indexterm role="concept">
1343 <primary>message</primary>
1344 <secondary>life of</secondary>
1346 <indexterm role="concept">
1347 <primary>message</primary>
1348 <secondary>frozen</secondary>
1350 A message remains in the spool directory until it is completely delivered to
1351 its recipients or to an error address, or until it is deleted by an
1352 administrator or by the user who originally created it. In cases when delivery
1353 cannot proceed – for example, when a message can neither be delivered to its
1354 recipients nor returned to its sender, the message is marked <quote>frozen</quote> on the
1355 spool, and no more deliveries are attempted.
1358 <indexterm role="concept">
1359 <primary>frozen messages</primary>
1360 <secondary>thawing</secondary>
1362 <indexterm role="concept">
1363 <primary>message</primary>
1364 <secondary>thawing frozen</secondary>
1366 An administrator can <quote>thaw</quote> such messages when the problem has been
1367 corrected, and can also freeze individual messages by hand if necessary. In
1368 addition, an administrator can force a delivery error, causing a bounce message
1372 <indexterm role="option">
1373 <primary><option>timeout_frozen_after</option></primary>
1375 <indexterm role="option">
1376 <primary><option>ignore_bounce_errors_after</option></primary>
1378 There are options called <option>ignore_bounce_errors_after</option> and
1379 <option>timeout_frozen_after</option>, which discard frozen messages after a certain time.
1380 The first applies only to frozen bounces, the second to any frozen messages.
1383 <indexterm role="concept">
1384 <primary>message</primary>
1385 <secondary>log file for</secondary>
1387 <indexterm role="concept">
1388 <primary>log</primary>
1389 <secondary>file for each message</secondary>
1391 While Exim is working on a message, it writes information about each delivery
1392 attempt to its main log file. This includes successful, unsuccessful, and
1393 delayed deliveries for each recipient (see chapter <xref linkend="CHAPlog"/>). The log
1394 lines are also written to a separate <emphasis>message log</emphasis> file for each message.
1395 These logs are solely for the benefit of the administrator, and are normally
1396 deleted along with the spool files when processing of a message is complete.
1397 The use of individual message logs can be disabled by setting
1398 <option>no_message_logs</option>; this might give an improvement in performance on very busy
1402 <indexterm role="concept">
1403 <primary>journal file</primary>
1405 <indexterm role="concept">
1406 <primary>file</primary>
1407 <secondary>journal</secondary>
1409 All the information Exim itself needs to set up a delivery is kept in the first
1410 spool file, along with the header lines. When a successful delivery occurs, the
1411 address is immediately written at the end of a journal file, whose name is the
1412 message id followed by <literal>-J</literal>. At the end of a delivery run, if there are some
1413 addresses left to be tried again later, the first spool file (the <literal>-H</literal> file)
1414 is updated to indicate which these are, and the journal file is then deleted.
1415 Updating the spool file is done by writing a new file and renaming it, to
1416 minimize the possibility of data loss.
1419 Should the system or the program crash after a successful delivery but before
1420 the spool file has been updated, the journal is left lying around. The next
1421 time Exim attempts to deliver the message, it reads the journal file and
1422 updates the spool file before proceeding. This minimizes the chances of double
1423 deliveries caused by crashes.
1426 <section id="SECTprocaddress">
1427 <title>Processing an address for delivery</title>
1429 <indexterm role="concept">
1430 <primary>drivers</primary>
1431 <secondary>definition of</secondary>
1433 <indexterm role="concept">
1434 <primary>router</primary>
1435 <secondary>definition of</secondary>
1437 <indexterm role="concept">
1438 <primary>transport</primary>
1439 <secondary>definition of</secondary>
1441 The main delivery processing elements of Exim are called <emphasis>routers</emphasis> and
1442 <emphasis>transports</emphasis>, and collectively these are known as <emphasis>drivers</emphasis>. Code for a
1443 number of them is provided in the source distribution, and compile-time options
1444 specify which ones are included in the binary. Run time options specify which
1445 ones are actually used for delivering messages.
1448 <indexterm role="concept">
1449 <primary>drivers</primary>
1450 <secondary>instance definition</secondary>
1452 Each driver that is specified in the run time configuration is an <emphasis>instance</emphasis>
1453 of that particular driver type. Multiple instances are allowed; for example,
1454 you can set up several different <command>smtp</command> transports, each with different
1455 option values that might specify different ports or different timeouts. Each
1456 instance has its own identifying name. In what follows we will normally use the
1457 instance name when discussing one particular instance (that is, one specific
1458 configuration of the driver), and the generic driver name when discussing
1459 the driver’s features in general.
1462 A <emphasis>router</emphasis> is a driver that operates on an address, either determining how
1463 its delivery should happen, by assigning it to a specific transport, or
1464 converting the address into one or more new addresses (for example, via an
1465 alias file). A router may also explicitly choose to fail an address, causing it
1469 A <emphasis>transport</emphasis> is a driver that transmits a copy of the message from Exim’s
1470 spool to some destination. There are two kinds of transport: for a <emphasis>local</emphasis>
1471 transport, the destination is a file or a pipe on the local host, whereas for a
1472 <emphasis>remote</emphasis> transport the destination is some other host. A message is passed
1473 to a specific transport as a result of successful routing. If a message has
1474 several recipients, it may be passed to a number of different transports.
1477 <indexterm role="concept">
1478 <primary>preconditions</primary>
1479 <secondary>definition of</secondary>
1481 An address is processed by passing it to each configured router instance in
1482 turn, subject to certain preconditions, until a router accepts the address or
1483 specifies that it should be bounced. We will describe this process in more
1484 detail shortly. First, as a simple example, we consider how each recipient
1485 address in a message is processed in a small configuration of three routers.
1488 To make this a more concrete example, it is described in terms of some actual
1489 routers, but remember, this is only an example. You can configure Exim’s
1490 routers in many different ways, and there may be any number of routers in a
1494 The first router that is specified in a configuration is often one that handles
1495 addresses in domains that are not recognized specially by the local host. These
1496 are typically addresses for arbitrary domains on the Internet. A precondition
1497 is set up which looks for the special domains known to the host (for example,
1498 its own domain name), and the router is run for addresses that do <emphasis>not</emphasis>
1499 match. Typically, this is a router that looks up domains in the DNS in order to
1500 find the hosts to which this address routes. If it succeeds, the address is
1501 assigned to a suitable SMTP transport; if it does not succeed, the router is
1502 configured to fail the address.
1505 The second router is reached only when the domain is recognized as one that
1506 <quote>belongs</quote> to the local host. This router does redirection – also known as
1507 aliasing and forwarding. When it generates one or more new addresses from the
1508 original, each of them is routed independently from the start. Otherwise, the
1509 router may cause an address to fail, or it may simply decline to handle the
1510 address, in which case the address is passed to the next router.
1513 The final router in many configurations is one that checks to see if the
1514 address belongs to a local mailbox. The precondition may involve a check to
1515 see if the local part is the name of a login account, or it may look up the
1516 local part in a file or a database. If its preconditions are not met, or if
1517 the router declines, we have reached the end of the routers. When this happens,
1518 the address is bounced.
1521 <section id="SECID16">
1522 <title>Processing an address for verification</title>
1524 <indexterm role="concept">
1525 <primary>router</primary>
1526 <secondary>for verification</secondary>
1528 <indexterm role="concept">
1529 <primary>verifying address</primary>
1530 <secondary>overview</secondary>
1532 As well as being used to decide how to deliver to an address, Exim’s routers
1533 are also used for <emphasis>address verification</emphasis>. Verification can be requested as
1534 one of the checks to be performed in an ACL for incoming messages, on both
1535 sender and recipient addresses, and it can be tested using the <option>-bv</option> and
1536 <option>-bvs</option> command line options.
1539 When an address is being verified, the routers are run in <quote>verify mode</quote>. This
1540 does not affect the way the routers work, but it is a state that can be
1541 detected. By this means, a router can be skipped or made to behave differently
1542 when verifying. A common example is a configuration in which the first router
1543 sends all messages to a message-scanning program, unless they have been
1544 previously scanned. Thus, the first router accepts all addresses without any
1545 checking, making it useless for verifying. Normally, the <option>no_verify</option> option
1546 would be set for such a router, causing it to be skipped in verify mode.
1549 <section id="SECTrunindrou">
1550 <title>Running an individual router</title>
1552 <indexterm role="concept">
1553 <primary>router</primary>
1554 <secondary>running details</secondary>
1556 <indexterm role="concept">
1557 <primary>preconditions</primary>
1558 <secondary>checking</secondary>
1560 <indexterm role="concept">
1561 <primary>router</primary>
1562 <secondary>result of running</secondary>
1564 As explained in the example above, a number of preconditions are checked before
1565 running a router. If any are not met, the router is skipped, and the address is
1566 passed to the next router. When all the preconditions on a router <emphasis>are</emphasis> met,
1567 the router is run. What happens next depends on the outcome, which is one of
1573 <emphasis>accept</emphasis>: The router accepts the address, and either assigns it to a
1574 transport, or generates one or more <quote>child</quote> addresses. Processing the
1575 original address ceases,
1576 <indexterm role="option">
1577 <primary><option>unseen</option></primary>
1579 unless the <option>unseen</option> option is set on the router. This option
1580 can be used to set up multiple deliveries with different routing (for example,
1581 for keeping archive copies of messages). When <option>unseen</option> is set, the address is
1582 passed to the next router. Normally, however, an <emphasis>accept</emphasis> return marks the
1586 Any child addresses generated by the router are processed independently,
1587 starting with the first router by default. It is possible to change this by
1588 setting the <option>redirect_router</option> option to specify which router to start at for
1589 child addresses. Unlike <option>pass_router</option> (see below) the router specified by
1590 <option>redirect_router</option> may be anywhere in the router configuration.
1595 <emphasis>pass</emphasis>: The router recognizes the address, but cannot handle it itself. It
1596 requests that the address be passed to another router. By default the address
1597 is passed to the next router, but this can be changed by setting the
1598 <option>pass_router</option> option. However, (unlike <option>redirect_router</option>) the named router
1599 must be below the current router (to avoid loops).
1604 <emphasis>decline</emphasis>: The router declines to accept the address because it does not
1605 recognize it at all. By default, the address is passed to the next router, but
1606 this can be prevented by setting the <option>no_more</option> option. When <option>no_more</option> is
1607 set, all the remaining routers are skipped. In effect, <option>no_more</option> converts
1608 <emphasis>decline</emphasis> into <emphasis>fail</emphasis>.
1613 <emphasis>fail</emphasis>: The router determines that the address should fail, and queues it for
1614 the generation of a bounce message. There is no further processing of the
1615 original address unless <option>unseen</option> is set on the router.
1620 <emphasis>defer</emphasis>: The router cannot handle the address at the present time. (A
1621 database may be offline, or a DNS lookup may have timed out.) No further
1622 processing of the address happens in this delivery attempt. It is tried again
1623 next time the message is considered for delivery.
1628 <emphasis>error</emphasis>: There is some error in the router (for example, a syntax error in
1629 its configuration). The action is as for defer.
1634 If an address reaches the end of the routers without having been accepted by
1635 any of them, it is bounced as unrouteable. The default error message in this
1636 situation is <quote>unrouteable address</quote>, but you can set your own message by
1637 making use of the <option>cannot_route_message</option> option. This can be set for any
1638 router; the value from the last router that <quote>saw</quote> the address is used.
1641 Sometimes while routing you want to fail a delivery when some conditions are
1642 met but others are not, instead of passing the address on for further routing.
1643 You can do this by having a second router that explicitly fails the delivery
1644 when the relevant conditions are met. The <command>redirect</command> router has a <quote>fail</quote>
1645 facility for this purpose.
1648 <section id="SECID17">
1649 <title>Duplicate addresses</title>
1651 <indexterm role="concept">
1652 <primary>case of local parts</primary>
1654 <indexterm role="concept">
1655 <primary>address duplicate, discarding</primary>
1657 <indexterm role="concept">
1658 <primary>duplicate addresses</primary>
1660 Once routing is complete, Exim scans the addresses that are assigned to local
1661 and remote transports, and discards any duplicates that it finds. During this
1662 check, local parts are treated as case-sensitive. This happens only when
1663 actually delivering a message; when testing routers with <option>-bt</option>, all the
1664 routed addresses are shown.
1667 <section id="SECTrouprecon">
1668 <title>Router preconditions</title>
1670 <indexterm role="concept">
1671 <primary>router</primary>
1672 <secondary>preconditions, order of processing</secondary>
1674 <indexterm role="concept">
1675 <primary>preconditions</primary>
1676 <secondary>order of processing</secondary>
1678 The preconditions that are tested for each router are listed below, in the
1679 order in which they are tested. The individual configuration options are
1680 described in more detail in chapter <xref linkend="CHAProutergeneric"/>.
1685 The <option>local_part_prefix</option> and <option>local_part_suffix</option> options can specify that
1686 the local parts handled by the router may or must have certain prefixes and/or
1687 suffixes. If a mandatory affix (prefix or suffix) is not present, the router is
1688 skipped. These conditions are tested first. When an affix is present, it is
1689 removed from the local part before further processing, including the evaluation
1690 of any other conditions.
1695 Routers can be designated for use only when not verifying an address, that is,
1696 only when routing it for delivery (or testing its delivery routing). If the
1697 <option>verify</option> option is set false, the router is skipped when Exim is verifying an
1699 Setting the <option>verify</option> option actually sets two options, <option>verify_sender</option> and
1700 <option>verify_recipient</option>, which independently control the use of the router for
1701 sender and recipient verification. You can set these options directly if
1702 you want a router to be used for only one type of verification.
1707 If the <option>address_test</option> option is set false, the router is skipped when Exim is
1708 run with the <option>-bt</option> option to test an address routing. This can be helpful
1709 when the first router sends all new messages to a scanner of some sort; it
1710 makes it possible to use <option>-bt</option> to test subsequent delivery routing without
1711 having to simulate the effect of the scanner.
1716 Routers can be designated for use only when verifying an address, as
1717 opposed to routing it for delivery. The <option>verify_only</option> option controls this.
1722 Individual routers can be explicitly skipped when running the routers to
1723 check an address given in the SMTP EXPN command (see the <option>expn</option> option).
1728 If the <option>domains</option> option is set, the domain of the address must be in the set
1729 of domains that it defines.
1734 <indexterm role="variable">
1735 <primary><varname>$local_part_prefix</varname></primary>
1737 <indexterm role="variable">
1738 <primary><varname>$local_part</varname></primary>
1740 <indexterm role="variable">
1741 <primary><varname>$local_part_suffix</varname></primary>
1743 If the <option>local_parts</option> option is set, the local part of the address must be in
1744 the set of local parts that it defines. If <option>local_part_prefix</option> or
1745 <option>local_part_suffix</option> is in use, the prefix or suffix is removed from the local
1746 part before this check. If you want to do precondition tests on local parts
1747 that include affixes, you can do so by using a <option>condition</option> option (see below)
1748 that uses the variables <varname>$local_part</varname>, <varname>$local_part_prefix</varname>, and
1749 <varname>$local_part_suffix</varname> as necessary.
1754 <indexterm role="variable">
1755 <primary><varname>$local_user_uid</varname></primary>
1757 <indexterm role="variable">
1758 <primary><varname>$local_user_gid</varname></primary>
1760 <indexterm role="variable">
1761 <primary><varname>$home</varname></primary>
1763 If the <option>check_local_user</option> option is set, the local part must be the name of
1764 an account on the local host. If this check succeeds, the uid and gid of the
1765 local user are placed in <varname>$local_user_uid</varname> and <varname>$local_user_gid</varname> and the
1766 user’s home directory is placed in <varname>$home</varname>; these values can be used in the
1767 remaining preconditions.
1772 If the <option>router_home_directory</option> option is set, it is expanded at this point,
1773 because it overrides the value of <varname>$home</varname>. If this expansion were left till
1774 later, the value of <varname>$home</varname> as set by <option>check_local_user</option> would be used in
1775 subsequent tests. Having two different values of <varname>$home</varname> in the same router
1776 could lead to confusion.
1781 If the <option>senders</option> option is set, the envelope sender address must be in the
1782 set of addresses that it defines.
1787 If the <option>require_files</option> option is set, the existence or non-existence of
1788 specified files is tested.
1793 <indexterm role="concept">
1794 <primary>customizing</primary>
1795 <secondary>precondition</secondary>
1797 If the <option>condition</option> option is set, it is evaluated and tested. This option
1798 uses an expanded string to allow you to set up your own custom preconditions.
1799 Expanded strings are described in chapter <xref linkend="CHAPexpand"/>.
1804 Note that <option>require_files</option> comes near the end of the list, so you cannot use
1805 it to check for the existence of a file in which to lookup up a domain, local
1806 part, or sender. However, as these options are all expanded, you can use the
1807 <option>exists</option> expansion condition to make such tests within each condition. The
1808 <option>require_files</option> option is intended for checking files that the router may be
1809 going to use internally, or which are needed by a specific transport (for
1810 example, <filename>.procmailrc</filename>).
1813 <section id="SECID18">
1814 <title>Delivery in detail</title>
1816 <indexterm role="concept">
1817 <primary>delivery</primary>
1818 <secondary>in detail</secondary>
1820 When a message is to be delivered, the sequence of events is as follows:
1825 If a system-wide filter file is specified, the message is passed to it. The
1826 filter may add recipients to the message, replace the recipients, discard the
1827 message, cause a new message to be generated, or cause the message delivery to
1828 fail. The format of the system filter file is the same as for Exim user filter
1829 files, described in the separate document entitled <emphasis>Exim’s interfaces to mail
1830 filtering</emphasis>.
1831 <indexterm role="concept">
1832 <primary>Sieve filter</primary>
1833 <secondary>not available for system filter</secondary>
1835 (<emphasis role="bold">Note</emphasis>: Sieve cannot be used for system filter files.)
1838 Some additional features are available in system filters – see chapter
1839 <xref linkend="CHAPsystemfilter"/> for details. Note that a message is passed to the system
1840 filter only once per delivery attempt, however many recipients it has. However,
1841 if there are several delivery attempts because one or more addresses could not
1842 be immediately delivered, the system filter is run each time. The filter
1843 condition <option>first_delivery</option> can be used to detect the first run of the system
1849 Each recipient address is offered to each configured router in turn, subject to
1850 its preconditions, until one is able to handle it. If no router can handle the
1851 address, that is, if they all decline, the address is failed. Because routers
1852 can be targeted at particular domains, several locally handled domains can be
1853 processed entirely independently of each other.
1858 <indexterm role="concept">
1859 <primary>routing</primary>
1860 <secondary>loops in</secondary>
1862 <indexterm role="concept">
1863 <primary>loop</primary>
1864 <secondary>while routing</secondary>
1866 A router that accepts an address may assign it to a local or a remote
1867 transport. However, the transport is not run at this time. Instead, the address
1868 is placed on a list for the particular transport, which will be run later.
1869 Alternatively, the router may generate one or more new addresses (typically
1870 from alias, forward, or filter files). New addresses are fed back into this
1871 process from the top, but in order to avoid loops, a router ignores any address
1872 which has an identically-named ancestor that was processed by itself.
1877 When all the routing has been done, addresses that have been successfully
1878 handled are passed to their assigned transports. When local transports are
1879 doing real local deliveries, they handle only one address at a time, but if a
1880 local transport is being used as a pseudo-remote transport (for example, to
1881 collect batched SMTP messages for transmission by some other means) multiple
1882 addresses can be handled. Remote transports can always handle more than one
1883 address at a time, but can be configured not to do so, or to restrict multiple
1884 addresses to the same domain.
1889 Each local delivery to a file or a pipe runs in a separate process under a
1890 non-privileged uid, and these deliveries are run one at a time. Remote
1891 deliveries also run in separate processes, normally under a uid that is private
1892 to Exim (<quote>the Exim user</quote>), but in this case, several remote deliveries can be
1893 run in parallel. The maximum number of simultaneous remote deliveries for any
1894 one message is set by the <option>remote_max_parallel</option> option.
1895 The order in which deliveries are done is not defined, except that all local
1896 deliveries happen before any remote deliveries.
1901 <indexterm role="concept">
1902 <primary>queue runner</primary>
1904 When it encounters a local delivery during a queue run, Exim checks its retry
1905 database to see if there has been a previous temporary delivery failure for the
1906 address before running the local transport. If there was a previous failure,
1907 Exim does not attempt a new delivery until the retry time for the address is
1908 reached. However, this happens only for delivery attempts that are part of a
1909 queue run. Local deliveries are always attempted when delivery immediately
1910 follows message reception, even if retry times are set for them. This makes for
1911 better behaviour if one particular message is causing problems (for example,
1912 causing quota overflow, or provoking an error in a filter file).
1917 <indexterm role="concept">
1918 <primary>delivery</primary>
1919 <secondary>retry in remote transports</secondary>
1921 Remote transports do their own retry handling, since an address may be
1922 deliverable to one of a number of hosts, each of which may have a different
1923 retry time. If there have been previous temporary failures and no host has
1924 reached its retry time, no delivery is attempted, whether in a queue run or
1925 not. See chapter <xref linkend="CHAPretry"/> for details of retry strategies.
1930 If there were any permanent errors, a bounce message is returned to an
1931 appropriate address (the sender in the common case), with details of the error
1932 for each failing address. Exim can be configured to send copies of bounce
1933 messages to other addresses.
1938 <indexterm role="concept">
1939 <primary>delivery</primary>
1940 <secondary>deferral</secondary>
1942 If one or more addresses suffered a temporary failure, the message is left on
1943 the queue, to be tried again later. Delivery of these addresses is said to be
1944 <emphasis>deferred</emphasis>.
1949 When all the recipient addresses have either been delivered or bounced,
1950 handling of the message is complete. The spool files and message log are
1951 deleted, though the message log can optionally be preserved if required.
1956 <section id="SECID19">
1957 <title>Retry mechanism</title>
1959 <indexterm role="concept">
1960 <primary>delivery</primary>
1961 <secondary>retry mechanism</secondary>
1963 <indexterm role="concept">
1964 <primary>retry</primary>
1965 <secondary>description of mechanism</secondary>
1967 <indexterm role="concept">
1968 <primary>queue runner</primary>
1970 Exim’s mechanism for retrying messages that fail to get delivered at the first
1971 attempt is the queue runner process. You must either run an Exim daemon that
1972 uses the <option>-q</option> option with a time interval to start queue runners at regular
1973 intervals, or use some other means (such as <emphasis>cron</emphasis>) to start them. If you do
1974 not arrange for queue runners to be run, messages that fail temporarily at the
1975 first attempt will remain on your queue for ever. A queue runner process works
1976 its way through the queue, one message at a time, trying each delivery that has
1977 passed its retry time.
1978 You can run several queue runners at once.
1981 Exim uses a set of configured rules to determine when next to retry the failing
1982 address (see chapter <xref linkend="CHAPretry"/>). These rules also specify when Exim
1983 should give up trying to deliver to the address, at which point it generates a
1984 bounce message. If no retry rules are set for a particular host, address, and
1985 error combination, no retries are attempted, and temporary errors are treated
1989 <section id="SECID20">
1990 <title>Temporary delivery failure</title>
1992 <indexterm role="concept">
1993 <primary>delivery</primary>
1994 <secondary>temporary failure</secondary>
1996 There are many reasons why a message may not be immediately deliverable to a
1997 particular address. Failure to connect to a remote machine (because it, or the
1998 connection to it, is down) is one of the most common. Temporary failures may be
1999 detected during routing as well as during the transport stage of delivery.
2000 Local deliveries may be delayed if NFS files are unavailable, or if a mailbox
2001 is on a file system where the user is over quota. Exim can be configured to
2002 impose its own quotas on local mailboxes; where system quotas are set they will
2006 If a host is unreachable for a period of time, a number of messages may be
2007 waiting for it by the time it recovers, and sending them in a single SMTP
2008 connection is clearly beneficial. Whenever a delivery to a remote host is
2012 <indexterm role="concept">
2013 <primary>hints database</primary>
2015 Exim makes a note in its hints database, and whenever a successful
2016 SMTP delivery has happened, it looks to see if any other messages are waiting
2017 for the same host. If any are found, they are sent over the same SMTP
2018 connection, subject to a configuration limit as to the maximum number in any
2022 <section id="SECID21">
2023 <title>Permanent delivery failure</title>
2025 <indexterm role="concept">
2026 <primary>delivery</primary>
2027 <secondary>permanent failure</secondary>
2029 <indexterm role="concept">
2030 <primary>bounce message</primary>
2031 <secondary>when generated</secondary>
2033 When a message cannot be delivered to some or all of its intended recipients, a
2034 bounce message is generated. Temporary delivery failures turn into permanent
2035 errors when their timeout expires. All the addresses that fail in a given
2036 delivery attempt are listed in a single message. If the original message has
2037 many recipients, it is possible for some addresses to fail in one delivery
2038 attempt and others to fail subsequently, giving rise to more than one bounce
2039 message. The wording of bounce messages can be customized by the administrator.
2040 See chapter <xref linkend="CHAPemsgcust"/> for details.
2043 <indexterm role="concept">
2044 <primary><emphasis>X-Failed-Recipients:</emphasis> header line</primary>
2046 Bounce messages contain an <emphasis>X-Failed-Recipients:</emphasis> header line that lists the
2047 failed addresses, for the benefit of programs that try to analyse such messages
2051 <indexterm role="concept">
2052 <primary>bounce message</primary>
2053 <secondary>recipient of</secondary>
2055 A bounce message is normally sent to the sender of the original message, as
2056 obtained from the message’s envelope. For incoming SMTP messages, this is the
2057 address given in the MAIL command. However, when an address is expanded via a
2058 forward or alias file, an alternative address can be specified for delivery
2059 failures of the generated addresses. For a mailing list expansion (see section
2060 <xref linkend="SECTmailinglists"/>) it is common to direct bounce messages to the manager
2064 <section id="SECID22">
2065 <title>Failures to deliver bounce messages</title>
2067 <indexterm role="concept">
2068 <primary>bounce message</primary>
2069 <secondary>failure to deliver</secondary>
2071 If a bounce message (either locally generated or received from a remote host)
2072 itself suffers a permanent delivery failure, the message is left on the queue,
2073 but it is frozen, awaiting the attention of an administrator. There are options
2074 that can be used to make Exim discard such failed messages, or to keep them
2075 for only a short time (see <option>timeout_frozen_after</option> and
2076 <option>ignore_bounce_errors_after</option>).
2081 <chapter id="CHID3">
2082 <title>Building and installing Exim</title>
2084 <indexterm role="concept" id="IIDbuex" class="startofrange">
2085 <primary>building Exim</primary>
2088 <section id="SECID23">
2089 <title>Unpacking</title>
2091 Exim is distributed as a gzipped or bzipped tar file which, when unpacked,
2092 creates a directory with the name of the current release (for example,
2093 <filename>exim-4.72</filename>) into which the following files are placed:
2095 <informaltable frame="none">
2096 <tgroup cols="2" colsep="0" rowsep="0">
2097 <colspec colwidth="140pt" align="left"/>
2098 <colspec colwidth="254pt" align="left"/>
2101 <entry> <filename>ACKNOWLEDGMENTS</filename></entry>
2102 <entry>contains some acknowledgments</entry>
2105 <entry> <filename>CHANGES</filename></entry>
2106 <entry>contains a reference to where changes are documented</entry>
2109 <entry> <filename>LICENCE</filename></entry>
2110 <entry>the GNU General Public Licence</entry>
2113 <entry> <filename>Makefile</filename></entry>
2114 <entry>top-level make file</entry>
2117 <entry> <filename>NOTICE</filename></entry>
2118 <entry>conditions for the use of Exim</entry>
2121 <entry> <filename>README</filename></entry>
2122 <entry>list of files, directories and simple build instructions</entry>
2128 Other files whose names begin with <filename>README</filename> may also be present. The
2129 following subdirectories are created:
2131 <informaltable frame="none">
2132 <tgroup cols="2" colsep="0" rowsep="0">
2133 <colspec colwidth="140pt" align="left"/>
2134 <colspec colwidth="254pt" align="left"/>
2137 <entry> <filename>Local</filename></entry>
2138 <entry>an empty directory for local configuration files</entry>
2141 <entry> <filename>OS</filename></entry>
2142 <entry>OS-specific files</entry>
2145 <entry> <filename>doc</filename></entry>
2146 <entry>documentation files</entry>
2149 <entry> <filename>exim_monitor</filename></entry>
2150 <entry>source files for the Exim monitor</entry>
2153 <entry> <filename>scripts</filename></entry>
2154 <entry>scripts used in the build process</entry>
2157 <entry> <filename>src</filename></entry>
2158 <entry>remaining source files</entry>
2161 <entry> <filename>util</filename></entry>
2162 <entry>independent utilities</entry>
2168 The main utility programs are contained in the <filename>src</filename> directory, and are built
2169 with the Exim binary. The <filename>util</filename> directory contains a few optional scripts
2170 that may be useful to some sites.
2173 <section id="SECID24">
2174 <title>Multiple machine architectures and operating systems</title>
2176 <indexterm role="concept">
2177 <primary>building Exim</primary>
2178 <secondary>multiple OS/architectures</secondary>
2180 The building process for Exim is arranged to make it easy to build binaries for
2181 a number of different architectures and operating systems from the same set of
2182 source files. Compilation does not take place in the <filename>src</filename> directory.
2183 Instead, a <emphasis>build directory</emphasis> is created for each architecture and operating
2185 <indexterm role="concept">
2186 <primary>symbolic link</primary>
2187 <secondary>to build directory</secondary>
2189 Symbolic links to the sources are installed in this directory, which is where
2190 the actual building takes place. In most cases, Exim can discover the machine
2191 architecture and operating system for itself, but the defaults can be
2192 overridden if necessary.
2195 <section id="SECTpcre">
2196 <title>PCRE library</title>
2198 <indexterm role="concept">
2199 <primary>PCRE library</primary>
2201 Exim no longer has an embedded PCRE library as the vast majority of
2202 modern systems include PCRE as a system library, although you may need
2203 to install the PCRE or PCRE development package for your operating
2204 system. If your system has a normal PCRE installation the Exim build
2205 process will need no further configuration. If the library or the
2206 headers are in an unusual location you will need to set the PCRE_LIBS
2207 and INCLUDE directives appropriately. If your operating system has no
2208 PCRE support then you will need to obtain and build the current PCRE
2209 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>.
2212 <section id="SECTdb">
2213 <title>DBM libraries</title>
2215 <indexterm role="concept">
2216 <primary>DBM libraries</primary>
2217 <secondary>discussion of</secondary>
2219 <indexterm role="concept">
2220 <primary>hints database</primary>
2221 <secondary>DBM files used for</secondary>
2223 Even if you do not use any DBM files in your configuration, Exim still needs a
2224 DBM library in order to operate, because it uses indexed files for its hints
2225 databases. Unfortunately, there are a number of DBM libraries in existence, and
2226 different operating systems often have different ones installed.
2229 <indexterm role="concept">
2230 <primary>Solaris</primary>
2231 <secondary>DBM library for</secondary>
2233 <indexterm role="concept">
2234 <primary>IRIX, DBM library for</primary>
2236 <indexterm role="concept">
2237 <primary>BSD, DBM library for</primary>
2239 <indexterm role="concept">
2240 <primary>Linux, DBM library for</primary>
2242 If you are using Solaris, IRIX, one of the modern BSD systems, or a modern
2243 Linux distribution, the DBM configuration should happen automatically, and you
2244 may be able to ignore this section. Otherwise, you may have to learn more than
2245 you would like about DBM libraries from what follows.
2248 <indexterm role="concept">
2249 <primary><emphasis>ndbm</emphasis> DBM library</primary>
2251 Licensed versions of Unix normally contain a library of DBM functions operating
2252 via the <emphasis>ndbm</emphasis> interface, and this is what Exim expects by default. Free
2253 versions of Unix seem to vary in what they contain as standard. In particular,
2254 some early versions of Linux have no default DBM library, and different
2255 distributors have chosen to bundle different libraries with their packaged
2256 versions. However, the more recent releases seem to have standardized on the
2257 Berkeley DB library.
2260 Different DBM libraries have different conventions for naming the files they
2261 use. When a program opens a file called <filename>dbmfile</filename>, there are several
2264 <orderedlist numeration="arabic">
2267 A traditional <emphasis>ndbm</emphasis> implementation, such as that supplied as part of
2268 Solaris, operates on two files called <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>.
2273 <indexterm role="concept">
2274 <primary><emphasis>gdbm</emphasis> DBM library</primary>
2276 The GNU library, <emphasis>gdbm</emphasis>, operates on a single file. If used via its <emphasis>ndbm</emphasis>
2277 compatibility interface it makes two different hard links to it with names
2278 <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>, but if used via its native interface, the
2279 file name is used unmodified.
2284 <indexterm role="concept">
2285 <primary>Berkeley DB library</primary>
2287 The Berkeley DB package, if called via its <emphasis>ndbm</emphasis> compatibility interface,
2288 operates on a single file called <filename>dbmfile.db</filename>, but otherwise looks to the
2289 programmer exactly the same as the traditional <emphasis>ndbm</emphasis> implementation.
2294 If the Berkeley package is used in its native mode, it operates on a single
2295 file called <filename>dbmfile</filename>; the programmer’s interface is somewhat different to
2296 the traditional <emphasis>ndbm</emphasis> interface.
2301 To complicate things further, there are several very different versions of the
2302 Berkeley DB package. Version 1.85 was stable for a very long time, releases
2303 2.<emphasis>x</emphasis> and 3.<emphasis>x</emphasis> were current for a while, but the latest versions are now
2304 numbered 4.<emphasis>x</emphasis>. Maintenance of some of the earlier releases has ceased. All
2305 versions of Berkeley DB can be obtained from
2306 <emphasis role="bold"><ulink url="http://www.sleepycat.com/">http://www.sleepycat.com/</ulink></emphasis>.
2311 <indexterm role="concept">
2312 <primary><emphasis>tdb</emphasis> DBM library</primary>
2314 Yet another DBM library, called <emphasis>tdb</emphasis>, is available from
2315 <emphasis role="bold"><ulink url="http://download.sourceforge.net/tdb">http://download.sourceforge.net/tdb</ulink></emphasis>. It has its own interface, and also
2316 operates on a single file.
2321 <indexterm role="concept">
2322 <primary>USE_DB</primary>
2324 <indexterm role="concept">
2325 <primary>DBM libraries</primary>
2326 <secondary>configuration for building</secondary>
2328 Exim and its utilities can be compiled to use any of these interfaces. In order
2329 to use any version of the Berkeley DB package in native mode, you must set
2330 USE_DB in an appropriate configuration file (typically
2331 <filename>Local/Makefile</filename>). For example:
2333 <literallayout class="monospaced">
2337 Similarly, for gdbm you set USE_GDBM, and for tdb you set USE_TDB. An
2338 error is diagnosed if you set more than one of these.
2341 At the lowest level, the build-time configuration sets none of these options,
2342 thereby assuming an interface of type (1). However, some operating system
2343 configuration files (for example, those for the BSD operating systems and
2344 Linux) assume type (4) by setting USE_DB as their default, and the
2345 configuration files for Cygwin set USE_GDBM. Anything you set in
2346 <filename>Local/Makefile</filename>, however, overrides these system defaults.
2349 As well as setting USE_DB, USE_GDBM, or USE_TDB, it may also be
2350 necessary to set DBMLIB, to cause inclusion of the appropriate library, as
2351 in one of these lines:
2353 <literallayout class="monospaced">
2358 Settings like that will work if the DBM library is installed in the standard
2359 place. Sometimes it is not, and the library’s header file may also not be in
2360 the default path. You may need to set INCLUDE to specify where the header
2361 file is, and to specify the path to the library more fully in DBMLIB, as in
2364 <literallayout class="monospaced">
2365 INCLUDE=-I/usr/local/include/db-4.1
2366 DBMLIB=/usr/local/lib/db-4.1/libdb.a
2369 There is further detailed discussion about the various DBM libraries in the
2370 file <filename>doc/dbm.discuss.txt</filename> in the Exim distribution.
2373 <section id="SECID25">
2374 <title>Pre-building configuration</title>
2376 <indexterm role="concept">
2377 <primary>building Exim</primary>
2378 <secondary>pre-building configuration</secondary>
2380 <indexterm role="concept">
2381 <primary>configuration for building Exim</primary>
2383 <indexterm role="concept">
2384 <primary><filename>Local/Makefile</filename></primary>
2386 <indexterm role="concept">
2387 <primary><filename>src/EDITME</filename></primary>
2389 Before building Exim, a local configuration file that specifies options
2390 independent of any operating system has to be created with the name
2391 <filename>Local/Makefile</filename>. A template for this file is supplied as the file
2392 <filename>src/EDITME</filename>, and it contains full descriptions of all the option settings
2393 therein. These descriptions are therefore not repeated here. If you are
2394 building Exim for the first time, the simplest thing to do is to copy
2395 <filename>src/EDITME</filename> to <filename>Local/Makefile</filename>, then read it and edit it appropriately.
2398 There are three settings that you must supply, because Exim will not build
2399 without them. They are the location of the run time configuration file
2400 (CONFIGURE_FILE), the directory in which Exim binaries will be installed
2401 (BIN_DIRECTORY), and the identity of the Exim user (EXIM_USER and
2402 maybe EXIM_GROUP as well). The value of CONFIGURE_FILE can in fact be
2403 a colon-separated list of file names; Exim uses the first of them that exists.
2406 There are a few other parameters that can be specified either at build time or
2407 at run time, to enable the same binary to be used on a number of different
2408 machines. However, if the locations of Exim’s spool directory and log file
2409 directory (if not within the spool directory) are fixed, it is recommended that
2410 you specify them in <filename>Local/Makefile</filename> instead of at run time, so that errors
2411 detected early in Exim’s execution (such as a malformed configuration file) can
2415 <indexterm role="concept">
2416 <primary>content scanning</primary>
2417 <secondary>specifying at build time</secondary>
2419 Exim’s interfaces for calling virus and spam scanning software directly from
2420 access control lists are not compiled by default. If you want to include these
2421 facilities, you need to set
2423 <literallayout class="monospaced">
2424 WITH_CONTENT_SCAN=yes
2427 in your <filename>Local/Makefile</filename>. For details of the facilities themselves, see
2428 chapter <xref linkend="CHAPexiscan"/>.
2431 <indexterm role="concept">
2432 <primary><filename>Local/eximon.conf</filename></primary>
2434 <indexterm role="concept">
2435 <primary><filename>exim_monitor/EDITME</filename></primary>
2437 If you are going to build the Exim monitor, a similar configuration process is
2438 required. The file <filename>exim_monitor/EDITME</filename> must be edited appropriately for
2439 your installation and saved under the name <filename>Local/eximon.conf</filename>. If you are
2440 happy with the default settings described in <filename>exim_monitor/EDITME</filename>,
2441 <filename>Local/eximon.conf</filename> can be empty, but it must exist.
2444 This is all the configuration that is needed in straightforward cases for known
2445 operating systems. However, the building process is set up so that it is easy
2446 to override options that are set by default or by operating-system-specific
2447 configuration files, for example to change the name of the C compiler, which
2448 defaults to <option>gcc</option>. See section <xref linkend="SECToverride"/> below for details of how to
2452 <section id="SECID26">
2453 <title>Support for iconv()</title>
2455 <indexterm role="concept">
2456 <primary><function>iconv()</function> support</primary>
2458 <indexterm role="concept">
2459 <primary>RFC 2047</primary>
2461 The contents of header lines in messages may be encoded according to the rules
2462 described RFC 2047. This makes it possible to transmit characters that are not
2463 in the ASCII character set, and to label them as being in a particular
2464 character set. When Exim is inspecting header lines by means of the <option>$h_</option>
2465 mechanism, it decodes them, and translates them into a specified character set
2466 (default ISO-8859-1). The translation is possible only if the operating system
2467 supports the <function>iconv()</function> function.
2470 However, some of the operating systems that supply <function>iconv()</function> do not support
2471 very many conversions. The GNU <option>libiconv</option> library (available from
2472 <emphasis role="bold"><ulink url="http://www.gnu.org/software/libiconv/">http://www.gnu.org/software/libiconv/</ulink></emphasis>) can be installed on such
2473 systems to remedy this deficiency, as well as on systems that do not supply
2474 <function>iconv()</function> at all. After installing <option>libiconv</option>, you should add
2476 <literallayout class="monospaced">
2480 to your <filename>Local/Makefile</filename> and rebuild Exim.
2483 <section id="SECTinctlsssl">
2484 <title>Including TLS/SSL encryption support</title>
2486 <indexterm role="concept">
2487 <primary>TLS</primary>
2488 <secondary>including support for TLS</secondary>
2490 <indexterm role="concept">
2491 <primary>encryption</primary>
2492 <secondary>including support for</secondary>
2494 <indexterm role="concept">
2495 <primary>SUPPORT_TLS</primary>
2497 <indexterm role="concept">
2498 <primary>OpenSSL</primary>
2499 <secondary>building Exim with</secondary>
2501 <indexterm role="concept">
2502 <primary>GnuTLS</primary>
2503 <secondary>building Exim with</secondary>
2505 Exim can be built to support encrypted SMTP connections, using the STARTTLS
2506 command as per RFC 2487. It can also support legacy clients that expect to
2507 start a TLS session immediately on connection to a non-standard port (see the
2508 <option>tls_on_connect_ports</option> runtime option and the <option>-tls-on-connect</option> command
2512 If you want to build Exim with TLS support, you must first install either the
2513 OpenSSL or GnuTLS library. There is no cryptographic code in Exim itself for
2517 If OpenSSL is installed, you should set
2519 <literallayout class="monospaced">
2521 TLS_LIBS=-lssl -lcrypto
2524 in <filename>Local/Makefile</filename>. You may also need to specify the locations of the
2525 OpenSSL library and include files. For example:
2527 <literallayout class="monospaced">
2529 TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto
2530 TLS_INCLUDE=-I/usr/local/openssl/include/
2533 <indexterm role="concept">
2534 <primary>USE_GNUTLS</primary>
2536 If GnuTLS is installed, you should set
2538 <literallayout class="monospaced">
2541 TLS_LIBS=-lgnutls -ltasn1 -lgcrypt
2544 in <filename>Local/Makefile</filename>, and again you may need to specify the locations of the
2545 library and include files. For example:
2547 <literallayout class="monospaced">
2550 TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt
2551 TLS_INCLUDE=-I/usr/gnu/include
2554 You do not need to set TLS_INCLUDE if the relevant directory is already
2555 specified in INCLUDE. Details of how to configure Exim to make use of TLS are
2556 given in chapter <xref linkend="CHAPTLS"/>.
2559 <section id="SECID27">
2560 <title>Use of tcpwrappers</title>
2562 <indexterm role="concept">
2563 <primary>tcpwrappers, building Exim to support</primary>
2565 <indexterm role="concept">
2566 <primary>USE_TCP_WRAPPERS</primary>
2568 <indexterm role="concept">
2569 <primary>TCP_WRAPPERS_DAEMON_NAME</primary>
2571 <indexterm role="concept">
2572 <primary>tcp_wrappers_daemon_name</primary>
2574 Exim can be linked with the <emphasis>tcpwrappers</emphasis> library in order to check incoming
2575 SMTP calls using the <emphasis>tcpwrappers</emphasis> control files. This may be a convenient
2576 alternative to Exim’s own checking facilities for installations that are
2577 already making use of <emphasis>tcpwrappers</emphasis> for other purposes. To do this, you
2578 should set USE_TCP_WRAPPERS in <filename>Local/Makefile</filename>, arrange for the file
2579 <filename>tcpd.h</filename> to be available at compile time, and also ensure that the library
2580 <filename>libwrap.a</filename> is available at link time, typically by including <option>-lwrap</option> in
2581 EXTRALIBS_EXIM. For example, if <emphasis>tcpwrappers</emphasis> is installed in <filename>/usr/local</filename>,
2584 <literallayout class="monospaced">
2585 USE_TCP_WRAPPERS=yes
2586 CFLAGS=-O -I/usr/local/include
2587 EXTRALIBS_EXIM=-L/usr/local/lib -lwrap
2590 in <filename>Local/Makefile</filename>. The daemon name to use in the <emphasis>tcpwrappers</emphasis> control
2591 files is <quote>exim</quote>. For example, the line
2593 <literallayout class="monospaced">
2594 exim : LOCAL 192.168.1. .friendly.domain.example
2597 in your <filename>/etc/hosts.allow</filename> file allows connections from the local host, from
2598 the subnet 192.168.1.0/24, and from all hosts in <emphasis>friendly.domain.example</emphasis>.
2599 All other connections are denied. The daemon name used by <emphasis>tcpwrappers</emphasis>
2600 can be changed at build time by setting TCP_WRAPPERS_DAEMON_NAME in
2601 in <filename>Local/Makefile</filename>, or by setting tcp_wrappers_daemon_name in the
2602 configure file. Consult the <emphasis>tcpwrappers</emphasis> documentation for
2606 <section id="SECID28">
2607 <title>Including support for IPv6</title>
2609 <indexterm role="concept">
2610 <primary>IPv6</primary>
2611 <secondary>including support for</secondary>
2613 Exim contains code for use on systems that have IPv6 support. Setting
2614 <literal>HAVE_IPV6=YES</literal> in <filename>Local/Makefile</filename> causes the IPv6 code to be included;
2615 it may also be necessary to set IPV6_INCLUDE and IPV6_LIBS on systems
2616 where the IPv6 support is not fully integrated into the normal include and
2620 Two different types of DNS record for handling IPv6 addresses have been
2621 defined. AAAA records (analogous to A records for IPv4) are in use, and are
2622 currently seen as the mainstream. Another record type called A6 was proposed
2623 as better than AAAA because it had more flexibility. However, it was felt to be
2624 over-complex, and its status was reduced to <quote>experimental</quote>. It is not known
2625 if anyone is actually using A6 records. Exim has support for A6 records, but
2626 this is included only if you set <literal>SUPPORT_A6=YES</literal> in <filename>Local/Makefile</filename>. The
2627 support has not been tested for some time.
2630 <section id="SECID29">
2631 <title>The building process</title>
2633 <indexterm role="concept">
2634 <primary>build directory</primary>
2636 Once <filename>Local/Makefile</filename> (and <filename>Local/eximon.conf</filename>, if required) have been
2637 created, run <emphasis>make</emphasis> at the top level. It determines the architecture and
2638 operating system types, and creates a build directory if one does not exist.
2639 For example, on a Sun system running Solaris 8, the directory
2640 <filename>build-SunOS5-5.8-sparc</filename> is created.
2641 <indexterm role="concept">
2642 <primary>symbolic link</primary>
2643 <secondary>to source files</secondary>
2645 Symbolic links to relevant source files are installed in the build directory.
2648 <emphasis role="bold">Warning</emphasis>: The <option>-j</option> (parallel) flag must not be used with <emphasis>make</emphasis>; the
2649 building process fails if it is set.
2652 If this is the first time <emphasis>make</emphasis> has been run, it calls a script that builds
2653 a make file inside the build directory, using the configuration files from the
2654 <filename>Local</filename> directory. The new make file is then passed to another instance of
2655 <emphasis>make</emphasis>. This does the real work, building a number of utility scripts, and
2656 then compiling and linking the binaries for the Exim monitor (if configured), a
2657 number of utility programs, and finally Exim itself. The command <literal>make
2658 makefile</literal> can be used to force a rebuild of the make file in the build
2659 directory, should this ever be necessary.
2662 If you have problems building Exim, check for any comments there may be in the
2663 <filename>README</filename> file concerning your operating system, and also take a look at the
2664 FAQ, where some common problems are covered.
2667 <section id="SECID283">
2668 <title>Output from <quote>make</quote></title>
2670 The output produced by the <emphasis>make</emphasis> process for compile lines is often very
2671 unreadable, because these lines can be very long. For this reason, the normal
2672 output is suppressed by default, and instead output similar to that which
2673 appears when compiling the 2.6 Linux kernel is generated: just a short line for
2674 each module that is being compiled or linked. However, it is still possible to
2675 get the full output, by calling <emphasis>make</emphasis> like this:
2677 <literallayout class="monospaced">
2681 The value of FULLECHO defaults to <quote>@</quote>, the flag character that suppresses
2682 command reflection in <emphasis>make</emphasis>. When you ask for the full output, it is
2683 given in addition to the short output.
2686 <section id="SECToverride">
2687 <title>Overriding build-time options for Exim</title>
2689 <indexterm role="concept">
2690 <primary>build-time options, overriding</primary>
2692 The main make file that is created at the beginning of the building process
2693 consists of the concatenation of a number of files which set configuration
2694 values, followed by a fixed set of <emphasis>make</emphasis> instructions. If a value is set
2695 more than once, the last setting overrides any previous ones. This provides a
2696 convenient way of overriding defaults. The files that are concatenated are, in
2700 <filename>OS/Makefile-Default</filename>
2701 <filename>OS/Makefile-</filename><<emphasis>ostype</emphasis>>
2702 <filename>Local/Makefile</filename>
2703 <filename>Local/Makefile-</filename><<emphasis>ostype</emphasis>>
2704 <filename>Local/Makefile-</filename><<emphasis>archtype</emphasis>>
2705 <filename>Local/Makefile-</filename><<emphasis>ostype</emphasis>>-<<emphasis>archtype</emphasis>>
2706 <filename>OS/Makefile-Base</filename>
2709 <indexterm role="concept">
2710 <primary><filename>Local/Makefile</filename></primary>
2712 <indexterm role="concept">
2713 <primary>building Exim</primary>
2714 <secondary>operating system type</secondary>
2716 <indexterm role="concept">
2717 <primary>building Exim</primary>
2718 <secondary>architecture type</secondary>
2720 where <<emphasis>ostype</emphasis>> is the operating system type and <<emphasis>archtype</emphasis>> is the
2721 architecture type. <filename>Local/Makefile</filename> is required to exist, and the building
2722 process fails if it is absent. The other three <filename>Local</filename> files are optional,
2723 and are often not needed.
2726 The values used for <<emphasis>ostype</emphasis>> and <<emphasis>archtype</emphasis>> are obtained from scripts
2727 called <filename>scripts/os-type</filename> and <filename>scripts/arch-type</filename> respectively. If either of
2728 the environment variables EXIM_OSTYPE or EXIM_ARCHTYPE is set, their
2729 values are used, thereby providing a means of forcing particular settings.
2730 Otherwise, the scripts try to get values from the <option>uname</option> command. If this
2731 fails, the shell variables OSTYPE and ARCHTYPE are inspected. A number
2732 of <emphasis>ad hoc</emphasis> transformations are then applied, to produce the standard names
2733 that Exim expects. You can run these scripts directly from the shell in order
2734 to find out what values are being used on your system.
2737 <filename>OS/Makefile-Default</filename> contains comments about the variables that are set
2738 therein. Some (but not all) are mentioned below. If there is something that
2739 needs changing, review the contents of this file and the contents of the make
2740 file for your operating system (<filename>OS/Makefile-<ostype></filename>) to see what the
2744 <indexterm role="concept">
2745 <primary>building Exim</primary>
2746 <secondary>overriding default settings</secondary>
2748 If you need to change any of the values that are set in <filename>OS/Makefile-Default</filename>
2749 or in <filename>OS/Makefile-<ostype></filename>, or to add any new definitions, you do not
2750 need to change the original files. Instead, you should make the changes by
2751 putting the new values in an appropriate <filename>Local</filename> file. For example,
2752 <indexterm role="concept">
2753 <primary>Tru64-Unix build-time settings</primary>
2755 when building Exim in many releases of the Tru64-Unix (formerly Digital UNIX,
2756 formerly DEC-OSF1) operating system, it is necessary to specify that the C
2757 compiler is called <emphasis>cc</emphasis> rather than <emphasis>gcc</emphasis>. Also, the compiler must be
2758 called with the option <option>-std1</option>, to make it recognize some of the features of
2759 Standard C that Exim uses. (Most other compilers recognize Standard C by
2760 default.) To do this, you should create a file called <filename>Local/Makefile-OSF1</filename>
2761 containing the lines
2763 <literallayout class="monospaced">
2768 If you are compiling for just one operating system, it may be easier to put
2769 these lines directly into <filename>Local/Makefile</filename>.
2772 Keeping all your local configuration settings separate from the distributed
2773 files makes it easy to transfer them to new versions of Exim simply by copying
2774 the contents of the <filename>Local</filename> directory.
2777 <indexterm role="concept">
2778 <primary>NIS lookup type</primary>
2779 <secondary>including support for</secondary>
2781 <indexterm role="concept">
2782 <primary>NIS+ lookup type</primary>
2783 <secondary>including support for</secondary>
2785 <indexterm role="concept">
2786 <primary>LDAP</primary>
2787 <secondary>including support for</secondary>
2789 <indexterm role="concept">
2790 <primary>lookup</primary>
2791 <secondary>inclusion in binary</secondary>
2793 Exim contains support for doing LDAP, NIS, NIS+, and other kinds of file
2794 lookup, but not all systems have these components installed, so the default is
2795 not to include the relevant code in the binary. All the different kinds of file
2796 and database lookup that Exim supports are implemented as separate code modules
2797 which are included only if the relevant compile-time options are set. In the
2798 case of LDAP, NIS, and NIS+, the settings for <filename>Local/Makefile</filename> are:
2800 <literallayout class="monospaced">
2806 and similar settings apply to the other lookup types. They are all listed in
2807 <filename>src/EDITME</filename>. In many cases the relevant include files and interface
2808 libraries need to be installed before compiling Exim.
2809 <indexterm role="concept">
2810 <primary>cdb</primary>
2811 <secondary>including support for</secondary>
2813 However, there are some optional lookup types (such as cdb) for which
2814 the code is entirely contained within Exim, and no external include
2815 files or libraries are required. When a lookup type is not included in the
2816 binary, attempts to configure Exim to use it cause run time configuration
2820 <indexterm role="concept">
2821 <primary>Perl</primary>
2822 <secondary>including support for</secondary>
2824 Exim can be linked with an embedded Perl interpreter, allowing Perl
2825 subroutines to be called during string expansion. To enable this facility,
2827 <literallayout class="monospaced">
2831 must be defined in <filename>Local/Makefile</filename>. Details of this facility are given in
2832 chapter <xref linkend="CHAPperl"/>.
2835 <indexterm role="concept">
2836 <primary>X11 libraries, location of</primary>
2838 The location of the X11 libraries is something that varies a lot between
2839 operating systems, and there may be different versions of X11 to cope
2840 with. Exim itself makes no use of X11, but if you are compiling the Exim
2841 monitor, the X11 libraries must be available.
2842 The following three variables are set in <filename>OS/Makefile-Default</filename>:
2844 <literallayout class="monospaced">
2846 XINCLUDE=-I$(X11)/include
2847 XLFLAGS=-L$(X11)/lib
2850 These are overridden in some of the operating-system configuration files. For
2851 example, in <filename>OS/Makefile-SunOS5</filename> there is
2853 <literallayout class="monospaced">
2855 XINCLUDE=-I$(X11)/include
2856 XLFLAGS=-L$(X11)/lib -R$(X11)/lib
2859 If you need to override the default setting for your operating system, place a
2860 definition of all three of these variables into your
2861 <filename>Local/Makefile-<ostype></filename> file.
2864 <indexterm role="concept">
2865 <primary>EXTRALIBS</primary>
2867 If you need to add any extra libraries to the link steps, these can be put in a
2868 variable called EXTRALIBS, which appears in all the link commands, but by
2869 default is not defined. In contrast, EXTRALIBS_EXIM is used only on the
2870 command for linking the main Exim binary, and not for any associated utilities.
2873 <indexterm role="concept">
2874 <primary>DBM libraries</primary>
2875 <secondary>configuration for building</secondary>
2877 There is also DBMLIB, which appears in the link commands for binaries that
2878 use DBM functions (see also section <xref linkend="SECTdb"/>). Finally, there is
2879 EXTRALIBS_EXIMON, which appears only in the link step for the Exim monitor
2880 binary, and which can be used, for example, to include additional X11
2884 <indexterm role="concept">
2885 <primary>configuration file</primary>
2886 <secondary>editing</secondary>
2888 The make file copes with rebuilding Exim correctly if any of the configuration
2889 files are edited. However, if an optional configuration file is deleted, it is
2890 necessary to touch the associated non-optional file (that is,
2891 <filename>Local/Makefile</filename> or <filename>Local/eximon.conf</filename>) before rebuilding.
2894 <section id="SECID30">
2895 <title>OS-specific header files</title>
2897 <indexterm role="concept">
2898 <primary><filename>os.h</filename></primary>
2900 <indexterm role="concept">
2901 <primary>building Exim</primary>
2902 <secondary>OS-specific C header files</secondary>
2904 The <filename>OS</filename> directory contains a number of files with names of the form
2905 <filename>os.h-<ostype></filename>. These are system-specific C header files that should not
2906 normally need to be changed. There is a list of macro settings that are
2907 recognized in the file <filename>OS/os.configuring</filename>, which should be consulted if you
2908 are porting Exim to a new operating system.
2911 <section id="SECID31">
2912 <title>Overriding build-time options for the monitor</title>
2914 <indexterm role="concept">
2915 <primary>building Eximon</primary>
2917 A similar process is used for overriding things when building the Exim monitor,
2918 where the files that are involved are
2921 <filename>OS/eximon.conf-Default</filename>
2922 <filename>OS/eximon.conf-</filename><<emphasis>ostype</emphasis>>
2923 <filename>Local/eximon.conf</filename>
2924 <filename>Local/eximon.conf-</filename><<emphasis>ostype</emphasis>>
2925 <filename>Local/eximon.conf-</filename><<emphasis>archtype</emphasis>>
2926 <filename>Local/eximon.conf-</filename><<emphasis>ostype</emphasis>>-<<emphasis>archtype</emphasis>>
2929 <indexterm role="concept">
2930 <primary><filename>Local/eximon.conf</filename></primary>
2932 As with Exim itself, the final three files need not exist, and in this case the
2933 <filename>OS/eximon.conf-<ostype></filename> file is also optional. The default values in
2934 <filename>OS/eximon.conf-Default</filename> can be overridden dynamically by setting environment
2935 variables of the same name, preceded by EXIMON_. For example, setting
2936 EXIMON_LOG_DEPTH in the environment overrides the value of
2937 LOG_DEPTH at run time.
2938 <indexterm role="concept" startref="IIDbuex" class="endofrange"/>
2941 <section id="SECID32">
2942 <title>Installing Exim binaries and scripts</title>
2944 <indexterm role="concept">
2945 <primary>installing Exim</primary>
2947 <indexterm role="concept">
2948 <primary>BIN_DIRECTORY</primary>
2950 The command <literal>make install</literal> runs the <command>exim_install</command> script with no
2951 arguments. The script copies binaries and utility scripts into the directory
2952 whose name is specified by the BIN_DIRECTORY setting in <filename>Local/Makefile</filename>.
2953 <indexterm role="concept">
2954 <primary>setuid</primary>
2955 <secondary>installing Exim with</secondary>
2957 The install script copies files only if they are newer than the files they are
2958 going to replace. The Exim binary is required to be owned by root and have the
2959 <emphasis>setuid</emphasis> bit set, for normal configurations. Therefore, you must run <literal>make
2960 install</literal> as root so that it can set up the Exim binary in this way. However, in
2961 some special situations (for example, if a host is doing no local deliveries)
2962 it may be possible to run Exim without making the binary setuid root (see
2963 chapter <xref linkend="CHAPsecurity"/> for details).
2966 <indexterm role="concept">
2967 <primary>CONFIGURE_FILE</primary>
2969 Exim’s run time configuration file is named by the CONFIGURE_FILE setting
2970 in <filename>Local/Makefile</filename>. If this names a single file, and the file does not
2971 exist, the default configuration file <filename>src/configure.default</filename> is copied there
2972 by the installation script. If a run time configuration file already exists, it
2973 is left alone. If CONFIGURE_FILE is a colon-separated list, naming several
2974 alternative files, no default is installed.
2977 <indexterm role="concept">
2978 <primary>system aliases file</primary>
2980 <indexterm role="concept">
2981 <primary><filename>/etc/aliases</filename></primary>
2983 One change is made to the default configuration file when it is installed: the
2984 default configuration contains a router that references a system aliases file.
2985 The path to this file is set to the value specified by
2986 SYSTEM_ALIASES_FILE in <filename>Local/Makefile</filename> (<filename>/etc/aliases</filename> by default).
2987 If the system aliases file does not exist, the installation script creates it,
2988 and outputs a comment to the user.
2991 The created file contains no aliases, but it does contain comments about the
2992 aliases a site should normally have. Mail aliases have traditionally been
2993 kept in <filename>/etc/aliases</filename>. However, some operating systems are now using
2994 <filename>/etc/mail/aliases</filename>. You should check if yours is one of these, and change
2995 Exim’s configuration if necessary.
2998 The default configuration uses the local host’s name as the only local domain,
2999 and is set up to do local deliveries into the shared directory <filename>/var/mail</filename>,
3000 running as the local user. System aliases and <filename>.forward</filename> files in users’ home
3001 directories are supported, but no NIS or NIS+ support is configured. Domains
3002 other than the name of the local host are routed using the DNS, with delivery
3006 It is possible to install Exim for special purposes (such as building a binary
3007 distribution) in a private part of the file system. You can do this by a
3010 <literallayout class="monospaced">
3011 make DESTDIR=/some/directory/ install
3014 This has the effect of pre-pending the specified directory to all the file
3015 paths, except the name of the system aliases file that appears in the default
3016 configuration. (If a default alias file is created, its name <emphasis>is</emphasis> modified.)
3017 For backwards compatibility, ROOT is used if DESTDIR is not set,
3018 but this usage is deprecated.
3021 <indexterm role="concept">
3022 <primary>installing Exim</primary>
3023 <secondary>what is not installed</secondary>
3025 Running <emphasis>make install</emphasis> does not copy the Exim 4 conversion script
3026 <emphasis>convert4r4</emphasis>. You will probably run this only once if you are
3027 upgrading from Exim 3. None of the documentation files in the <filename>doc</filename>
3028 directory are copied, except for the info files when you have set
3029 INFO_DIRECTORY, as described in section <xref linkend="SECTinsinfdoc"/> below.
3032 For the utility programs, old versions are renamed by adding the suffix <filename>.O</filename>
3033 to their names. The Exim binary itself, however, is handled differently. It is
3034 installed under a name that includes the version number and the compile number,
3035 for example <filename>exim-4.72-1</filename>. The script then arranges for a symbolic link
3036 called <filename>exim</filename> to point to the binary. If you are updating a previous version
3037 of Exim, the script takes care to ensure that the name <filename>exim</filename> is never absent
3038 from the directory (as seen by other processes).
3041 <indexterm role="concept">
3042 <primary>installing Exim</primary>
3043 <secondary>testing the script</secondary>
3045 If you want to see what the <emphasis>make install</emphasis> will do before running it for
3046 real, you can pass the <option>-n</option> option to the installation script by this
3049 <literallayout class="monospaced">
3050 make INSTALL_ARG=-n install
3053 The contents of the variable INSTALL_ARG are passed to the installation
3054 script. You do not need to be root to run this test. Alternatively, you can run
3055 the installation script directly, but this must be from within the build
3056 directory. For example, from the top-level Exim directory you could use this
3059 <literallayout class="monospaced">
3060 (cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n)
3063 <indexterm role="concept">
3064 <primary>installing Exim</primary>
3065 <secondary>install script options</secondary>
3067 There are two other options that can be supplied to the installation script.
3072 <option>-no_chown</option> bypasses the call to change the owner of the installed binary
3073 to root, and the call to make it a setuid binary.
3078 <option>-no_symlink</option> bypasses the setting up of the symbolic link <filename>exim</filename> to the
3084 INSTALL_ARG can be used to pass these options to the script. For example:
3086 <literallayout class="monospaced">
3087 make INSTALL_ARG=-no_symlink install
3090 The installation script can also be given arguments specifying which files are
3091 to be copied. For example, to install just the Exim binary, and nothing else,
3092 without creating the symbolic link, you could use:
3094 <literallayout class="monospaced">
3095 make INSTALL_ARG='-no_symlink exim' install
3098 <section id="SECTinsinfdoc">
3099 <title>Installing info documentation</title>
3101 <indexterm role="concept">
3102 <primary>installing Exim</primary>
3103 <secondary><emphasis>info</emphasis> documentation</secondary>
3105 Not all systems use the GNU <emphasis>info</emphasis> system for documentation, and for this
3106 reason, the Texinfo source of Exim’s documentation is not included in the main
3107 distribution. Instead it is available separately from the ftp site (see section
3108 <xref linkend="SECTavail"/>).
3111 If you have defined INFO_DIRECTORY in <filename>Local/Makefile</filename> and the Texinfo
3112 source of the documentation is found in the source tree, running <literal>make
3113 install</literal> automatically builds the info files and installs them.
3116 <section id="SECID33">
3117 <title>Setting up the spool directory</title>
3119 <indexterm role="concept">
3120 <primary>spool directory</primary>
3121 <secondary>creating</secondary>
3123 When it starts up, Exim tries to create its spool directory if it does not
3124 exist. The Exim uid and gid are used for the owner and group of the spool
3125 directory. Sub-directories are automatically created in the spool directory as
3129 <section id="SECID34">
3130 <title>Testing</title>
3132 <indexterm role="concept">
3133 <primary>testing</primary>
3134 <secondary>installation</secondary>
3136 Having installed Exim, you can check that the run time configuration file is
3137 syntactically valid by running the following command, which assumes that the
3138 Exim binary directory is within your PATH environment variable:
3140 <literallayout class="monospaced">
3144 If there are any errors in the configuration file, Exim outputs error messages.
3145 Otherwise it outputs the version number and build date,
3146 the DBM library that is being used, and information about which drivers and
3147 other optional code modules are included in the binary.
3148 Some simple routing tests can be done by using the address testing option. For
3152 <literal>exim -bt</literal> <<emphasis>local username</emphasis>>
3155 should verify that it recognizes a local mailbox, and
3158 <literal>exim -bt</literal> <<emphasis>remote address</emphasis>>
3161 a remote one. Then try getting it to deliver mail, both locally and remotely.
3162 This can be done by passing messages directly to Exim, without going through a
3163 user agent. For example:
3165 <literallayout class="monospaced">
3166 exim -v postmaster@your.domain.example
3167 From: user@your.domain.example
3168 To: postmaster@your.domain.example
3169 Subject: Testing Exim
3171 This is a test message.
3175 The <option>-v</option> option causes Exim to output some verification of what it is doing.
3176 In this case you should see copies of three log lines, one for the message’s
3177 arrival, one for its delivery, and one containing <quote>Completed</quote>.
3180 <indexterm role="concept">
3181 <primary>delivery</primary>
3182 <secondary>problems with</secondary>
3184 If you encounter problems, look at Exim’s log files (<emphasis>mainlog</emphasis> and
3185 <emphasis>paniclog</emphasis>) to see if there is any relevant information there. Another source
3186 of information is running Exim with debugging turned on, by specifying the
3187 <option>-d</option> option. If a message is stuck on Exim’s spool, you can force a delivery
3188 with debugging turned on by a command of the form
3191 <literal>exim -d -M</literal> <<emphasis>exim-message-id</emphasis>>
3194 You must be root or an <quote>admin user</quote> in order to do this. The <option>-d</option> option
3195 produces rather a lot of output, but you can cut this down to specific areas.
3196 For example, if you use <option>-d-all+route</option> only the debugging information
3197 relevant to routing is included. (See the <option>-d</option> option in chapter
3198 <xref linkend="CHAPcommandline"/> for more details.)
3201 <indexterm role="concept">
3202 <primary><quote>sticky</quote> bit</primary>
3204 <indexterm role="concept">
3205 <primary>lock files</primary>
3207 One specific problem that has shown up on some sites is the inability to do
3208 local deliveries into a shared mailbox directory, because it does not have the
3209 <quote>sticky bit</quote> set on it. By default, Exim tries to create a lock file before
3210 writing to a mailbox file, and if it cannot create the lock file, the delivery
3211 is deferred. You can get round this either by setting the <quote>sticky bit</quote> on the
3212 directory, or by setting a specific group for local deliveries and allowing
3213 that group to create files in the directory (see the comments above the
3214 <command>local_delivery</command> transport in the default configuration file). Another
3215 approach is to configure Exim not to use lock files, but just to rely on
3216 <function>fcntl()</function> locking instead. However, you should do this only if all user
3217 agents also use <function>fcntl()</function> locking. For further discussion of locking issues,
3218 see chapter <xref linkend="CHAPappendfile"/>.
3221 One thing that cannot be tested on a system that is already running an MTA is
3222 the receipt of incoming SMTP mail on the standard SMTP port. However, the
3223 <option>-oX</option> option can be used to run an Exim daemon that listens on some other
3224 port, or <emphasis>inetd</emphasis> can be used to do this. The <option>-bh</option> option and the
3225 <emphasis>exim_checkaccess</emphasis> utility can be used to check out policy controls on
3229 Testing a new version on a system that is already running Exim can most easily
3230 be done by building a binary with a different CONFIGURE_FILE setting. From
3231 within the run time configuration, all other file and directory names
3232 that Exim uses can be altered, in order to keep it entirely clear of the
3236 <section id="SECID35">
3237 <title>Replacing another MTA with Exim</title>
3239 <indexterm role="concept">
3240 <primary>replacing another MTA</primary>
3242 Building and installing Exim for the first time does not of itself put it in
3243 general use. The name by which the system’s MTA is called by mail user agents
3244 is either <filename>/usr/sbin/sendmail</filename>, or <filename>/usr/lib/sendmail</filename> (depending on the
3245 operating system), and it is necessary to make this name point to the <emphasis>exim</emphasis>
3246 binary in order to get the user agents to pass messages to Exim. This is
3247 normally done by renaming any existing file and making <filename>/usr/sbin/sendmail</filename>
3248 or <filename>/usr/lib/sendmail</filename>
3249 <indexterm role="concept">
3250 <primary>symbolic link</primary>
3251 <secondary>to <emphasis>exim</emphasis> binary</secondary>
3253 a symbolic link to the <emphasis>exim</emphasis> binary. It is a good idea to remove any setuid
3254 privilege and executable status from the old MTA. It is then necessary to stop
3255 and restart the mailer daemon, if one is running.
3258 <indexterm role="concept">
3259 <primary>FreeBSD, MTA indirection</primary>
3261 <indexterm role="concept">
3262 <primary><filename>/etc/mail/mailer.conf</filename></primary>
3264 Some operating systems have introduced alternative ways of switching MTAs. For
3265 example, if you are running FreeBSD, you need to edit the file
3266 <filename>/etc/mail/mailer.conf</filename> instead of setting up a symbolic link as just
3267 described. A typical example of the contents of this file for running Exim is
3270 <literallayout class="monospaced">
3271 sendmail /usr/exim/bin/exim
3272 send-mail /usr/exim/bin/exim
3273 mailq /usr/exim/bin/exim -bp
3274 newaliases /usr/bin/true
3277 Once you have set up the symbolic link, or edited <filename>/etc/mail/mailer.conf</filename>,
3278 your Exim installation is <quote>live</quote>. Check it by sending a message from your
3279 favourite user agent.
3282 You should consider what to tell your users about the change of MTA. Exim may
3283 have different capabilities to what was previously running, and there are
3284 various operational differences such as the text of messages produced by
3285 command line options and in bounce messages. If you allow your users to make
3286 use of Exim’s filtering capabilities, you should make the document entitled
3287 <emphasis>Exim’s interface to mail filtering</emphasis> available to them.
3290 <section id="SECID36">
3291 <title>Upgrading Exim</title>
3293 <indexterm role="concept">
3294 <primary>upgrading Exim</primary>
3296 If you are already running Exim on your host, building and installing a new
3297 version automatically makes it available to MUAs, or any other programs that
3298 call the MTA directly. However, if you are running an Exim daemon, you do need
3299 to send it a HUP signal, to make it re-execute itself, and thereby pick up the
3300 new binary. You do not need to stop processing mail in order to install a new
3301 version of Exim. The install script does not modify an existing runtime
3305 <section id="SECID37">
3306 <title>Stopping the Exim daemon on Solaris</title>
3308 <indexterm role="concept">
3309 <primary>Solaris</primary>
3310 <secondary>stopping Exim on</secondary>
3312 The standard command for stopping the mailer daemon on Solaris is
3314 <literallayout class="monospaced">
3315 /etc/init.d/sendmail stop
3318 If <filename>/usr/lib/sendmail</filename> has been turned into a symbolic link, this script
3319 fails to stop Exim because it uses the command <emphasis>ps -e</emphasis> and greps the output
3320 for the text <quote>sendmail</quote>; this is not present because the actual program name
3321 (that is, <quote>exim</quote>) is given by the <emphasis>ps</emphasis> command with these options. A
3322 solution is to replace the line that finds the process id with something like
3324 <literallayout class="monospaced">
3325 pid=`cat /var/spool/exim/exim-daemon.pid`
3328 to obtain the daemon’s pid directly from the file that Exim saves it in.
3331 Note, however, that stopping the daemon does not <quote>stop Exim</quote>. Messages can
3332 still be received from local processes, and if automatic delivery is configured
3333 (the normal case), deliveries will still occur.
3338 <chapter id="CHAPcommandline">
3339 <title>The Exim command line</title>
3341 <indexterm role="concept" id="IIDclo1" class="startofrange">
3342 <primary>command line</primary>
3343 <secondary>options</secondary>
3345 <indexterm role="concept" id="IIDclo2" class="startofrange">
3346 <primary>options</primary>
3347 <secondary>command line</secondary>
3349 Exim’s command line takes the standard Unix form of a sequence of options,
3350 each starting with a hyphen character, followed by a number of arguments. The
3351 options are compatible with the main options of Sendmail, and there are also
3352 some additional options, some of which are compatible with Smail 3. Certain
3353 combinations of options do not make sense, and provoke an error if used.
3354 The form of the arguments depends on which options are set.
3356 <section id="SECID38">
3357 <title>Setting options by program name</title>
3359 <indexterm role="concept">
3360 <primary><emphasis>mailq</emphasis></primary>
3362 If Exim is called under the name <emphasis>mailq</emphasis>, it behaves as if the option <option>-bp</option>
3363 were present before any other options.
3364 The <option>-bp</option> option requests a listing of the contents of the mail queue on the
3366 This feature is for compatibility with some systems that contain a command of
3367 that name in one of the standard libraries, symbolically linked to
3368 <filename>/usr/sbin/sendmail</filename> or <filename>/usr/lib/sendmail</filename>.
3371 <indexterm role="concept">
3372 <primary><emphasis>rsmtp</emphasis></primary>
3374 If Exim is called under the name <emphasis>rsmtp</emphasis> it behaves as if the option <option>-bS</option>
3375 were present before any other options, for compatibility with Smail. The
3376 <option>-bS</option> option is used for reading in a number of messages in batched SMTP
3380 <indexterm role="concept">
3381 <primary><emphasis>rmail</emphasis></primary>
3383 If Exim is called under the name <emphasis>rmail</emphasis> it behaves as if the <option>-i</option> and
3384 <option>-oee</option> options were present before any other options, for compatibility with
3385 Smail. The name <emphasis>rmail</emphasis> is used as an interface by some UUCP systems.
3388 <indexterm role="concept">
3389 <primary><emphasis>runq</emphasis></primary>
3391 <indexterm role="concept">
3392 <primary>queue runner</primary>
3394 If Exim is called under the name <emphasis>runq</emphasis> it behaves as if the option <option>-q</option>
3395 were present before any other options, for compatibility with Smail. The <option>-q</option>
3396 option causes a single queue runner process to be started.
3399 <indexterm role="concept">
3400 <primary><emphasis>newaliases</emphasis></primary>
3402 <indexterm role="concept">
3403 <primary>alias file</primary>
3404 <secondary>building</secondary>
3406 <indexterm role="concept">
3407 <primary>Sendmail compatibility</primary>
3408 <secondary>calling Exim as <emphasis>newaliases</emphasis></secondary>
3410 If Exim is called under the name <emphasis>newaliases</emphasis> it behaves as if the option
3411 <option>-bi</option> were present before any other options, for compatibility with Sendmail.
3412 This option is used for rebuilding Sendmail’s alias file. Exim does not have
3413 the concept of a single alias file, but can be configured to run a given
3414 command if called with the <option>-bi</option> option.
3417 <section id="SECTtrustedadmin">
3418 <title>Trusted and admin users</title>
3420 Some Exim options are available only to <emphasis>trusted users</emphasis> and others are
3421 available only to <emphasis>admin users</emphasis>. In the description below, the phrases <quote>Exim
3422 user</quote> and <quote>Exim group</quote> mean the user and group defined by EXIM_USER and
3423 EXIM_GROUP in <filename>Local/Makefile</filename> or set by the <option>exim_user</option> and
3424 <option>exim_group</option> options. These do not necessarily have to use the name <quote>exim</quote>.
3429 <indexterm role="concept">
3430 <primary>trusted users</primary>
3431 <secondary>definition of</secondary>
3433 <indexterm role="concept">
3434 <primary>user</primary>
3435 <secondary>trusted definition of</secondary>
3437 The trusted users are root, the Exim user, any user listed in the
3438 <option>trusted_users</option> configuration option, and any user whose current group or any
3439 supplementary group is one of those listed in the <option>trusted_groups</option>
3440 configuration option. Note that the Exim group is not automatically trusted.
3443 <indexterm role="concept">
3444 <primary><quote>From</quote> line</primary>
3446 <indexterm role="concept">
3447 <primary>envelope sender</primary>
3449 Trusted users are always permitted to use the <option>-f</option> option or a leading
3450 <quote>From </quote> line to specify the envelope sender of a message that is passed to
3451 Exim through the local interface (see the <option>-bm</option> and <option>-f</option> options below).
3452 See the <option>untrusted_set_sender</option> option for a way of permitting non-trusted
3453 users to set envelope senders.
3456 <indexterm role="concept">
3457 <primary><emphasis>From:</emphasis> header line</primary>
3459 <indexterm role="concept">
3460 <primary><emphasis>Sender:</emphasis> header line</primary>
3462 For a trusted user, there is never any check on the contents of the <emphasis>From:</emphasis>
3463 header line, and a <emphasis>Sender:</emphasis> line is never added. Furthermore, any existing
3464 <emphasis>Sender:</emphasis> line in incoming local (non-TCP/IP) messages is not removed.
3467 Trusted users may also specify a host name, host address, interface address,
3468 protocol name, ident value, and authentication data when submitting a message
3469 locally. Thus, they are able to insert messages into Exim’s queue locally that
3470 have the characteristics of messages received from a remote host. Untrusted
3471 users may in some circumstances use <option>-f</option>, but can never set the other values
3472 that are available to trusted users.
3477 <indexterm role="concept">
3478 <primary>user</primary>
3479 <secondary>admin definition of</secondary>
3481 <indexterm role="concept">
3482 <primary>admin user</primary>
3483 <secondary>definition of</secondary>
3485 The admin users are root, the Exim user, and any user that is a member of the
3486 Exim group or of any group listed in the <option>admin_groups</option> configuration option.
3487 The current group does not have to be one of these groups.
3490 Admin users are permitted to list the queue, and to carry out certain
3491 operations on messages, for example, to force delivery failures. It is also
3492 necessary to be an admin user in order to see the full information provided by
3493 the Exim monitor, and full debugging output.
3496 By default, the use of the <option>-M</option>, <option>-q</option>, <option>-R</option>, and <option>-S</option> options to cause
3497 Exim to attempt delivery of messages on its queue is restricted to admin users.
3498 However, this restriction can be relaxed by setting the <option>prod_requires_admin</option>
3499 option false (that is, specifying <option>no_prod_requires_admin</option>).
3502 Similarly, the use of the <option>-bp</option> option to list all the messages in the queue
3503 is restricted to admin users unless <option>queue_list_requires_admin</option> is set
3509 <emphasis role="bold">Warning</emphasis>: If you configure your system so that admin users are able to
3510 edit Exim’s configuration file, you are giving those users an easy way of
3511 getting root. There is further discussion of this issue at the start of chapter
3512 <xref linkend="CHAPconf"/>.
3515 <section id="SECID39">
3516 <title>Command line options</title>
3518 Exim’s command line options are described in alphabetical order below. If none
3519 of the options that specifies a specific action (such as starting the daemon or
3520 a queue runner, or testing an address, or receiving a message in a specific
3521 format, or listing the queue) are present, and there is at least one argument
3522 on the command line, <option>-bm</option> (accept a local message on the standard input,
3523 with the arguments specifying the recipients) is assumed. Otherwise, Exim
3524 outputs a brief message about itself and exits.
3526 <!-- === Start of command line options === -->
3529 <term><option>--</option></term>
3532 <indexterm role="option">
3533 <primary>--</primary>
3535 <indexterm role="concept">
3536 <primary>options</primary>
3537 <secondary>command line; terminating</secondary>
3539 This is a pseudo-option whose only purpose is to terminate the options and
3540 therefore to cause subsequent command line items to be treated as arguments
3541 rather than options, even if they begin with hyphens.
3543 </listitem></varlistentry>
3545 <term><option>--help</option></term>
3548 <indexterm role="option">
3549 <primary><option>--help</option></primary>
3551 This option causes Exim to output a few sentences stating what it is.
3552 The same output is generated if the Exim binary is called with no options and
3555 </listitem></varlistentry>
3557 <term><option>--version</option></term>
3560 <indexterm role="option">
3561 <primary><option>--version</option></primary>
3563 This option is an alias for <option>-bV</option> and causes version information to be
3566 </listitem></varlistentry>
3568 <term><option>-B</option><<emphasis>type</emphasis>></term>
3571 <indexterm role="option">
3572 <primary><option>-B</option></primary>
3574 <indexterm role="concept">
3575 <primary>8-bit characters</primary>
3577 <indexterm role="concept">
3578 <primary>Sendmail compatibility</primary>
3579 <secondary>8-bit characters</secondary>
3581 This is a Sendmail option for selecting 7 or 8 bit processing. Exim is 8-bit
3582 clean; it ignores this option.
3584 </listitem></varlistentry>
3586 <term><option>-bd</option></term>
3589 <indexterm role="option">
3590 <primary><option>-bd</option></primary>
3592 <indexterm role="concept">
3593 <primary>daemon</primary>
3595 <indexterm role="concept">
3596 <primary>SMTP</primary>
3597 <secondary>listener</secondary>
3599 <indexterm role="concept">
3600 <primary>queue runner</primary>
3602 This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually
3603 the <option>-bd</option> option is combined with the <option>-q</option><<emphasis>time</emphasis>> option, to specify
3604 that the daemon should also initiate periodic queue runs.
3607 The <option>-bd</option> option can be used only by an admin user. If either of the <option>-d</option>
3608 (debugging) or <option>-v</option> (verifying) options are set, the daemon does not
3609 disconnect from the controlling terminal. When running this way, it can be
3610 stopped by pressing ctrl-C.
3613 By default, Exim listens for incoming connections to the standard SMTP port on
3614 all the host’s running interfaces. However, it is possible to listen on other
3615 ports, on multiple ports, and only on specific interfaces. Chapter
3616 <xref linkend="CHAPinterfaces"/> contains a description of the options that control this.
3619 When a listening daemon
3620 <indexterm role="concept">
3621 <primary>daemon</primary>
3622 <secondary>process id (pid)</secondary>
3624 <indexterm role="concept">
3625 <primary>pid (process id)</primary>
3626 <secondary>of daemon</secondary>
3628 is started without the use of <option>-oX</option> (that is, without overriding the normal
3629 configuration), it writes its process id to a file called <filename>exim-daemon.pid</filename>
3630 in Exim’s spool directory. This location can be overridden by setting
3631 PID_FILE_PATH in <filename>Local/Makefile</filename>. The file is written while Exim is still
3635 When <option>-oX</option> is used on the command line to start a listening daemon, the
3636 process id is not written to the normal pid file path. However, <option>-oP</option> can be
3637 used to specify a path on the command line if a pid file is required.
3641 <indexterm role="concept">
3642 <primary>SIGHUP</primary>
3644 <indexterm role="concept">
3645 <primary>daemon</primary>
3646 <secondary>restarting</secondary>
3648 can be used to cause the daemon to re-execute itself. This should be done
3649 whenever Exim’s configuration file, or any file that is incorporated into it by
3650 means of the <option>.include</option> facility, is changed, and also whenever a new version
3651 of Exim is installed. It is not necessary to do this when other files that are
3652 referenced from the configuration (for example, alias files) are changed,
3653 because these are reread each time they are used.
3655 </listitem></varlistentry>
3657 <term><option>-bdf</option></term>
3660 <indexterm role="option">
3661 <primary><option>-bdf</option></primary>
3663 This option has the same effect as <option>-bd</option> except that it never disconnects
3664 from the controlling terminal, even when no debugging is specified.
3666 </listitem></varlistentry>
3668 <term><option>-be</option></term>
3671 <indexterm role="option">
3672 <primary><option>-be</option></primary>
3674 <indexterm role="concept">
3675 <primary>testing</primary>
3676 <secondary>string expansion</secondary>
3678 <indexterm role="concept">
3679 <primary>expansion</primary>
3680 <secondary>testing</secondary>
3682 Run Exim in expansion testing mode. Exim discards its root privilege, to
3683 prevent ordinary users from using this mode to read otherwise inaccessible
3684 files. If no arguments are given, Exim runs interactively, prompting for lines
3685 of data. Otherwise, it processes each argument in turn.
3688 If Exim was built with USE_READLINE=yes in <filename>Local/Makefile</filename>, it tries
3689 to load the <option>libreadline</option> library dynamically whenever the <option>-be</option> option is
3690 used without command line arguments. If successful, it uses the <function>readline()</function>
3691 function, which provides extensive line-editing facilities, for reading the
3692 test data. A line history is supported.
3695 Long expansion expressions can be split over several lines by using backslash
3696 continuations. As in Exim’s run time configuration, white space at the start of
3697 continuation lines is ignored. Each argument or data line is passed through the
3698 string expansion mechanism, and the result is output. Variable values from the
3699 configuration file (for example, <varname>$qualify_domain</varname>) are available, but no
3700 message-specific values (such as <varname>$sender_domain</varname>) are set, because no message
3701 is being processed (but see <option>-bem</option> and <option>-Mset</option>).
3704 <emphasis role="bold">Note</emphasis>: If you use this mechanism to test lookups, and you change the data
3705 files or databases you are using, you must exit and restart Exim before trying
3706 the same lookup again. Otherwise, because each Exim process caches the results
3707 of lookups, you will just get the same result as before.
3709 </listitem></varlistentry>
3711 <term><option>-bem</option> <<emphasis>filename</emphasis>></term>
3714 <indexterm role="option">
3715 <primary><option>-bem</option></primary>
3717 <indexterm role="concept">
3718 <primary>testing</primary>
3719 <secondary>string expansion</secondary>
3721 <indexterm role="concept">
3722 <primary>expansion</primary>
3723 <secondary>testing</secondary>
3725 This option operates like <option>-be</option> except that it must be followed by the name
3726 of a file. For example:
3728 <literallayout class="monospaced">
3729 exim -bem /tmp/testmessage
3732 The file is read as a message (as if receiving a locally-submitted non-SMTP
3733 message) before any of the test expansions are done. Thus, message-specific
3734 variables such as <varname>$message_size</varname> and <varname>$header_from:</varname> are available. However,
3735 no <emphasis>Received:</emphasis> header is added to the message. If the <option>-t</option> option is set,
3736 recipients are read from the headers in the normal way, and are shown in the
3737 <varname>$recipients</varname> variable. Note that recipients cannot be given on the command
3738 line, because further arguments are taken as strings to expand (just like
3739 <option>-be</option>).
3741 </listitem></varlistentry>
3743 <term><option>-bF</option> <<emphasis>filename</emphasis>></term>
3746 <indexterm role="option">
3747 <primary><option>-bF</option></primary>
3749 <indexterm role="concept">
3750 <primary>system filter</primary>
3751 <secondary>testing</secondary>
3753 <indexterm role="concept">
3754 <primary>testing</primary>
3755 <secondary>system filter</secondary>
3757 This option is the same as <option>-bf</option> except that it assumes that the filter being
3758 tested is a system filter. The additional commands that are available only in
3759 system filters are recognized.
3761 </listitem></varlistentry>
3763 <term><option>-bf</option> <<emphasis>filename</emphasis>></term>
3766 <indexterm role="option">
3767 <primary><option>-bf</option></primary>
3769 <indexterm role="concept">
3770 <primary>filter</primary>
3771 <secondary>testing</secondary>
3773 <indexterm role="concept">
3774 <primary>testing</primary>
3775 <secondary>filter file</secondary>
3777 <indexterm role="concept">
3778 <primary>forward file</primary>
3779 <secondary>testing</secondary>
3781 <indexterm role="concept">
3782 <primary>testing</primary>
3783 <secondary>forward file</secondary>
3785 <indexterm role="concept">
3786 <primary>Sieve filter</primary>
3787 <secondary>testing</secondary>
3789 This option runs Exim in user filter testing mode; the file is the filter file
3790 to be tested, and a test message must be supplied on the standard input. If
3791 there are no message-dependent tests in the filter, an empty file can be
3795 If you want to test a system filter file, use <option>-bF</option> instead of <option>-bf</option>. You
3796 can use both <option>-bF</option> and <option>-bf</option> on the same command, in order to test a system
3797 filter and a user filter in the same run. For example:
3799 <literallayout class="monospaced">
3800 exim -bF /system/filter -bf /user/filter </test/message
3803 This is helpful when the system filter adds header lines or sets filter
3804 variables that are used by the user filter.
3807 If the test filter file does not begin with one of the special lines
3809 <literallayout class="monospaced">
3814 it is taken to be a normal <filename>.forward</filename> file, and is tested for validity under
3815 that interpretation. See sections <xref linkend="SECTitenonfilred"/> to
3816 <xref linkend="SECTspecitredli"/> for a description of the possible contents of non-filter
3820 The result of an Exim command that uses <option>-bf</option>, provided no errors are
3821 detected, is a list of the actions that Exim would try to take if presented
3822 with the message for real. More details of filter testing are given in the
3823 separate document entitled <emphasis>Exim’s interfaces to mail filtering</emphasis>.
3826 When testing a filter file,
3827 <indexterm role="concept">
3828 <primary><quote>From</quote> line</primary>
3830 <indexterm role="concept">
3831 <primary>envelope sender</primary>
3833 <indexterm role="option">
3834 <primary><option>-f</option></primary>
3835 <secondary>for filter testing</secondary>
3837 the envelope sender can be set by the <option>-f</option> option,
3838 or by a <quote>From </quote> line at the start of the test message. Various parameters
3839 that would normally be taken from the envelope recipient address of the message
3840 can be set by means of additional command line options (see the next four
3843 </listitem></varlistentry>
3845 <term><option>-bfd</option> <<emphasis>domain</emphasis>></term>
3848 <indexterm role="option">
3849 <primary><option>-bfd</option></primary>
3851 <indexterm role="variable">
3852 <primary><varname>$qualify_domain</varname></primary>
3854 This sets the domain of the recipient address when a filter file is being
3855 tested by means of the <option>-bf</option> option. The default is the value of
3856 <varname>$qualify_domain</varname>.
3858 </listitem></varlistentry>
3860 <term><option>-bfl</option> <<emphasis>local part</emphasis>></term>
3863 <indexterm role="option">
3864 <primary><option>-bfl</option></primary>
3866 This sets the local part of the recipient address when a filter file is being
3867 tested by means of the <option>-bf</option> option. The default is the username of the
3868 process that calls Exim. A local part should be specified with any prefix or
3869 suffix stripped, because that is how it appears to the filter when a message is
3870 actually being delivered.
3872 </listitem></varlistentry>
3874 <term><option>-bfp</option> <<emphasis>prefix</emphasis>></term>
3877 <indexterm role="option">
3878 <primary><option>-bfp</option></primary>
3880 This sets the prefix of the local part of the recipient address when a filter
3881 file is being tested by means of the <option>-bf</option> option. The default is an empty
3884 </listitem></varlistentry>
3886 <term><option>-bfs</option> <<emphasis>suffix</emphasis>></term>
3889 <indexterm role="option">
3890 <primary><option>-bfs</option></primary>
3892 This sets the suffix of the local part of the recipient address when a filter
3893 file is being tested by means of the <option>-bf</option> option. The default is an empty
3896 </listitem></varlistentry>
3898 <term><option>-bh</option> <<emphasis>IP address</emphasis>></term>
3901 <indexterm role="option">
3902 <primary><option>-bh</option></primary>
3904 <indexterm role="concept">
3905 <primary>testing</primary>
3906 <secondary>incoming SMTP</secondary>
3908 <indexterm role="concept">
3909 <primary>SMTP</primary>
3910 <secondary>testing incoming</secondary>
3912 <indexterm role="concept">
3913 <primary>testing</primary>
3914 <secondary>relay control</secondary>
3916 <indexterm role="concept">
3917 <primary>relaying</primary>
3918 <secondary>testing configuration</secondary>
3920 <indexterm role="concept">
3921 <primary>policy control</primary>
3922 <secondary>testing</secondary>
3924 <indexterm role="concept">
3925 <primary>debugging</primary>
3926 <secondary><option>-bh</option> option</secondary>
3928 This option runs a fake SMTP session as if from the given IP address, using the
3929 standard input and output. The IP address may include a port number at the end,
3930 after a full stop. For example:
3932 <literallayout class="monospaced">
3933 exim -bh 10.9.8.7.1234
3934 exim -bh fe80::a00:20ff:fe86:a061.5678
3937 When an IPv6 address is given, it is converted into canonical form. In the case
3938 of the second example above, the value of <varname>$sender_host_address</varname> after
3939 conversion to the canonical form is
3940 <literal>fe80:0000:0000:0a00:20ff:fe86:a061.5678</literal>.
3943 Comments as to what is going on are written to the standard error file. These
3944 include lines beginning with <quote>LOG</quote> for anything that would have been logged.
3945 This facility is provided for testing configuration options for incoming
3946 messages, to make sure they implement the required policy. For example, you can
3947 test your relay controls using <option>-bh</option>.
3950 <emphasis role="bold">Warning 1</emphasis>:
3951 <indexterm role="concept">
3952 <primary>RFC 1413</primary>
3954 You can test features of the configuration that rely on ident (RFC 1413)
3955 information by using the <option>-oMt</option> option. However, Exim cannot actually perform
3956 an ident callout when testing using <option>-bh</option> because there is no incoming SMTP
3960 <emphasis role="bold">Warning 2</emphasis>: Address verification callouts (see section <xref linkend="SECTcallver"/>)
3961 are also skipped when testing using <option>-bh</option>. If you want these callouts to
3962 occur, use <option>-bhc</option> instead.
3965 Messages supplied during the testing session are discarded, and nothing is
3966 written to any of the real log files. There may be pauses when DNS (and other)
3967 lookups are taking place, and of course these may time out. The <option>-oMi</option> option
3968 can be used to specify a specific IP interface and port if this is important,
3969 and <option>-oMaa</option> and <option>-oMai</option> can be used to set parameters as if the SMTP
3970 session were authenticated.
3973 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option> whose
3974 output just states whether a given recipient address from a given host is
3975 acceptable or not. See section <xref linkend="SECTcheckaccess"/>.
3978 Features such as authentication and encryption, where the client input is not
3979 plain text, cannot easily be tested with <option>-bh</option>. Instead, you should use a
3980 specialized SMTP test program such as
3981 <emphasis role="bold"><ulink url="http://jetmore.org/john/code/#swaks">swaks</ulink></emphasis>.
3983 </listitem></varlistentry>
3985 <term><option>-bhc</option> <<emphasis>IP address</emphasis>></term>
3988 <indexterm role="option">
3989 <primary><option>-bhc</option></primary>
3991 This option operates in the same way as <option>-bh</option>, except that address
3992 verification callouts are performed if required. This includes consulting and
3993 updating the callout cache database.
3995 </listitem></varlistentry>
3997 <term><option>-bi</option></term>
4000 <indexterm role="option">
4001 <primary><option>-bi</option></primary>
4003 <indexterm role="concept">
4004 <primary>alias file</primary>
4005 <secondary>building</secondary>
4007 <indexterm role="concept">
4008 <primary>building alias file</primary>
4010 <indexterm role="concept">
4011 <primary>Sendmail compatibility</primary>
4012 <secondary><option>-bi</option> option</secondary>
4014 Sendmail interprets the <option>-bi</option> option as a request to rebuild its alias file.
4015 Exim does not have the concept of a single alias file, and so it cannot mimic
4016 this behaviour. However, calls to <filename>/usr/lib/sendmail</filename> with the <option>-bi</option> option
4017 tend to appear in various scripts such as NIS make files, so the option must be
4021 If <option>-bi</option> is encountered, the command specified by the <option>bi_command</option>
4022 configuration option is run, under the uid and gid of the caller of Exim. If
4023 the <option>-oA</option> option is used, its value is passed to the command as an argument.
4024 The command set by <option>bi_command</option> may not contain arguments. The command can
4025 use the <emphasis>exim_dbmbuild</emphasis> utility, or some other means, to rebuild alias files
4026 if this is required. If the <option>bi_command</option> option is not set, calling Exim with
4027 <option>-bi</option> is a no-op.
4029 </listitem></varlistentry>
4031 <term><option>-bm</option></term>
4034 <indexterm role="option">
4035 <primary><option>-bm</option></primary>
4037 <indexterm role="concept">
4038 <primary>local message reception</primary>
4040 This option runs an Exim receiving process that accepts an incoming,
4041 locally-generated message on the current input. The recipients are given as the
4042 command arguments (except when <option>-t</option> is also present – see below). Each
4043 argument can be a comma-separated list of RFC 2822 addresses. This is the
4044 default option for selecting the overall action of an Exim call; it is assumed
4045 if no other conflicting option is present.
4048 If any addresses in the message are unqualified (have no domain), they are
4049 qualified by the values of the <option>qualify_domain</option> or <option>qualify_recipient</option>
4050 options, as appropriate. The <option>-bnq</option> option (see below) provides a way of
4051 suppressing this for special cases.
4054 Policy checks on the contents of local messages can be enforced by means of
4055 the non-SMTP ACL. See chapter <xref linkend="CHAPACL"/> for details.
4058 <indexterm role="concept">
4059 <primary>return code</primary>
4060 <secondary>for <option>-bm</option></secondary>
4062 The return code is zero if the message is successfully accepted. Otherwise, the
4063 action is controlled by the <option>-oe</option><emphasis>x</emphasis> option setting – see below.
4067 <indexterm role="concept">
4068 <primary>message</primary>
4069 <secondary>format</secondary>
4071 <indexterm role="concept">
4072 <primary>format</primary>
4073 <secondary>message</secondary>
4075 <indexterm role="concept">
4076 <primary><quote>From</quote> line</primary>
4078 <indexterm role="concept">
4079 <primary>UUCP</primary>
4080 <secondary><quote>From</quote> line</secondary>
4082 <indexterm role="concept">
4083 <primary>Sendmail compatibility</primary>
4084 <secondary><quote>From</quote> line</secondary>
4086 of the message must be as defined in RFC 2822, except that, for
4087 compatibility with Sendmail and Smail, a line in one of the forms
4089 <literallayout class="monospaced">
4090 From sender Fri Jan 5 12:55 GMT 1997
4091 From sender Fri, 5 Jan 97 12:55:01
4094 (with the weekday optional, and possibly with additional text after the date)
4095 is permitted to appear at the start of the message. There appears to be no
4096 authoritative specification of the format of this line. Exim recognizes it by
4097 matching against the regular expression defined by the <option>uucp_from_pattern</option>
4098 option, which can be changed if necessary.
4101 <indexterm role="option">
4102 <primary><option>-f</option></primary>
4103 <secondary>overriding <quote>From</quote> line</secondary>
4105 The specified sender is treated as if it were given as the argument to the
4106 <option>-f</option> option, but if a <option>-f</option> option is also present, its argument is used in
4107 preference to the address taken from the message. The caller of Exim must be a
4108 trusted user for the sender of a message to be set in this way.
4110 </listitem></varlistentry>
4112 <term><option>-bnq</option></term>
4115 <indexterm role="option">
4116 <primary><option>-bnq</option></primary>
4118 <indexterm role="concept">
4119 <primary>address qualification, suppressing</primary>
4121 By default, Exim automatically qualifies unqualified addresses (those
4122 without domains) that appear in messages that are submitted locally (that
4123 is, not over TCP/IP). This qualification applies both to addresses in
4124 envelopes, and addresses in header lines. Sender addresses are qualified using
4125 <option>qualify_domain</option>, and recipient addresses using <option>qualify_recipient</option> (which
4126 defaults to the value of <option>qualify_domain</option>).
4129 Sometimes, qualification is not wanted. For example, if <option>-bS</option> (batch SMTP) is
4130 being used to re-submit messages that originally came from remote hosts after
4131 content scanning, you probably do not want to qualify unqualified addresses in
4132 header lines. (Such lines will be present only if you have not enabled a header
4133 syntax check in the appropriate ACL.)
4136 The <option>-bnq</option> option suppresses all qualification of unqualified addresses in
4137 messages that originate on the local host. When this is used, unqualified
4138 addresses in the envelope provoke errors (causing message rejection) and
4139 unqualified addresses in header lines are left alone.
4141 </listitem></varlistentry>
4143 <term><option>-bP</option></term>
4146 <indexterm role="option">
4147 <primary><option>-bP</option></primary>
4149 <indexterm role="concept">
4150 <primary>configuration options</primary>
4151 <secondary>extracting</secondary>
4153 <indexterm role="concept">
4154 <primary>options</primary>
4155 <secondary>configuration – extracting</secondary>
4157 If this option is given with no arguments, it causes the values of all Exim’s
4158 main configuration options to be written to the standard output. The values
4159 of one or more specific options can be requested by giving their names as
4160 arguments, for example:
4162 <literallayout class="monospaced">
4163 exim -bP qualify_domain hold_domains
4166 <indexterm role="concept">
4167 <primary>hiding configuration option values</primary>
4169 <indexterm role="concept">
4170 <primary>configuration options</primary>
4171 <secondary>hiding value of</secondary>
4173 <indexterm role="concept">
4174 <primary>options</primary>
4175 <secondary>hiding value of</secondary>
4177 However, any option setting that is preceded by the word <quote>hide</quote> in the
4178 configuration file is not shown in full, except to an admin user. For other
4179 users, the output is as in this example:
4181 <literallayout class="monospaced">
4182 mysql_servers = <value not displayable>
4185 If <option>configure_file</option> is given as an argument, the name of the run time
4186 configuration file is output.
4187 If a list of configuration files was supplied, the value that is output here
4188 is the name of the file that was actually used.
4191 <indexterm role="concept">
4192 <primary>daemon</primary>
4193 <secondary>process id (pid)</secondary>
4195 <indexterm role="concept">
4196 <primary>pid (process id)</primary>
4197 <secondary>of daemon</secondary>
4199 If <option>log_file_path</option> or <option>pid_file_path</option> are given, the names of the
4200 directories where log files and daemon pid files are written are output,
4201 respectively. If these values are unset, log files are written in a
4202 sub-directory of the spool directory called <option>log</option>, and the pid file is
4203 written directly into the spool directory.
4206 If <option>-bP</option> is followed by a name preceded by <literal>+</literal>, for example,
4208 <literallayout class="monospaced">
4209 exim -bP +local_domains
4212 it searches for a matching named list of any type (domain, host, address, or
4213 local part) and outputs what it finds.
4216 <indexterm role="concept">
4217 <primary>options</primary>
4218 <secondary>router – extracting</secondary>
4220 <indexterm role="concept">
4221 <primary>options</primary>
4222 <secondary>transport – extracting</secondary>
4224 <indexterm role="concept">
4225 <primary>options</primary>
4226 <secondary>authenticator – extracting</secondary>
4228 If one of the words <option>router</option>, <option>transport</option>, or <option>authenticator</option> is given,
4229 followed by the name of an appropriate driver instance, the option settings for
4230 that driver are output. For example:
4232 <literallayout class="monospaced">
4233 exim -bP transport local_delivery
4236 The generic driver options are output first, followed by the driver’s private
4237 options. A list of the names of drivers of a particular type can be obtained by
4238 using one of the words <option>router_list</option>, <option>transport_list</option>, or
4239 <option>authenticator_list</option>, and a complete list of all drivers with their option
4240 settings can be obtained by using <option>routers</option>, <option>transports</option>, or
4241 <option>authenticators</option>.
4244 <indexterm role="concept">
4245 <primary>options</primary>
4246 <secondary>macro – extracting</secondary>
4248 If invoked by an admin user, then <option>macro</option>, <option>macro_list</option> and <option>macros</option>
4249 are available, similarly to the drivers. Because macros are sometimes used
4250 for storing passwords, this option is restricted.
4251 The output format is one item per line.
4253 </listitem></varlistentry>
4255 <term><option>-bp</option></term>
4258 <indexterm role="option">
4259 <primary><option>-bp</option></primary>
4261 <indexterm role="concept">
4262 <primary>queue</primary>
4263 <secondary>listing messages on</secondary>
4265 <indexterm role="concept">
4266 <primary>listing</primary>
4267 <secondary>messages on the queue</secondary>
4269 This option requests a listing of the contents of the mail queue on the
4270 standard output. If the <option>-bp</option> option is followed by a list of message ids,
4271 just those messages are listed. By default, this option can be used only by an
4272 admin user. However, the <option>queue_list_requires_admin</option> option can be set false
4273 to allow any user to see the queue.
4276 Each message on the queue is displayed as in the following example:
4278 <literallayout class="monospaced">
4279 25m 2.9K 0t5C6f-0000c8-00 <alice@wonderland.fict.example>
4280 red.king@looking-glass.fict.example
4281 <other addresses>
4284 <indexterm role="concept">
4285 <primary>message</primary>
4286 <secondary>size in queue listing</secondary>
4288 <indexterm role="concept">
4289 <primary>size</primary>
4290 <secondary>of message</secondary>
4292 The first line contains the length of time the message has been on the queue
4293 (in this case 25 minutes), the size of the message (2.9K), the unique local
4294 identifier for the message, and the message sender, as contained in the
4295 envelope. For bounce messages, the sender address is empty, and appears as
4296 <quote><></quote>. If the message was submitted locally by an untrusted user who overrode
4297 the default sender address, the user’s login name is shown in parentheses
4298 before the sender address.
4301 <indexterm role="concept">
4302 <primary>frozen messages</primary>
4303 <secondary>in queue listing</secondary>
4305 If the message is frozen (attempts to deliver it are suspended) then the text
4306 <quote>*** frozen ***</quote> is displayed at the end of this line.
4309 The recipients of the message (taken from the envelope, not the headers) are
4310 displayed on subsequent lines. Those addresses to which the message has already
4311 been delivered are marked with the letter D. If an original address gets
4312 expanded into several addresses via an alias or forward file, the original is
4313 displayed with a D only when deliveries for all of its child addresses are
4316 </listitem></varlistentry>
4318 <term><option>-bpa</option></term>
4321 <indexterm role="option">
4322 <primary><option>-bpa</option></primary>
4324 This option operates like <option>-bp</option>, but in addition it shows delivered addresses
4325 that were generated from the original top level address(es) in each message by
4326 alias or forwarding operations. These addresses are flagged with <quote>+D</quote> instead
4327 of just <quote>D</quote>.
4329 </listitem></varlistentry>
4331 <term><option>-bpc</option></term>
4334 <indexterm role="option">
4335 <primary><option>-bpc</option></primary>
4337 <indexterm role="concept">
4338 <primary>queue</primary>
4339 <secondary>count of messages on</secondary>
4341 This option counts the number of messages on the queue, and writes the total
4342 to the standard output. It is restricted to admin users, unless
4343 <option>queue_list_requires_admin</option> is set false.
4345 </listitem></varlistentry>
4347 <term><option>-bpr</option></term>
4350 <indexterm role="option">
4351 <primary><option>-bpr</option></primary>
4353 This option operates like <option>-bp</option>, but the output is not sorted into
4354 chronological order of message arrival. This can speed it up when there are
4355 lots of messages on the queue, and is particularly useful if the output is
4356 going to be post-processed in a way that doesn’t need the sorting.
4358 </listitem></varlistentry>
4360 <term><option>-bpra</option></term>
4363 <indexterm role="option">
4364 <primary><option>-bpra</option></primary>
4366 This option is a combination of <option>-bpr</option> and <option>-bpa</option>.
4368 </listitem></varlistentry>
4370 <term><option>-bpru</option></term>
4373 <indexterm role="option">
4374 <primary><option>-bpru</option></primary>
4376 This option is a combination of <option>-bpr</option> and <option>-bpu</option>.
4378 </listitem></varlistentry>
4380 <term><option>-bpu</option></term>
4383 <indexterm role="option">
4384 <primary><option>-bpu</option></primary>
4386 This option operates like <option>-bp</option> but shows only undelivered top-level
4387 addresses for each message displayed. Addresses generated by aliasing or
4388 forwarding are not shown, unless the message was deferred after processing by a
4389 router with the <option>one_time</option> option set.
4391 </listitem></varlistentry>
4393 <term><option>-brt</option></term>
4396 <indexterm role="option">
4397 <primary><option>-brt</option></primary>
4399 <indexterm role="concept">
4400 <primary>testing</primary>
4401 <secondary>retry configuration</secondary>
4403 <indexterm role="concept">
4404 <primary>retry</primary>
4405 <secondary>configuration testing</secondary>
4407 This option is for testing retry rules, and it must be followed by up to three
4408 arguments. It causes Exim to look for a retry rule that matches the values
4409 and to write it to the standard output. For example:
4411 <literallayout class="monospaced">
4412 exim -brt bach.comp.mus.example
4413 Retry rule: *.comp.mus.example F,2h,15m; F,4d,30m;
4416 See chapter <xref linkend="CHAPretry"/> for a description of Exim’s retry rules. The first
4417 argument, which is required, can be a complete address in the form
4418 <emphasis>local_part@domain</emphasis>, or it can be just a domain name. If the second argument
4419 contains a dot, it is interpreted as an optional second domain name; if no
4420 retry rule is found for the first argument, the second is tried. This ties in
4421 with Exim’s behaviour when looking for retry rules for remote hosts – if no
4422 rule is found that matches the host, one that matches the mail domain is
4423 sought. Finally, an argument that is the name of a specific delivery error, as
4424 used in setting up retry rules, can be given. For example:
4426 <literallayout class="monospaced">
4427 exim -brt haydn.comp.mus.example quota_3d
4428 Retry rule: *@haydn.comp.mus.example quota_3d F,1h,15m
4430 </listitem></varlistentry>
4432 <term><option>-brw</option></term>
4435 <indexterm role="option">
4436 <primary><option>-brw</option></primary>
4438 <indexterm role="concept">
4439 <primary>testing</primary>
4440 <secondary>rewriting</secondary>
4442 <indexterm role="concept">
4443 <primary>rewriting</primary>
4444 <secondary>testing</secondary>
4446 This option is for testing address rewriting rules, and it must be followed by
4447 a single argument, consisting of either a local part without a domain, or a
4448 complete address with a fully qualified domain. Exim outputs how this address
4449 would be rewritten for each possible place it might appear. See chapter
4450 <xref linkend="CHAPrewrite"/> for further details.
4452 </listitem></varlistentry>
4454 <term><option>-bS</option></term>
4457 <indexterm role="option">
4458 <primary><option>-bS</option></primary>
4460 <indexterm role="concept">
4461 <primary>SMTP</primary>
4462 <secondary>batched incoming</secondary>
4464 <indexterm role="concept">
4465 <primary>batched SMTP input</primary>
4467 This option is used for batched SMTP input, which is an alternative interface
4468 for non-interactive local message submission. A number of messages can be
4469 submitted in a single run. However, despite its name, this is not really SMTP
4470 input. Exim reads each message’s envelope from SMTP commands on the standard
4471 input, but generates no responses. If the caller is trusted, or
4472 <option>untrusted_set_sender</option> is set, the senders in the SMTP MAIL commands are
4473 believed; otherwise the sender is always the caller of Exim.
4476 The message itself is read from the standard input, in SMTP format (leading
4477 dots doubled), terminated by a line containing just a single dot. An error is
4478 provoked if the terminating dot is missing. A further message may then follow.
4481 As for other local message submissions, the contents of incoming batch SMTP
4482 messages can be checked using the non-SMTP ACL (see chapter <xref linkend="CHAPACL"/>).
4483 Unqualified addresses are automatically qualified using <option>qualify_domain</option> and
4484 <option>qualify_recipient</option>, as appropriate, unless the <option>-bnq</option> option is used.
4487 Some other SMTP commands are recognized in the input. HELO and EHLO act
4488 as RSET; VRFY, EXPN, ETRN, and HELP act as NOOP;
4489 QUIT quits, ignoring the rest of the standard input.
4492 <indexterm role="concept">
4493 <primary>return code</primary>
4494 <secondary>for <option>-bS</option></secondary>
4496 If any error is encountered, reports are written to the standard output and
4497 error streams, and Exim gives up immediately. The return code is 0 if no error
4498 was detected; it is 1 if one or more messages were accepted before the error
4499 was detected; otherwise it is 2.
4502 More details of input using batched SMTP are given in section
4503 <xref linkend="SECTincomingbatchedSMTP"/>.
4505 </listitem></varlistentry>
4507 <term><option>-bs</option></term>
4510 <indexterm role="option">
4511 <primary><option>-bs</option></primary>
4513 <indexterm role="concept">
4514 <primary>SMTP</primary>
4515 <secondary>local input</secondary>
4517 <indexterm role="concept">
4518 <primary>local SMTP input</primary>
4520 This option causes Exim to accept one or more messages by reading SMTP commands
4521 on the standard input, and producing SMTP replies on the standard output. SMTP
4522 policy controls, as defined in ACLs (see chapter <xref linkend="CHAPACL"/>) are applied.
4523 Some user agents use this interface as a way of passing locally-generated
4524 messages to the MTA.
4528 <indexterm role="concept">
4529 <primary>sender</primary>
4530 <secondary>source of</secondary>
4532 this usage, if the caller of Exim is trusted, or <option>untrusted_set_sender</option> is
4533 set, the senders of messages are taken from the SMTP MAIL commands.
4534 Otherwise the content of these commands is ignored and the sender is set up as
4535 the calling user. Unqualified addresses are automatically qualified using
4536 <option>qualify_domain</option> and <option>qualify_recipient</option>, as appropriate, unless the
4537 <option>-bnq</option> option is used.
4540 <indexterm role="concept">
4541 <primary>inetd</primary>
4544 <option>-bs</option> option is also used to run Exim from <emphasis>inetd</emphasis>, as an alternative to
4545 using a listening daemon. Exim can distinguish the two cases by checking
4546 whether the standard input is a TCP/IP socket. When Exim is called from
4547 <emphasis>inetd</emphasis>, the source of the mail is assumed to be remote, and the comments
4548 above concerning senders and qualification do not apply. In this situation,
4549 Exim behaves in exactly the same way as it does when receiving a message via
4550 the listening daemon.
4552 </listitem></varlistentry>
4554 <term><option>-bmalware</option> <<emphasis>filename</emphasis>></term>
4557 <indexterm role="option">
4558 <primary><option>-bmalware</option></primary>
4560 <indexterm role="concept">
4561 <primary>testing</primary>
4562 <secondary>,</secondary>
4564 <indexterm role="concept">
4565 <primary>malware scan test</primary>
4567 This debugging option causes Exim to scan the given file,
4568 using the malware scanning framework. The option of <option>av_scanner</option> influences
4569 this option, so if <option>av_scanner</option>’s value is dependent upon an expansion then
4570 the expansion should have defaults which apply to this invocation. ACLs are
4571 not invoked, so if <option>av_scanner</option> references an ACL variable then that variable
4572 will never be populated and <option>-bmalware</option> will fail.
4575 Exim will have changed working directory before resolving the filename, so
4576 using fully qualified pathnames is advisable. Exim will be running as the Exim
4577 user when it tries to open the file, rather than as the invoking user.
4578 This option requires admin privileges.
4581 The <option>-bmalware</option> option will not be extended to be more generally useful,
4582 there are better tools for file-scanning. This option exists to help
4583 administrators verify their Exim and AV scanner configuration.
4585 </listitem></varlistentry>
4587 <term><option>-bt</option></term>
4590 <indexterm role="option">
4591 <primary><option>-bt</option></primary>
4593 <indexterm role="concept">
4594 <primary>testing</primary>
4595 <secondary>addresses</secondary>
4597 <indexterm role="concept">
4598 <primary>address</primary>
4599 <secondary>testing</secondary>
4601 This option runs Exim in address testing mode, in which each argument is taken
4602 as a recipient address to be tested for deliverability. The results are
4603 written to the standard output. If a test fails, and the caller is not an admin
4604 user, no details of the failure are output, because these might contain
4605 sensitive information such as usernames and passwords for database lookups.
4608 If no arguments are given, Exim runs in an interactive manner, prompting with a
4609 right angle bracket for addresses to be tested.
4612 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4613 <function>readline()</function> function, because it is running as <emphasis>root</emphasis> and there are
4617 Each address is handled as if it were the recipient address of a message
4618 (compare the <option>-bv</option> option). It is passed to the routers and the result is
4619 written to the standard output. However, any router that has
4620 <option>no_address_test</option> set is bypassed. This can make <option>-bt</option> easier to use for
4621 genuine routing tests if your first router passes everything to a scanner
4625 <indexterm role="concept">
4626 <primary>return code</primary>
4627 <secondary>for <option>-bt</option></secondary>
4629 The return code is 2 if any address failed outright; it is 1 if no address
4630 failed outright but at least one could not be resolved for some reason. Return
4631 code 0 is given only when all addresses succeed.
4634 <indexterm role="concept">
4635 <primary>duplicate addresses</primary>
4637 <emphasis role="bold">Note</emphasis>: When actually delivering a message, Exim removes duplicate recipient
4638 addresses after routing is complete, so that only one delivery takes place.
4639 This does not happen when testing with <option>-bt</option>; the full results of routing are
4643 <emphasis role="bold">Warning</emphasis>: <option>-bt</option> can only do relatively simple testing. If any of the
4644 routers in the configuration makes any tests on the sender address of a
4646 <indexterm role="option">
4647 <primary><option>-f</option></primary>
4648 <secondary>for address testing</secondary>
4650 you can use the <option>-f</option> option to set an appropriate sender when running
4651 <option>-bt</option> tests. Without it, the sender is assumed to be the calling user at the
4652 default qualifying domain. However, if you have set up (for example) routers
4653 whose behaviour depends on the contents of an incoming message, you cannot test
4654 those conditions using <option>-bt</option>. The <option>-N</option> option provides a possible way of
4657 </listitem></varlistentry>
4659 <term><option>-bV</option></term>
4662 <indexterm role="option">
4663 <primary><option>-bV</option></primary>
4665 <indexterm role="concept">
4666 <primary>version number of Exim</primary>
4668 This option causes Exim to write the current version number, compilation
4669 number, and compilation date of the <emphasis>exim</emphasis> binary to the standard output.
4670 It also lists the DBM library this is being used, the optional modules (such as
4671 specific lookup types), the drivers that are included in the binary, and the
4672 name of the run time configuration file that is in use.
4675 As part of its operation, <option>-bV</option> causes Exim to read and syntax check its
4676 configuration file. However, this is a static check only. It cannot check
4677 values that are to be expanded. For example, although a misspelt ACL verb is
4678 detected, an error in the verb’s arguments is not. You cannot rely on <option>-bV</option>
4679 alone to discover (for example) all the typos in the configuration; some
4680 realistic testing is needed. The <option>-bh</option> and <option>-N</option> options provide more
4681 dynamic testing facilities.
4683 </listitem></varlistentry>
4685 <term><option>-bv</option></term>
4688 <indexterm role="option">
4689 <primary><option>-bv</option></primary>
4691 <indexterm role="concept">
4692 <primary>verifying address</primary>
4693 <secondary>using <option>-bv</option></secondary>
4695 <indexterm role="concept">
4696 <primary>address</primary>
4697 <secondary>verification</secondary>
4699 This option runs Exim in address verification mode, in which each argument is
4700 taken as a recipient address to be verified by the routers. (This does
4701 not involve any verification callouts). During normal operation, verification
4702 happens mostly as a consequence processing a <option>verify</option> condition in an ACL
4703 (see chapter <xref linkend="CHAPACL"/>). If you want to test an entire ACL, possibly
4704 including callouts, see the <option>-bh</option> and <option>-bhc</option> options.
4707 If verification fails, and the caller is not an admin user, no details of the
4708 failure are output, because these might contain sensitive information such as
4709 usernames and passwords for database lookups.
4712 If no arguments are given, Exim runs in an interactive manner, prompting with a
4713 right angle bracket for addresses to be verified.
4716 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4717 <function>readline()</function> function, because it is running as <emphasis>exim</emphasis> and there are
4721 Verification differs from address testing (the <option>-bt</option> option) in that routers
4722 that have <option>no_verify</option> set are skipped, and if the address is accepted by a
4723 router that has <option>fail_verify</option> set, verification fails. The address is
4724 verified as a recipient if <option>-bv</option> is used; to test verification for a sender
4725 address, <option>-bvs</option> should be used.
4728 If the <option>-v</option> option is not set, the output consists of a single line for each
4729 address, stating whether it was verified or not, and giving a reason in the
4730 latter case. Without <option>-v</option>, generating more than one address by redirection
4731 causes verification to end successfully, without considering the generated
4732 addresses. However, if just one address is generated, processing continues,
4733 and the generated address must verify successfully for the overall verification
4737 When <option>-v</option> is set, more details are given of how the address has been handled,
4738 and in the case of address redirection, all the generated addresses are also
4739 considered. Verification may succeed for some and fail for others.
4743 <indexterm role="concept">
4744 <primary>return code</primary>
4745 <secondary>for <option>-bv</option></secondary>
4747 return code is 2 if any address failed outright; it is 1 if no address
4748 failed outright but at least one could not be resolved for some reason. Return
4749 code 0 is given only when all addresses succeed.
4752 If any of the routers in the configuration makes any tests on the sender
4753 address of a message, you should use the <option>-f</option> option to set an appropriate
4754 sender when running <option>-bv</option> tests. Without it, the sender is assumed to be the
4755 calling user at the default qualifying domain.
4757 </listitem></varlistentry>
4759 <term><option>-bvs</option></term>
4762 <indexterm role="option">
4763 <primary><option>-bvs</option></primary>
4765 This option acts like <option>-bv</option>, but verifies the address as a sender rather
4766 than a recipient address. This affects any rewriting and qualification that
4769 </listitem></varlistentry>
4771 <term><option>-C</option> <<emphasis>filelist</emphasis>></term>
4774 <indexterm role="option">
4775 <primary><option>-C</option></primary>
4777 <indexterm role="concept">
4778 <primary>configuration file</primary>
4779 <secondary>alternate</secondary>
4781 <indexterm role="concept">
4782 <primary>CONFIGURE_FILE</primary>
4784 <indexterm role="concept">
4785 <primary>alternate configuration file</primary>
4787 This option causes Exim to find the run time configuration file from the given
4788 list instead of from the list specified by the CONFIGURE_FILE
4789 compile-time setting. Usually, the list will consist of just a single file
4790 name, but it can be a colon-separated list of names. In this case, the first
4791 file that exists is used. Failure to open an existing file stops Exim from
4792 proceeding any further along the list, and an error is generated.
4795 When this option is used by a caller other than root or the Exim user, and the
4796 list is different from the compiled-in list, Exim gives up its root privilege
4797 immediately, and runs with the real and effective uid and gid set to those of
4798 the caller. However, if ALT_CONFIG_ROOT_ONLY is defined in
4799 <filename>Local/Makefile</filename>, root privilege is retained for <option>-C</option> only if the caller of
4803 That is, the Exim user is no longer privileged in this regard. This build-time
4804 option is not set by default in the Exim source distribution tarbundle.
4805 However, if you are using a <quote>packaged</quote> version of Exim (source or binary),
4806 the packagers might have enabled it.
4809 Setting ALT_CONFIG_ROOT_ONLY locks out the possibility of testing a
4810 configuration using <option>-C</option> right through message reception and delivery, even
4811 if the caller is root. The reception works, but by that time, Exim is running
4812 as the Exim user, so when it re-executes to regain privilege for the delivery,
4813 the use of <option>-C</option> causes privilege to be lost. However, root can test reception
4814 and delivery using two separate commands (one to put a message on the queue,
4815 using <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
4818 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
4819 prefix string with which any file named in a <option>-C</option> command line option
4820 must start. In addition, the file name must not contain the sequence <literal>/../</literal>.
4821 However, if the value of the <option>-C</option> option is identical to the value of
4822 CONFIGURE_FILE in <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as
4823 usual. There is no default setting for ALT_CONFIG_PREFIX; when it is
4824 unset, any file name can be used with <option>-C</option>.
4827 ALT_CONFIG_PREFIX can be used to confine alternative configuration files
4828 to a directory to which only root has access. This prevents someone who has
4829 broken into the Exim account from running a privileged Exim with an arbitrary
4833 The <option>-C</option> facility is useful for ensuring that configuration files are
4834 syntactically correct, but cannot be used for test deliveries, unless the
4835 caller is privileged, or unless it is an exotic configuration that does not
4836 require privilege. No check is made on the owner or group of the files
4837 specified by this option.
4839 </listitem></varlistentry>
4841 <term><option>-D</option><<emphasis>macro</emphasis>>=<<emphasis>value</emphasis>></term>
4844 <indexterm role="option">
4845 <primary><option>-D</option></primary>
4847 <indexterm role="concept">
4848 <primary>macro</primary>
4849 <secondary>setting on command line</secondary>
4851 This option can be used to override macro definitions in the configuration file
4852 (see section <xref linkend="SECTmacrodefs"/>). However, like <option>-C</option>, if it is used by an
4853 unprivileged caller, it causes Exim to give up its root privilege.
4854 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
4855 completely disabled, and its use causes an immediate error exit.
4858 The entire option (including equals sign if present) must all be within one
4859 command line item. <option>-D</option> can be used to set the value of a macro to the empty
4860 string, in which case the equals sign is optional. These two commands are
4863 <literallayout class="monospaced">
4868 To include spaces in a macro definition item, quotes must be used. If you use
4869 quotes, spaces are permitted around the macro name and the equals sign. For
4872 <literallayout class="monospaced">
4873 exim '-D ABC = something' ...
4876 <option>-D</option> may be repeated up to 10 times on a command line.
4878 </listitem></varlistentry>
4880 <term><option>-d</option><<emphasis>debug options</emphasis>></term>
4883 <indexterm role="option">
4884 <primary><option>-d</option></primary>
4886 <indexterm role="concept">
4887 <primary>debugging</primary>
4888 <secondary>list of selectors</secondary>
4890 <indexterm role="concept">
4891 <primary>debugging</primary>
4892 <secondary><option>-d</option> option</secondary>
4894 This option causes debugging information to be written to the standard
4895 error stream. It is restricted to admin users because debugging output may show
4896 database queries that contain password information. Also, the details of users’
4897 filter files should be protected. If a non-admin user uses <option>-d</option>, Exim
4898 writes an error message to the standard error stream and exits with a non-zero
4902 When <option>-d</option> is used, <option>-v</option> is assumed. If <option>-d</option> is given on its own, a lot of
4903 standard debugging data is output. This can be reduced, or increased to include
4904 some more rarely needed information, by directly following <option>-d</option> with a string
4905 made up of names preceded by plus or minus characters. These add or remove sets
4906 of debugging data, respectively. For example, <option>-d+filter</option> adds filter
4907 debugging, whereas <option>-d-all+filter</option> selects only filter debugging. Note that
4908 no spaces are allowed in the debug setting. The available debugging categories
4912 <literal>acl </literal> ACL interpretation
4913 <literal>auth </literal> authenticators
4914 <literal>deliver </literal> general delivery logic
4915 <literal>dns </literal> DNS lookups (see also resolver)
4916 <literal>dnsbl </literal> DNS black list (aka RBL) code
4917 <literal>exec </literal> arguments for <function>execv()</function> calls
4918 <literal>expand </literal> detailed debugging for string expansions
4919 <literal>filter </literal> filter handling
4920 <literal>hints_lookup </literal> hints data lookups
4921 <literal>host_lookup </literal> all types of name-to-IP address handling
4922 <literal>ident </literal> ident lookup
4923 <literal>interface </literal> lists of local interfaces
4924 <literal>lists </literal> matching things in lists
4925 <literal>load </literal> system load checks
4926 <literal>local_scan </literal> can be used by <function>local_scan()</function> (see chapter <xref linkend="CHAPlocalscan"/>)
4927 <literal>lookup </literal> general lookup code and all lookups
4928 <literal>memory </literal> memory handling
4929 <literal>pid </literal> add pid to debug output lines
4930 <literal>process_info </literal> setting info for the process log
4931 <literal>queue_run </literal> queue runs
4932 <literal>receive </literal> general message reception logic
4933 <literal>resolver </literal> turn on the DNS resolver’s debugging output
4934 <literal>retry </literal> retry handling
4935 <literal>rewrite </literal> address rewriting
4936 <literal>route </literal> address routing
4937 <literal>timestamp </literal> add timestamp to debug output lines
4938 <literal>tls </literal> TLS logic
4939 <literal>transport </literal> transports
4940 <literal>uid </literal> changes of uid/gid and looking up uid/gid
4941 <literal>verify </literal> address verification logic
4942 <literal>all </literal> almost all of the above (see below), and also <option>-v</option>
4945 The <literal>all</literal> option excludes <literal>memory</literal> when used as <literal>+all</literal>, but includes it
4946 for <literal>-all</literal>. The reason for this is that <literal>+all</literal> is something that people
4947 tend to use when generating debug output for Exim maintainers. If <literal>+memory</literal>
4948 is included, an awful lot of output that is very rarely of interest is
4949 generated, so it now has to be explicitly requested. However, <literal>-all</literal> does
4950 turn everything off.
4953 <indexterm role="concept">
4954 <primary>resolver, debugging output</primary>
4956 <indexterm role="concept">
4957 <primary>DNS resolver, debugging output</primary>
4959 The <literal>resolver</literal> option produces output only if the DNS resolver was compiled
4960 with DEBUG enabled. This is not the case in some operating systems. Also,
4961 unfortunately, debugging output from the DNS resolver is written to stdout
4965 The default (<option>-d</option> with no argument) omits <literal>expand</literal>, <literal>filter</literal>,
4966 <literal>interface</literal>, <literal>load</literal>, <literal>memory</literal>, <literal>pid</literal>, <literal>resolver</literal>, and <literal>timestamp</literal>.
4967 However, the <literal>pid</literal> selector is forced when debugging is turned on for a
4968 daemon, which then passes it on to any re-executed Exims. Exim also
4969 automatically adds the pid to debug lines when several remote deliveries are
4973 The <literal>timestamp</literal> selector causes the current time to be inserted at the start
4974 of all debug output lines. This can be useful when trying to track down delays
4978 If the <option>debug_print</option> option is set in any driver, it produces output whenever
4979 any debugging is selected, or if <option>-v</option> is used.
4981 </listitem></varlistentry>
4983 <term><option>-dd</option><<emphasis>debug options</emphasis>></term>
4986 <indexterm role="option">
4987 <primary><option>-dd</option></primary>
4989 This option behaves exactly like <option>-d</option> except when used on a command that
4990 starts a daemon process. In that case, debugging is turned off for the
4991 subprocesses that the daemon creates. Thus, it is useful for monitoring the
4992 behaviour of the daemon without creating as much output as full debugging does.
4994 </listitem></varlistentry>
4996 <term><option>-dropcr</option></term>
4999 <indexterm role="option">
5000 <primary><option>-dropcr</option></primary>
5002 This is an obsolete option that is now a no-op. It used to affect the way Exim
5003 handled CR and LF characters in incoming messages. What happens now is
5004 described in section <xref linkend="SECTlineendings"/>.
5006 </listitem></varlistentry>
5008 <term><option>-E</option></term>
5011 <indexterm role="option">
5012 <primary><option>-E</option></primary>
5014 <indexterm role="concept">
5015 <primary>bounce message</primary>
5016 <secondary>generating</secondary>
5018 This option specifies that an incoming message is a locally-generated delivery
5019 failure report. It is used internally by Exim when handling delivery failures
5020 and is not intended for external use. Its only effect is to stop Exim
5021 generating certain messages to the postmaster, as otherwise message cascades
5022 could occur in some situations. As part of the same option, a message id may
5023 follow the characters <option>-E</option>. If it does, the log entry for the receipt of the
5024 new message contains the id, following <quote>R=</quote>, as a cross-reference.
5026 </listitem></varlistentry>
5028 <term><option>-e</option><emphasis>x</emphasis></term>
5031 <indexterm role="option">
5032 <primary><option>-e</option><emphasis>x</emphasis></primary>
5034 There are a number of Sendmail options starting with <option>-oe</option> which seem to be
5035 called by various programs without the leading <option>o</option> in the option. For
5036 example, the <option>vacation</option> program uses <option>-eq</option>. Exim treats all options of the
5037 form <option>-e</option><emphasis>x</emphasis> as synonymous with the corresponding <option>-oe</option><emphasis>x</emphasis> options.
5039 </listitem></varlistentry>
5041 <term><option>-F</option> <<emphasis>string</emphasis>></term>
5044 <indexterm role="option">
5045 <primary><option>-F</option></primary>
5047 <indexterm role="concept">
5048 <primary>sender</primary>
5049 <secondary>name</secondary>
5051 <indexterm role="concept">
5052 <primary>name</primary>
5053 <secondary>of sender</secondary>
5055 This option sets the sender’s full name for use when a locally-generated
5056 message is being accepted. In the absence of this option, the user’s <emphasis>gecos</emphasis>
5057 entry from the password data is used. As users are generally permitted to alter
5058 their <emphasis>gecos</emphasis> entries, no security considerations are involved. White space
5059 between <option>-F</option> and the <<emphasis>string</emphasis>> is optional.
5061 </listitem></varlistentry>
5063 <term><option>-f</option> <<emphasis>address</emphasis>></term>
5066 <indexterm role="option">
5067 <primary><option>-f</option></primary>
5069 <indexterm role="concept">
5070 <primary>sender</primary>
5071 <secondary>address</secondary>
5073 <indexterm role="concept">
5074 <primary>address</primary>
5075 <secondary>sender</secondary>
5077 <indexterm role="concept">
5078 <primary>trusted users</primary>
5080 <indexterm role="concept">
5081 <primary>envelope sender</primary>
5083 <indexterm role="concept">
5084 <primary>user</primary>
5085 <secondary>trusted</secondary>
5087 This option sets the address of the envelope sender of a locally-generated
5088 message (also known as the return path). The option can normally be used only
5089 by a trusted user, but <option>untrusted_set_sender</option> can be set to allow untrusted
5093 Processes running as root or the Exim user are always trusted. Other
5094 trusted users are defined by the <option>trusted_users</option> or <option>trusted_groups</option>
5095 options. In the absence of <option>-f</option>, or if the caller is not trusted, the sender
5096 of a local message is set to the caller’s login name at the default qualify
5100 There is one exception to the restriction on the use of <option>-f</option>: an empty sender
5101 can be specified by any user, trusted or not, to create a message that can
5102 never provoke a bounce. An empty sender can be specified either as an empty
5103 string, or as a pair of angle brackets with nothing between them, as in these
5104 examples of shell commands:
5106 <literallayout class="monospaced">
5107 exim -f '<>' user@domain
5108 exim -f "" user@domain
5111 In addition, the use of <option>-f</option> is not restricted when testing a filter file
5112 with <option>-bf</option> or when testing or verifying addresses using the <option>-bt</option> or
5113 <option>-bv</option> options.
5116 Allowing untrusted users to change the sender address does not of itself make
5117 it possible to send anonymous mail. Exim still checks that the <emphasis>From:</emphasis> header
5118 refers to the local user, and if it does not, it adds a <emphasis>Sender:</emphasis> header,
5119 though this can be overridden by setting <option>no_local_from_check</option>.
5123 <indexterm role="concept">
5124 <primary><quote>From</quote> line</primary>
5126 space between <option>-f</option> and the <<emphasis>address</emphasis>> is optional (that is, they can be
5127 given as two arguments or one combined argument). The sender of a
5128 locally-generated message can also be set (when permitted) by an initial
5129 <quote>From </quote> line in the message – see the description of <option>-bm</option> above – but
5130 if <option>-f</option> is also present, it overrides <quote>From </quote>.
5132 </listitem></varlistentry>
5134 <term><option>-G</option></term>
5137 <indexterm role="option">
5138 <primary><option>-G</option></primary>
5140 <indexterm role="concept">
5141 <primary>Sendmail compatibility</primary>
5142 <secondary><option>-G</option> option ignored</secondary>
5144 This is a Sendmail option which is ignored by Exim.
5146 </listitem></varlistentry>
5148 <term><option>-h</option> <<emphasis>number</emphasis>></term>
5151 <indexterm role="option">
5152 <primary><option>-h</option></primary>
5154 <indexterm role="concept">
5155 <primary>Sendmail compatibility</primary>
5156 <secondary><option>-h</option> option ignored</secondary>
5158 This option is accepted for compatibility with Sendmail, but has no effect. (In
5159 Sendmail it overrides the <quote>hop count</quote> obtained by counting <emphasis>Received:</emphasis>
5162 </listitem></varlistentry>
5164 <term><option>-i</option></term>
5167 <indexterm role="option">
5168 <primary><option>-i</option></primary>
5170 <indexterm role="concept">
5171 <primary>Solaris</primary>
5172 <secondary><emphasis>mail</emphasis> command</secondary>
5174 <indexterm role="concept">
5175 <primary>dot</primary>
5176 <secondary>in incoming non-SMTP message</secondary>
5178 This option, which has the same effect as <option>-oi</option>, specifies that a dot on a
5179 line by itself should not terminate an incoming, non-SMTP message. I can find
5180 no documentation for this option in Solaris 2.4 Sendmail, but the <emphasis>mailx</emphasis>
5181 command in Solaris 2.4 uses it. See also <option>-ti</option>.
5183 </listitem></varlistentry>
5185 <term><option>-M</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5188 <indexterm role="option">
5189 <primary><option>-M</option></primary>
5191 <indexterm role="concept">
5192 <primary>forcing delivery</primary>
5194 <indexterm role="concept">
5195 <primary>delivery</primary>
5196 <secondary>forcing attempt</secondary>
5198 <indexterm role="concept">
5199 <primary>frozen messages</primary>
5200 <secondary>forcing delivery</secondary>
5202 This option requests Exim to run a delivery attempt on each message in turn. If
5203 any of the messages are frozen, they are automatically thawed before the
5204 delivery attempt. The settings of <option>queue_domains</option>, <option>queue_smtp_domains</option>,
5205 and <option>hold_domains</option> are ignored.
5209 <indexterm role="concept">
5210 <primary>hints database</primary>
5211 <secondary>overriding retry hints</secondary>
5213 hints for any of the addresses are overridden – Exim tries to deliver even if
5214 the normal retry time has not yet been reached. This option requires the caller
5215 to be an admin user. However, there is an option called <option>prod_requires_admin</option>
5216 which can be set false to relax this restriction (and also the same requirement
5217 for the <option>-q</option>, <option>-R</option>, and <option>-S</option> options).
5220 The deliveries happen synchronously, that is, the original Exim process does
5221 not terminate until all the delivery attempts have finished. No output is
5222 produced unless there is a serious error. If you want to see what is happening,
5223 use the <option>-v</option> option as well, or inspect Exim’s main log.
5225 </listitem></varlistentry>
5227 <term><option>-Mar</option> <<emphasis>message id</emphasis>> <<emphasis>address</emphasis>> <<emphasis>address</emphasis>> ...</term>
5230 <indexterm role="option">
5231 <primary><option>-Mar</option></primary>
5233 <indexterm role="concept">
5234 <primary>message</primary>
5235 <secondary>adding recipients</secondary>
5237 <indexterm role="concept">
5238 <primary>recipient</primary>
5239 <secondary>adding</secondary>
5241 This option requests Exim to add the addresses to the list of recipients of the
5242 message (<quote>ar</quote> for <quote>add recipients</quote>). The first argument must be a message
5243 id, and the remaining ones must be email addresses. However, if the message is
5244 active (in the middle of a delivery attempt), it is not altered. This option
5245 can be used only by an admin user.
5247 </listitem></varlistentry>
5249 <term><option>-MC</option> <<emphasis>transport</emphasis>> <<emphasis>hostname</emphasis>> <<emphasis>sequence number</emphasis>> <<emphasis>message id</emphasis>></term>
5252 <indexterm role="option">
5253 <primary><option>-MC</option></primary>
5255 <indexterm role="concept">
5256 <primary>SMTP</primary>
5257 <secondary>passed connection</secondary>
5259 <indexterm role="concept">
5260 <primary>SMTP</primary>
5261 <secondary>multiple deliveries</secondary>
5263 <indexterm role="concept">
5264 <primary>multiple SMTP deliveries</primary>
5266 This option is not intended for use by external callers. It is used internally
5267 by Exim to invoke another instance of itself to deliver a waiting message using
5268 an existing SMTP connection, which is passed as the standard input. Details are
5269 given in chapter <xref linkend="CHAPSMTP"/>. This must be the final option, and the caller
5270 must be root or the Exim user in order to use it.
5272 </listitem></varlistentry>
5274 <term><option>-MCA</option></term>
5277 <indexterm role="option">
5278 <primary><option>-MCA</option></primary>
5280 This option is not intended for use by external callers. It is used internally
5281 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5282 connection to the remote host has been authenticated.
5284 </listitem></varlistentry>
5286 <term><option>-MCP</option></term>
5289 <indexterm role="option">
5290 <primary><option>-MCP</option></primary>
5292 This option is not intended for use by external callers. It is used internally
5293 by Exim in conjunction with the <option>-MC</option> option. It signifies that the server to
5294 which Exim is connected supports pipelining.
5296 </listitem></varlistentry>
5298 <term><option>-MCQ</option> <<emphasis>process id</emphasis>> <<emphasis>pipe fd</emphasis>></term>
5301 <indexterm role="option">
5302 <primary><option>-MCQ</option></primary>
5304 This option is not intended for use by external callers. It is used internally
5305 by Exim in conjunction with the <option>-MC</option> option when the original delivery was
5306 started by a queue runner. It passes on the process id of the queue runner,
5307 together with the file descriptor number of an open pipe. Closure of the pipe
5308 signals the final completion of the sequence of processes that are passing
5309 messages through the same SMTP connection.
5311 </listitem></varlistentry>
5313 <term><option>-MCS</option></term>
5316 <indexterm role="option">
5317 <primary><option>-MCS</option></primary>
5319 This option is not intended for use by external callers. It is used internally
5320 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5321 SMTP SIZE option should be used on messages delivered down the existing
5324 </listitem></varlistentry>
5326 <term><option>-MCT</option></term>
5329 <indexterm role="option">
5330 <primary><option>-MCT</option></primary>
5332 This option is not intended for use by external callers. It is used internally
5333 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5334 host to which Exim is connected supports TLS encryption.
5336 </listitem></varlistentry>
5338 <term><option>-Mc</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5341 <indexterm role="option">
5342 <primary><option>-Mc</option></primary>
5344 <indexterm role="concept">
5345 <primary>hints database</primary>
5346 <secondary>not overridden by <option>-Mc</option></secondary>
5348 <indexterm role="concept">
5349 <primary>delivery</primary>
5350 <secondary>manually started – not forced</secondary>
5352 This option requests Exim to run a delivery attempt on each message in turn,
5353 but unlike the <option>-M</option> option, it does check for retry hints, and respects any
5354 that are found. This option is not very useful to external callers. It is
5355 provided mainly for internal use by Exim when it needs to re-invoke itself in
5356 order to regain root privilege for a delivery (see chapter <xref linkend="CHAPsecurity"/>).
5357 However, <option>-Mc</option> can be useful when testing, in order to run a delivery that
5358 respects retry times and other options such as <option>hold_domains</option> that are
5359 overridden when <option>-M</option> is used. Such a delivery does not count as a queue run.
5360 If you want to run a specific delivery as if in a queue run, you should use
5361 <option>-q</option> with a message id argument. A distinction between queue run deliveries
5362 and other deliveries is made in one or two places.
5364 </listitem></varlistentry>
5366 <term><option>-Mes</option> <<emphasis>message id</emphasis>> <<emphasis>address</emphasis>></term>
5369 <indexterm role="option">
5370 <primary><option>-Mes</option></primary>
5372 <indexterm role="concept">
5373 <primary>message</primary>
5374 <secondary>changing sender</secondary>
5376 <indexterm role="concept">
5377 <primary>sender</primary>
5378 <secondary>changing</secondary>
5380 This option requests Exim to change the sender address in the message to the
5381 given address, which must be a fully qualified address or <quote><></quote> (<quote>es</quote> for
5382 <quote>edit sender</quote>). There must be exactly two arguments. The first argument must
5383 be a message id, and the second one an email address. However, if the message
5384 is active (in the middle of a delivery attempt), its status is not altered.
5385 This option can be used only by an admin user.
5387 </listitem></varlistentry>
5389 <term><option>-Mf</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5392 <indexterm role="option">
5393 <primary><option>-Mf</option></primary>
5395 <indexterm role="concept">
5396 <primary>freezing messages</primary>
5398 <indexterm role="concept">
5399 <primary>message</primary>
5400 <secondary>manually freezing</secondary>
5402 This option requests Exim to mark each listed message as <quote>frozen</quote>. This
5403 prevents any delivery attempts taking place until the message is <quote>thawed</quote>,
5404 either manually or as a result of the <option>auto_thaw</option> configuration option.
5405 However, if any of the messages are active (in the middle of a delivery
5406 attempt), their status is not altered. This option can be used only by an admin
5409 </listitem></varlistentry>
5411 <term><option>-Mg</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5414 <indexterm role="option">
5415 <primary><option>-Mg</option></primary>
5417 <indexterm role="concept">
5418 <primary>giving up on messages</primary>
5420 <indexterm role="concept">
5421 <primary>message</primary>
5422 <secondary>abandoning delivery attempts</secondary>
5424 <indexterm role="concept">
5425 <primary>delivery</primary>
5426 <secondary>abandoning further attempts</secondary>
5428 This option requests Exim to give up trying to deliver the listed messages,
5429 including any that are frozen. However, if any of the messages are active,
5430 their status is not altered. For non-bounce messages, a delivery error message
5431 is sent to the sender, containing the text <quote>cancelled by administrator</quote>.
5432 Bounce messages are just discarded. This option can be used only by an admin
5435 </listitem></varlistentry>
5437 <term><option>-Mmad</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5440 <indexterm role="option">
5441 <primary><option>-Mmad</option></primary>
5443 <indexterm role="concept">
5444 <primary>delivery</primary>
5445 <secondary>cancelling all</secondary>
5447 This option requests Exim to mark all the recipient addresses in the messages
5448 as already delivered (<quote>mad</quote> for <quote>mark all delivered</quote>). However, if any
5449 message is active (in the middle of a delivery attempt), its status is not
5450 altered. This option can be used only by an admin user.
5452 </listitem></varlistentry>
5454 <term><option>-Mmd</option> <<emphasis>message id</emphasis>> <<emphasis>address</emphasis>> <<emphasis>address</emphasis>> ...</term>
5457 <indexterm role="option">
5458 <primary><option>-Mmd</option></primary>
5460 <indexterm role="concept">
5461 <primary>delivery</primary>
5462 <secondary>cancelling by address</secondary>
5464 <indexterm role="concept">
5465 <primary>recipient</primary>
5466 <secondary>removing</secondary>
5468 <indexterm role="concept">
5469 <primary>removing recipients</primary>
5471 This option requests Exim to mark the given addresses as already delivered
5472 (<quote>md</quote> for <quote>mark delivered</quote>). The first argument must be a message id, and
5473 the remaining ones must be email addresses. These are matched to recipient
5474 addresses in the message in a case-sensitive manner. If the message is active
5475 (in the middle of a delivery attempt), its status is not altered. This option
5476 can be used only by an admin user.
5478 </listitem></varlistentry>
5480 <term><option>-Mrm</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5483 <indexterm role="option">
5484 <primary><option>-Mrm</option></primary>
5486 <indexterm role="concept">
5487 <primary>removing messages</primary>
5489 <indexterm role="concept">
5490 <primary>abandoning mail</primary>
5492 <indexterm role="concept">
5493 <primary>message</primary>
5494 <secondary>manually discarding</secondary>
5496 This option requests Exim to remove the given messages from the queue. No
5497 bounce messages are sent; each message is simply forgotten. However, if any of
5498 the messages are active, their status is not altered. This option can be used
5499 only by an admin user or by the user who originally caused the message to be
5500 placed on the queue.
5502 </listitem></varlistentry>
5504 <term><option>-Mset</option> <<emphasis>message id</emphasis>></term>
5507 <indexterm role="option">
5508 <primary><option>-Mset</option></primary>
5510 <indexterm role="concept">
5511 <primary>testing</primary>
5512 <secondary>string expansion</secondary>
5514 <indexterm role="concept">
5515 <primary>expansion</primary>
5516 <secondary>testing</secondary>
5518 This option is useful only in conjunction with <option>-be</option> (that is, when testing
5519 string expansions). Exim loads the given message from its spool before doing
5520 the test expansions, thus setting message-specific variables such as
5521 <varname>$message_size</varname> and the header variables. The <varname>$recipients</varname> variable is made
5522 available. This feature is provided to make it easier to test expansions that
5523 make use of these variables. However, this option can be used only by an admin
5524 user. See also <option>-bem</option>.
5526 </listitem></varlistentry>
5528 <term><option>-Mt</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5531 <indexterm role="option">
5532 <primary><option>-Mt</option></primary>
5534 <indexterm role="concept">
5535 <primary>thawing messages</primary>
5537 <indexterm role="concept">
5538 <primary>unfreezing messages</primary>
5540 <indexterm role="concept">
5541 <primary>frozen messages</primary>
5542 <secondary>thawing</secondary>
5544 <indexterm role="concept">
5545 <primary>message</primary>
5546 <secondary>thawing frozen</secondary>
5548 This option requests Exim to <quote>thaw</quote> any of the listed messages that are
5549 <quote>frozen</quote>, so that delivery attempts can resume. However, if any of the
5550 messages are active, their status is not altered. This option can be used only
5553 </listitem></varlistentry>
5555 <term><option>-Mvb</option> <<emphasis>message id</emphasis>></term>
5558 <indexterm role="option">
5559 <primary><option>-Mvb</option></primary>
5561 <indexterm role="concept">
5562 <primary>listing</primary>
5563 <secondary>message body</secondary>
5565 <indexterm role="concept">
5566 <primary>message</primary>
5567 <secondary>listing body of</secondary>
5569 This option causes the contents of the message body (-D) spool file to be
5570 written to the standard output. This option can be used only by an admin user.
5572 </listitem></varlistentry>
5574 <term><option>-Mvc</option> <<emphasis>message id</emphasis>></term>
5577 <indexterm role="option">
5578 <primary><option>-Mvc</option></primary>
5580 <indexterm role="concept">
5581 <primary>message</primary>
5582 <secondary>listing in RFC 2822 format</secondary>
5584 <indexterm role="concept">
5585 <primary>listing</primary>
5586 <secondary>message in RFC 2822 format</secondary>
5588 This option causes a copy of the complete message (header lines plus body) to
5589 be written to the standard output in RFC 2822 format. This option can be used
5590 only by an admin user.
5592 </listitem></varlistentry>
5594 <term><option>-Mvh</option> <<emphasis>message id</emphasis>></term>
5597 <indexterm role="option">
5598 <primary><option>-Mvh</option></primary>
5600 <indexterm role="concept">
5601 <primary>listing</primary>
5602 <secondary>message headers</secondary>
5604 <indexterm role="concept">
5605 <primary>header lines</primary>
5606 <secondary>listing</secondary>
5608 <indexterm role="concept">
5609 <primary>message</primary>
5610 <secondary>listing header lines</secondary>
5612 This option causes the contents of the message headers (-H) spool file to be
5613 written to the standard output. This option can be used only by an admin user.
5615 </listitem></varlistentry>
5617 <term><option>-Mvl</option> <<emphasis>message id</emphasis>></term>
5620 <indexterm role="option">
5621 <primary><option>-Mvl</option></primary>
5623 <indexterm role="concept">
5624 <primary>listing</primary>
5625 <secondary>message log</secondary>
5627 <indexterm role="concept">
5628 <primary>message</primary>
5629 <secondary>listing message log</secondary>
5631 This option causes the contents of the message log spool file to be written to
5632 the standard output. This option can be used only by an admin user.
5634 </listitem></varlistentry>
5636 <term><option>-m</option></term>
5639 <indexterm role="option">
5640 <primary><option>-m</option></primary>
5642 This is apparently a synonym for <option>-om</option> that is accepted by Sendmail, so Exim
5643 treats it that way too.
5645 </listitem></varlistentry>
5647 <term><option>-N</option></term>
5650 <indexterm role="option">
5651 <primary><option>-N</option></primary>
5653 <indexterm role="concept">
5654 <primary>debugging</primary>
5655 <secondary><option>-N</option> option</secondary>
5657 <indexterm role="concept">
5658 <primary>debugging</primary>
5659 <secondary>suppressing delivery</secondary>
5661 This is a debugging option that inhibits delivery of a message at the transport
5662 level. It implies <option>-v</option>. Exim goes through many of the motions of delivery –
5663 it just doesn’t actually transport the message, but instead behaves as if it
5664 had successfully done so. However, it does not make any updates to the retry
5665 database, and the log entries for deliveries are flagged with <quote>*></quote> rather
5666 than <quote>=></quote>.
5669 Because <option>-N</option> discards any message to which it applies, only root or the Exim
5670 user are allowed to use it with <option>-bd</option>, <option>-q</option>, <option>-R</option> or <option>-M</option>. In other
5671 words, an ordinary user can use it only when supplying an incoming message to
5672 which it will apply. Although transportation never fails when <option>-N</option> is set, an
5673 address may be deferred because of a configuration problem on a transport, or a
5674 routing problem. Once <option>-N</option> has been used for a delivery attempt, it sticks to
5675 the message, and applies to any subsequent delivery attempts that may happen
5678 </listitem></varlistentry>
5680 <term><option>-n</option></term>
5683 <indexterm role="option">
5684 <primary><option>-n</option></primary>
5686 <indexterm role="concept">
5687 <primary>Sendmail compatibility</primary>
5688 <secondary><option>-n</option> option ignored</secondary>
5690 This option is interpreted by Sendmail to mean <quote>no aliasing</quote>. It is ignored
5693 </listitem></varlistentry>
5695 <term><option>-O</option> <<emphasis>data</emphasis>></term>
5698 <indexterm role="option">
5699 <primary><option>-O</option></primary>
5701 This option is interpreted by Sendmail to mean <literal>set option</literal>. It is ignored by
5704 </listitem></varlistentry>
5706 <term><option>-oA</option> <<emphasis>file name</emphasis>></term>
5709 <indexterm role="option">
5710 <primary><option>-oA</option></primary>
5712 <indexterm role="concept">
5713 <primary>Sendmail compatibility</primary>
5714 <secondary><option>-oA</option> option</secondary>
5716 This option is used by Sendmail in conjunction with <option>-bi</option> to specify an
5717 alternative alias file name. Exim handles <option>-bi</option> differently; see the
5720 </listitem></varlistentry>
5722 <term><option>-oB</option> <<emphasis>n</emphasis>></term>
5725 <indexterm role="option">
5726 <primary><option>-oB</option></primary>
5728 <indexterm role="concept">
5729 <primary>SMTP</primary>
5730 <secondary>passed connection</secondary>
5732 <indexterm role="concept">
5733 <primary>SMTP</primary>
5734 <secondary>multiple deliveries</secondary>
5736 <indexterm role="concept">
5737 <primary>multiple SMTP deliveries</primary>
5739 This is a debugging option which limits the maximum number of messages that can
5740 be delivered down one SMTP connection, overriding the value set in any <command>smtp</command>
5741 transport. If <<emphasis>n</emphasis>> is omitted, the limit is set to 1.
5743 </listitem></varlistentry>
5745 <term><option>-odb</option></term>
5748 <indexterm role="option">
5749 <primary><option>-odb</option></primary>
5751 <indexterm role="concept">
5752 <primary>background delivery</primary>
5754 <indexterm role="concept">
5755 <primary>delivery</primary>
5756 <secondary>in the background</secondary>
5758 This option applies to all modes in which Exim accepts incoming messages,
5759 including the listening daemon. It requests <quote>background</quote> delivery of such
5760 messages, which means that the accepting process automatically starts a
5761 delivery process for each message received, but does not wait for the delivery
5762 processes to finish.
5765 When all the messages have been received, the reception process exits,
5766 leaving the delivery processes to finish in their own time. The standard output
5767 and error streams are closed at the start of each delivery process.
5768 This is the default action if none of the <option>-od</option> options are present.
5771 If one of the queueing options in the configuration file
5772 (<option>queue_only</option> or <option>queue_only_file</option>, for example) is in effect, <option>-odb</option>
5773 overrides it if <option>queue_only_override</option> is set true, which is the default
5774 setting. If <option>queue_only_override</option> is set false, <option>-odb</option> has no effect.
5776 </listitem></varlistentry>
5778 <term><option>-odf</option></term>
5781 <indexterm role="option">
5782 <primary><option>-odf</option></primary>
5784 <indexterm role="concept">
5785 <primary>foreground delivery</primary>
5787 <indexterm role="concept">
5788 <primary>delivery</primary>
5789 <secondary>in the foreground</secondary>
5791 This option requests <quote>foreground</quote> (synchronous) delivery when Exim has
5792 accepted a locally-generated message. (For the daemon it is exactly the same as
5793 <option>-odb</option>.) A delivery process is automatically started to deliver the message,
5794 and Exim waits for it to complete before proceeding.
5797 The original Exim reception process does not finish until the delivery
5798 process for the final message has ended. The standard error stream is left open
5802 However, like <option>-odb</option>, this option has no effect if <option>queue_only_override</option> is
5803 false and one of the queueing options in the configuration file is in effect.
5806 If there is a temporary delivery error during foreground delivery, the
5807 message is left on the queue for later delivery, and the original reception
5808 process exits. See chapter <xref linkend="CHAPnonqueueing"/> for a way of setting up a
5809 restricted configuration that never queues messages.
5811 </listitem></varlistentry>
5813 <term><option>-odi</option></term>
5816 <indexterm role="option">
5817 <primary><option>-odi</option></primary>
5819 This option is synonymous with <option>-odf</option>. It is provided for compatibility with
5822 </listitem></varlistentry>
5824 <term><option>-odq</option></term>
5827 <indexterm role="option">
5828 <primary><option>-odq</option></primary>
5830 <indexterm role="concept">
5831 <primary>non-immediate delivery</primary>
5833 <indexterm role="concept">
5834 <primary>delivery</primary>
5835 <secondary>suppressing immediate</secondary>
5837 <indexterm role="concept">
5838 <primary>queueing incoming messages</primary>
5840 This option applies to all modes in which Exim accepts incoming messages,
5841 including the listening daemon. It specifies that the accepting process should
5842 not automatically start a delivery process for each message received. Messages
5843 are placed on the queue, and remain there until a subsequent queue runner
5844 process encounters them. There are several configuration options (such as
5845 <option>queue_only</option>) that can be used to queue incoming messages under certain
5846 conditions. This option overrides all of them and also <option>-odqs</option>. It always
5849 </listitem></varlistentry>
5851 <term><option>-odqs</option></term>
5854 <indexterm role="option">
5855 <primary><option>-odqs</option></primary>
5857 <indexterm role="concept">
5858 <primary>SMTP</primary>
5859 <secondary>delaying delivery</secondary>
5861 This option is a hybrid between <option>-odb</option>/<option>-odi</option> and <option>-odq</option>.
5862 However, like <option>-odb</option> and <option>-odi</option>, this option has no effect if
5863 <option>queue_only_override</option> is false and one of the queueing options in the
5864 configuration file is in effect.
5867 When <option>-odqs</option> does operate, a delivery process is started for each incoming
5868 message, in the background by default, but in the foreground if <option>-odi</option> is
5869 also present. The recipient addresses are routed, and local deliveries are done
5870 in the normal way. However, if any SMTP deliveries are required, they are not
5871 done at this time, so the message remains on the queue until a subsequent queue
5872 runner process encounters it. Because routing was done, Exim knows which
5873 messages are waiting for which hosts, and so a number of messages for the same
5874 host can be sent in a single SMTP connection. The <option>queue_smtp_domains</option>
5875 configuration option has the same effect for specific domains. See also the
5876 <option>-qq</option> option.
5878 </listitem></varlistentry>
5880 <term><option>-oee</option></term>
5883 <indexterm role="option">
5884 <primary><option>-oee</option></primary>
5886 <indexterm role="concept">
5887 <primary>error</primary>
5888 <secondary>reporting</secondary>
5890 If an error is detected while a non-SMTP message is being received (for
5891 example, a malformed address), the error is reported to the sender in a mail
5895 <indexterm role="concept">
5896 <primary>return code</primary>
5897 <secondary>for <option>-oee</option></secondary>
5900 this error message is successfully sent, the Exim receiving process
5901 exits with a return code of zero. If not, the return code is 2 if the problem
5902 is that the original message has no recipients, or 1 any other error. This is
5903 the default <option>-oe</option><emphasis>x</emphasis> option if Exim is called as <emphasis>rmail</emphasis>.
5905 </listitem></varlistentry>
5907 <term><option>-oem</option></term>
5910 <indexterm role="option">
5911 <primary><option>-oem</option></primary>
5913 <indexterm role="concept">
5914 <primary>error</primary>
5915 <secondary>reporting</secondary>
5917 <indexterm role="concept">
5918 <primary>return code</primary>
5919 <secondary>for <option>-oem</option></secondary>
5921 This is the same as <option>-oee</option>, except that Exim always exits with a non-zero
5922 return code, whether or not the error message was successfully sent.
5923 This is the default <option>-oe</option><emphasis>x</emphasis> option, unless Exim is called as <emphasis>rmail</emphasis>.
5925 </listitem></varlistentry>
5927 <term><option>-oep</option></term>
5930 <indexterm role="option">
5931 <primary><option>-oep</option></primary>
5933 <indexterm role="concept">
5934 <primary>error</primary>
5935 <secondary>reporting</secondary>
5937 If an error is detected while a non-SMTP message is being received, the
5938 error is reported by writing a message to the standard error file (stderr).
5939 <indexterm role="concept">
5940 <primary>return code</primary>
5941 <secondary>for <option>-oep</option></secondary>
5943 The return code is 1 for all errors.
5945 </listitem></varlistentry>
5947 <term><option>-oeq</option></term>
5950 <indexterm role="option">
5951 <primary><option>-oeq</option></primary>
5953 <indexterm role="concept">
5954 <primary>error</primary>
5955 <secondary>reporting</secondary>
5957 This option is supported for compatibility with Sendmail, but has the same
5958 effect as <option>-oep</option>.
5960 </listitem></varlistentry>
5962 <term><option>-oew</option></term>
5965 <indexterm role="option">
5966 <primary><option>-oew</option></primary>
5968 <indexterm role="concept">
5969 <primary>error</primary>
5970 <secondary>reporting</secondary>
5972 This option is supported for compatibility with Sendmail, but has the same
5973 effect as <option>-oem</option>.
5975 </listitem></varlistentry>
5977 <term><option>-oi</option></term>
5980 <indexterm role="option">
5981 <primary><option>-oi</option></primary>
5983 <indexterm role="concept">
5984 <primary>dot</primary>
5985 <secondary>in incoming non-SMTP message</secondary>
5987 This option, which has the same effect as <option>-i</option>, specifies that a dot on a
5988 line by itself should not terminate an incoming, non-SMTP message. Otherwise, a
5989 single dot does terminate, though Exim does no special processing for other
5990 lines that start with a dot. This option is set by default if Exim is called as
5991 <emphasis>rmail</emphasis>. See also <option>-ti</option>.
5993 </listitem></varlistentry>
5995 <term><option>-oitrue</option></term>
5998 <indexterm role="option">
5999 <primary><option>-oitrue</option></primary>
6001 This option is treated as synonymous with <option>-oi</option>.
6003 </listitem></varlistentry>
6005 <term><option>-oMa</option> <<emphasis>host address</emphasis>></term>
6008 <indexterm role="option">
6009 <primary><option>-oMa</option></primary>
6011 <indexterm role="concept">
6012 <primary>sender</primary>
6013 <secondary>host address, specifying for local message</secondary>
6015 A number of options starting with <option>-oM</option> can be used to set values associated
6016 with remote hosts on locally-submitted messages (that is, messages not received
6017 over TCP/IP). These options can be used by any caller in conjunction with the
6018 <option>-bh</option>, <option>-be</option>, <option>-bf</option>, <option>-bF</option>, <option>-bt</option>, or <option>-bv</option> testing options. In
6019 other circumstances, they are ignored unless the caller is trusted.
6022 The <option>-oMa</option> option sets the sender host address. This may include a port
6023 number at the end, after a full stop (period). For example:
6025 <literallayout class="monospaced">
6026 exim -bs -oMa 10.9.8.7.1234
6029 An alternative syntax is to enclose the IP address in square brackets,
6030 followed by a colon and the port number:
6032 <literallayout class="monospaced">
6033 exim -bs -oMa [10.9.8.7]:1234
6036 The IP address is placed in the <varname>$sender_host_address</varname> variable, and the
6037 port, if present, in <varname>$sender_host_port</varname>. If both <option>-oMa</option> and <option>-bh</option>
6038 are present on the command line, the sender host IP address is taken from
6039 whichever one is last.
6041 </listitem></varlistentry>
6043 <term><option>-oMaa</option> <<emphasis>name</emphasis>></term>
6046 <indexterm role="option">
6047 <primary><option>-oMaa</option></primary>
6049 <indexterm role="concept">
6050 <primary>authentication</primary>
6051 <secondary>name, specifying for local message</secondary>
6053 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMaa</option>
6054 option sets the value of <varname>$sender_host_authenticated</varname> (the authenticator
6055 name). See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of SMTP authentication.
6056 This option can be used with <option>-bh</option> and <option>-bs</option> to set up an
6057 authenticated SMTP session without actually using the SMTP AUTH command.
6059 </listitem></varlistentry>
6061 <term><option>-oMai</option> <<emphasis>string</emphasis>></term>
6064 <indexterm role="option">
6065 <primary><option>-oMai</option></primary>
6067 <indexterm role="concept">
6068 <primary>authentication</primary>
6069 <secondary>id, specifying for local message</secondary>
6071 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMai</option>
6072 option sets the value of <varname>$authenticated_id</varname> (the id that was authenticated).
6073 This overrides the default value (the caller’s login id, except with <option>-bh</option>,
6074 where there is no default) for messages from local sources. See chapter
6075 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated ids.
6077 </listitem></varlistentry>
6079 <term><option>-oMas</option> <<emphasis>address</emphasis>></term>
6082 <indexterm role="option">
6083 <primary><option>-oMas</option></primary>
6085 <indexterm role="concept">
6086 <primary>authentication</primary>
6087 <secondary>sender, specifying for local message</secondary>
6089 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMas</option>
6090 option sets the authenticated sender value in <varname>$authenticated_sender</varname>. It
6091 overrides the sender address that is created from the caller’s login id for
6092 messages from local sources, except when <option>-bh</option> is used, when there is no
6093 default. For both <option>-bh</option> and <option>-bs</option>, an authenticated sender that is
6094 specified on a MAIL command overrides this value. See chapter
6095 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated senders.
6097 </listitem></varlistentry>
6099 <term><option>-oMi</option> <<emphasis>interface address</emphasis>></term>
6102 <indexterm role="option">
6103 <primary><option>-oMi</option></primary>
6105 <indexterm role="concept">
6106 <primary>interface</primary>
6107 <secondary>address, specifying for local message</secondary>
6109 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMi</option>
6110 option sets the IP interface address value. A port number may be included,
6111 using the same syntax as for <option>-oMa</option>. The interface address is placed in
6112 <varname>$received_ip_address</varname> and the port number, if present, in <varname>$received_port</varname>.
6114 </listitem></varlistentry>
6116 <term><option>-oMr</option> <<emphasis>protocol name</emphasis>></term>
6119 <indexterm role="option">
6120 <primary><option>-oMr</option></primary>
6122 <indexterm role="concept">
6123 <primary>protocol, specifying for local message</primary>
6125 <indexterm role="variable">
6126 <primary><varname>$received_protocol</varname></primary>
6128 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMr</option>
6129 option sets the received protocol value that is stored in
6130 <varname>$received_protocol</varname>. However, it does not apply (and is ignored) when <option>-bh</option>
6131 or <option>-bs</option> is used. For <option>-bh</option>, the protocol is forced to one of the standard
6132 SMTP protocol names (see the description of <varname>$received_protocol</varname> in section
6133 <xref linkend="SECTexpvar"/>). For <option>-bs</option>, the protocol is always <quote>local-</quote> followed by
6134 one of those same names. For <option>-bS</option> (batched SMTP) however, the protocol can
6135 be set by <option>-oMr</option>.
6137 </listitem></varlistentry>
6139 <term><option>-oMs</option> <<emphasis>host name</emphasis>></term>
6142 <indexterm role="option">
6143 <primary><option>-oMs</option></primary>
6145 <indexterm role="concept">
6146 <primary>sender</primary>
6147 <secondary>host name, specifying for local message</secondary>
6149 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMs</option>
6150 option sets the sender host name in <varname>$sender_host_name</varname>. When this option is
6151 present, Exim does not attempt to look up a host name from an IP address; it
6152 uses the name it is given.
6154 </listitem></varlistentry>
6156 <term><option>-oMt</option> <<emphasis>ident string</emphasis>></term>
6159 <indexterm role="option">
6160 <primary><option>-oMt</option></primary>
6162 <indexterm role="concept">
6163 <primary>sender</primary>
6164 <secondary>ident string, specifying for local message</secondary>
6166 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMt</option>
6167 option sets the sender ident value in <varname>$sender_ident</varname>. The default setting for
6168 local callers is the login id of the calling process, except when <option>-bh</option> is
6169 used, when there is no default.
6171 </listitem></varlistentry>
6173 <term><option>-om</option></term>
6176 <indexterm role="option">
6177 <primary><option>-om</option></primary>
6179 <indexterm role="concept">
6180 <primary>Sendmail compatibility</primary>
6181 <secondary><option>-om</option> option ignored</secondary>
6183 In Sendmail, this option means <quote>me too</quote>, indicating that the sender of a
6184 message should receive a copy of the message if the sender appears in an alias
6185 expansion. Exim always does this, so the option does nothing.
6187 </listitem></varlistentry>
6189 <term><option>-oo</option></term>
6192 <indexterm role="option">
6193 <primary><option>-oo</option></primary>
6195 <indexterm role="concept">
6196 <primary>Sendmail compatibility</primary>
6197 <secondary><option>-oo</option> option ignored</secondary>
6199 This option is ignored. In Sendmail it specifies <quote>old style headers</quote>,
6200 whatever that means.
6202 </listitem></varlistentry>
6204 <term><option>-oP</option> <<emphasis>path</emphasis>></term>
6207 <indexterm role="option">
6208 <primary><option>-oP</option></primary>
6210 <indexterm role="concept">
6211 <primary>pid (process id)</primary>
6212 <secondary>of daemon</secondary>
6214 <indexterm role="concept">
6215 <primary>daemon</primary>
6216 <secondary>process id (pid)</secondary>
6218 This option is useful only in conjunction with <option>-bd</option> or <option>-q</option> with a time
6219 value. The option specifies the file to which the process id of the daemon is
6220 written. When <option>-oX</option> is used with <option>-bd</option>, or when <option>-q</option> with a time is used
6221 without <option>-bd</option>, this is the only way of causing Exim to write a pid file,
6222 because in those cases, the normal pid file is not used.
6224 </listitem></varlistentry>
6226 <term><option>-or</option> <<emphasis>time</emphasis>></term>
6229 <indexterm role="option">
6230 <primary><option>-or</option></primary>
6232 <indexterm role="concept">
6233 <primary>timeout</primary>
6234 <secondary>for non-SMTP input</secondary>
6236 This option sets a timeout value for incoming non-SMTP messages. If it is not
6237 set, Exim will wait forever for the standard input. The value can also be set
6238 by the <option>receive_timeout</option> option. The format used for specifying times is
6239 described in section <xref linkend="SECTtimeformat"/>.
6241 </listitem></varlistentry>
6243 <term><option>-os</option> <<emphasis>time</emphasis>></term>
6246 <indexterm role="option">
6247 <primary><option>-os</option></primary>
6249 <indexterm role="concept">
6250 <primary>timeout</primary>
6251 <secondary>for SMTP input</secondary>
6253 <indexterm role="concept">
6254 <primary>SMTP</primary>
6255 <secondary>input timeout</secondary>
6257 This option sets a timeout value for incoming SMTP messages. The timeout
6258 applies to each SMTP command and block of data. The value can also be set by
6259 the <option>smtp_receive_timeout</option> option; it defaults to 5 minutes. The format used
6260 for specifying times is described in section <xref linkend="SECTtimeformat"/>.
6262 </listitem></varlistentry>
6264 <term><option>-ov</option></term>
6267 <indexterm role="option">
6268 <primary><option>-ov</option></primary>
6270 This option has exactly the same effect as <option>-v</option>.
6272 </listitem></varlistentry>
6274 <term><option>-oX</option> <<emphasis>number or string</emphasis>></term>
6277 <indexterm role="option">
6278 <primary><option>-oX</option></primary>
6280 <indexterm role="concept">
6281 <primary>TCP/IP</primary>
6282 <secondary>setting listening ports</secondary>
6284 <indexterm role="concept">
6285 <primary>TCP/IP</primary>
6286 <secondary>setting listening interfaces</secondary>
6288 <indexterm role="concept">
6289 <primary>port</primary>
6290 <secondary>receiving TCP/IP</secondary>
6292 This option is relevant only when the <option>-bd</option> (start listening daemon) option
6293 is also given. It controls which ports and interfaces the daemon uses. Details
6294 of the syntax, and how it interacts with configuration file options, are given
6295 in chapter <xref linkend="CHAPinterfaces"/>. When <option>-oX</option> is used to start a daemon, no pid
6296 file is written unless <option>-oP</option> is also present to specify a pid file name.
6298 </listitem></varlistentry>
6300 <term><option>-pd</option></term>
6303 <indexterm role="option">
6304 <primary><option>-pd</option></primary>
6306 <indexterm role="concept">
6307 <primary>Perl</primary>
6308 <secondary>starting the interpreter</secondary>
6310 This option applies when an embedded Perl interpreter is linked with Exim (see
6311 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6312 option, forcing the starting of the interpreter to be delayed until it is
6315 </listitem></varlistentry>
6317 <term><option>-ps</option></term>
6320 <indexterm role="option">
6321 <primary><option>-ps</option></primary>
6323 <indexterm role="concept">
6324 <primary>Perl</primary>
6325 <secondary>starting the interpreter</secondary>
6327 This option applies when an embedded Perl interpreter is linked with Exim (see
6328 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6329 option, forcing the starting of the interpreter to occur as soon as Exim is
6332 </listitem></varlistentry>
6334 <term><option>-p</option><<emphasis>rval</emphasis>>:<<emphasis>sval</emphasis>></term>
6337 <indexterm role="option">
6338 <primary><option>-p</option></primary>
6340 For compatibility with Sendmail, this option is equivalent to
6343 <literal>-oMr</literal> <<emphasis>rval</emphasis>> <literal>-oMs</literal> <<emphasis>sval</emphasis>>
6346 It sets the incoming protocol and host name (for trusted callers). The
6347 host name and its colon can be omitted when only the protocol is to be set.
6348 Note the Exim already has two private options, <option>-pd</option> and <option>-ps</option>, that refer
6349 to embedded Perl. It is therefore impossible to set a protocol value of <literal>p</literal>
6350 or <literal>s</literal> using this option (but that does not seem a real limitation).
6352 </listitem></varlistentry>
6354 <term><option>-q</option></term>
6357 <indexterm role="option">
6358 <primary><option>-q</option></primary>
6360 <indexterm role="concept">
6361 <primary>queue runner</primary>
6362 <secondary>starting manually</secondary>
6364 This option is normally restricted to admin users. However, there is a
6365 configuration option called <option>prod_requires_admin</option> which can be set false to
6366 relax this restriction (and also the same requirement for the <option>-M</option>, <option>-R</option>,
6367 and <option>-S</option> options).
6370 <indexterm role="concept">
6371 <primary>queue runner</primary>
6372 <secondary>description of operation</secondary>
6374 The <option>-q</option> option starts one queue runner process. This scans the queue of
6375 waiting messages, and runs a delivery process for each one in turn. It waits
6376 for each delivery process to finish before starting the next one. A delivery
6377 process may not actually do any deliveries if the retry times for the addresses
6378 have not been reached. Use <option>-qf</option> (see below) if you want to override this.
6382 <indexterm role="concept">
6383 <primary>SMTP</primary>
6384 <secondary>passed connection</secondary>
6386 <indexterm role="concept">
6387 <primary>SMTP</primary>
6388 <secondary>multiple deliveries</secondary>
6390 <indexterm role="concept">
6391 <primary>multiple SMTP deliveries</primary>
6393 the delivery process spawns other processes to deliver other messages down
6394 passed SMTP connections, the queue runner waits for these to finish before
6398 When all the queued messages have been considered, the original queue runner
6399 process terminates. In other words, a single pass is made over the waiting
6400 mail, one message at a time. Use <option>-q</option> with a time (see below) if you want
6401 this to be repeated periodically.
6404 Exim processes the waiting messages in an unpredictable order. It isn’t very
6405 random, but it is likely to be different each time, which is all that matters.
6406 If one particular message screws up a remote MTA, other messages to the same
6407 MTA have a chance of getting through if they get tried first.
6410 It is possible to cause the messages to be processed in lexical message id
6411 order, which is essentially the order in which they arrived, by setting the
6412 <option>queue_run_in_order</option> option, but this is not recommended for normal use.
6414 </listitem></varlistentry>
6416 <term><option>-q</option><<emphasis>qflags</emphasis>></term>
6419 The <option>-q</option> option may be followed by one or more flag letters that change its
6420 behaviour. They are all optional, but if more than one is present, they must
6421 appear in the correct order. Each flag is described in a separate item below.
6423 </listitem></varlistentry>
6425 <term><option>-qq...</option></term>
6428 <indexterm role="option">
6429 <primary><option>-qq</option></primary>
6431 <indexterm role="concept">
6432 <primary>queue</primary>
6433 <secondary>double scanning</secondary>
6435 <indexterm role="concept">
6436 <primary>queue</primary>
6437 <secondary>routing</secondary>
6439 <indexterm role="concept">
6440 <primary>routing</primary>
6441 <secondary>whole queue before delivery</secondary>
6443 An option starting with <option>-qq</option> requests a two-stage queue run. In the first
6444 stage, the queue is scanned as if the <option>queue_smtp_domains</option> option matched
6445 every domain. Addresses are routed, local deliveries happen, but no remote
6449 <indexterm role="concept">
6450 <primary>hints database</primary>
6451 <secondary>remembering routing</secondary>
6453 The hints database that remembers which messages are waiting for specific hosts
6454 is updated, as if delivery to those hosts had been deferred. After this is
6455 complete, a second, normal queue scan happens, with routing and delivery taking
6456 place as normal. Messages that are routed to the same host should mostly be
6457 delivered down a single SMTP
6458 <indexterm role="concept">
6459 <primary>SMTP</primary>
6460 <secondary>passed connection</secondary>
6462 <indexterm role="concept">
6463 <primary>SMTP</primary>
6464 <secondary>multiple deliveries</secondary>
6466 <indexterm role="concept">
6467 <primary>multiple SMTP deliveries</primary>
6469 connection because of the hints that were set up during the first queue scan.
6470 This option may be useful for hosts that are connected to the Internet
6473 </listitem></varlistentry>
6475 <term><option>-q[q]i...</option></term>
6478 <indexterm role="option">
6479 <primary><option>-qi</option></primary>
6481 <indexterm role="concept">
6482 <primary>queue</primary>
6483 <secondary>initial delivery</secondary>
6485 If the <emphasis>i</emphasis> flag is present, the queue runner runs delivery processes only for
6486 those messages that haven’t previously been tried. (<emphasis>i</emphasis> stands for <quote>initial
6487 delivery</quote>.) This can be helpful if you are putting messages on the queue using
6488 <option>-odq</option> and want a queue runner just to process the new messages.
6490 </listitem></varlistentry>
6492 <term><option>-q[q][i]f...</option></term>
6495 <indexterm role="option">
6496 <primary><option>-qf</option></primary>
6498 <indexterm role="concept">
6499 <primary>queue</primary>
6500 <secondary>forcing delivery</secondary>
6502 <indexterm role="concept">
6503 <primary>delivery</primary>
6504 <secondary>forcing in queue run</secondary>
6506 If one <emphasis>f</emphasis> flag is present, a delivery attempt is forced for each non-frozen
6507 message, whereas without <emphasis>f</emphasis> only those non-frozen addresses that have passed
6508 their retry times are tried.
6510 </listitem></varlistentry>
6512 <term><option>-q[q][i]ff...</option></term>
6515 <indexterm role="option">
6516 <primary><option>-qff</option></primary>
6518 <indexterm role="concept">
6519 <primary>frozen messages</primary>
6520 <secondary>forcing delivery</secondary>
6522 If <emphasis>ff</emphasis> is present, a delivery attempt is forced for every message, whether
6525 </listitem></varlistentry>
6527 <term><option>-q[q][i][f[f]]l</option></term>
6530 <indexterm role="option">
6531 <primary><option>-ql</option></primary>
6533 <indexterm role="concept">
6534 <primary>queue</primary>
6535 <secondary>local deliveries only</secondary>
6537 The <emphasis>l</emphasis> (the letter <quote>ell</quote>) flag specifies that only local deliveries are to
6538 be done. If a message requires any remote deliveries, it remains on the queue
6541 </listitem></varlistentry>
6543 <term><option>-q</option><<emphasis>qflags</emphasis>> <<emphasis>start id</emphasis>> <<emphasis>end id</emphasis>></term>
6546 <indexterm role="concept">
6547 <primary>queue</primary>
6548 <secondary>delivering specific messages</secondary>
6550 When scanning the queue, Exim can be made to skip over messages whose ids are
6551 lexically less than a given value by following the <option>-q</option> option with a
6552 starting message id. For example:
6554 <literallayout class="monospaced">
6555 exim -q 0t5C6f-0000c8-00
6558 Messages that arrived earlier than <literal>0t5C6f-0000c8-00</literal> are not inspected. If a
6559 second message id is given, messages whose ids are lexically greater than it
6560 are also skipped. If the same id is given twice, for example,
6562 <literallayout class="monospaced">
6563 exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00
6566 just one delivery process is started, for that message. This differs from
6567 <option>-M</option> in that retry data is respected, and it also differs from <option>-Mc</option> in
6568 that it counts as a delivery from a queue run. Note that the selection
6569 mechanism does not affect the order in which the messages are scanned. There
6570 are also other ways of selecting specific sets of messages for delivery in a
6571 queue run – see <option>-R</option> and <option>-S</option>.
6573 </listitem></varlistentry>
6575 <term><option>-q</option><<emphasis>qflags</emphasis>><<emphasis>time</emphasis>></term>
6578 <indexterm role="concept">
6579 <primary>queue runner</primary>
6580 <secondary>starting periodically</secondary>
6582 <indexterm role="concept">
6583 <primary>periodic queue running</primary>
6585 When a time value is present, the <option>-q</option> option causes Exim to run as a daemon,
6586 starting a queue runner process at intervals specified by the given time value
6587 (whose format is described in section <xref linkend="SECTtimeformat"/>). This form of the
6588 <option>-q</option> option is commonly combined with the <option>-bd</option> option, in which case a
6589 single daemon process handles both functions. A common way of starting up a
6590 combined daemon at system boot time is to use a command such as
6592 <literallayout class="monospaced">
6593 /usr/exim/bin/exim -bd -q30m
6596 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
6597 process every 30 minutes.
6600 When a daemon is started by <option>-q</option> with a time value, but without <option>-bd</option>, no
6601 pid file is written unless one is explicitly requested by the <option>-oP</option> option.
6603 </listitem></varlistentry>
6605 <term><option>-qR</option><<emphasis>rsflags</emphasis>> <<emphasis>string</emphasis>></term>
6608 <indexterm role="option">
6609 <primary><option>-qR</option></primary>
6611 This option is synonymous with <option>-R</option>. It is provided for Sendmail
6614 </listitem></varlistentry>
6616 <term><option>-qS</option><<emphasis>rsflags</emphasis>> <<emphasis>string</emphasis>></term>
6619 <indexterm role="option">
6620 <primary><option>-qS</option></primary>
6622 This option is synonymous with <option>-S</option>.
6624 </listitem></varlistentry>
6626 <term><option>-R</option><<emphasis>rsflags</emphasis>> <<emphasis>string</emphasis>></term>
6629 <indexterm role="option">
6630 <primary><option>-R</option></primary>
6632 <indexterm role="concept">
6633 <primary>queue runner</primary>
6634 <secondary>for specific recipients</secondary>
6636 <indexterm role="concept">
6637 <primary>delivery</primary>
6638 <secondary>to given domain</secondary>
6640 <indexterm role="concept">
6641 <primary>domain</primary>
6642 <secondary>delivery to</secondary>
6644 The <<emphasis>rsflags</emphasis>> may be empty, in which case the white space before the string
6645 is optional, unless the string is <emphasis>f</emphasis>, <emphasis>ff</emphasis>, <emphasis>r</emphasis>, <emphasis>rf</emphasis>, or <emphasis>rff</emphasis>,
6646 which are the possible values for <<emphasis>rsflags</emphasis>>. White space is required if
6647 <<emphasis>rsflags</emphasis>> is not empty.
6650 This option is similar to <option>-q</option> with no time value, that is, it causes Exim to
6651 perform a single queue run, except that, when scanning the messages on the
6652 queue, Exim processes only those that have at least one undelivered recipient
6653 address containing the given string, which is checked in a case-independent
6654 way. If the <<emphasis>rsflags</emphasis>> start with <emphasis>r</emphasis>, <<emphasis>string</emphasis>> is interpreted as a
6655 regular expression; otherwise it is a literal string.
6658 If you want to do periodic queue runs for messages with specific recipients,
6659 you can combine <option>-R</option> with <option>-q</option> and a time value. For example:
6661 <literallayout class="monospaced">
6662 exim -q25m -R @special.domain.example
6665 This example does a queue run for messages with recipients in the given domain
6666 every 25 minutes. Any additional flags that are specified with <option>-q</option> are
6667 applied to each queue run.
6670 Once a message is selected for delivery by this mechanism, all its addresses
6671 are processed. For the first selected message, Exim overrides any retry
6672 information and forces a delivery attempt for each undelivered address. This
6673 means that if delivery of any address in the first message is successful, any
6674 existing retry information is deleted, and so delivery attempts for that
6675 address in subsequently selected messages (which are processed without forcing)
6676 will run. However, if delivery of any address does not succeed, the retry
6677 information is updated, and in subsequently selected messages, the failing
6678 address will be skipped.
6681 <indexterm role="concept">
6682 <primary>frozen messages</primary>
6683 <secondary>forcing delivery</secondary>
6685 If the <<emphasis>rsflags</emphasis>> contain <emphasis>f</emphasis> or <emphasis>ff</emphasis>, the delivery forcing applies to
6686 all selected messages, not just the first; frozen messages are included when
6687 <emphasis>ff</emphasis> is present.
6690 The <option>-R</option> option makes it straightforward to initiate delivery of all messages
6691 to a given domain after a host has been down for some time. When the SMTP
6692 command ETRN is accepted by its ACL (see chapter <xref linkend="CHAPACL"/>), its default
6693 effect is to run Exim with the <option>-R</option> option, but it can be configured to run
6694 an arbitrary command instead.
6696 </listitem></varlistentry>
6698 <term><option>-r</option></term>
6701 <indexterm role="option">
6702 <primary><option>-r</option></primary>
6704 This is a documented (for Sendmail) obsolete alternative name for <option>-f</option>.
6706 </listitem></varlistentry>
6708 <term><option>-S</option><<emphasis>rsflags</emphasis>> <<emphasis>string</emphasis>></term>
6711 <indexterm role="option">
6712 <primary><option>-S</option></primary>
6714 <indexterm role="concept">
6715 <primary>delivery</primary>
6716 <secondary>from given sender</secondary>
6718 <indexterm role="concept">
6719 <primary>queue runner</primary>
6720 <secondary>for specific senders</secondary>
6722 This option acts like <option>-R</option> except that it checks the string against each
6723 message’s sender instead of against the recipients. If <option>-R</option> is also set, both
6724 conditions must be met for a message to be selected. If either of the options
6725 has <emphasis>f</emphasis> or <emphasis>ff</emphasis> in its flags, the associated action is taken.
6727 </listitem></varlistentry>
6729 <term><option>-Tqt</option> <<emphasis>times</emphasis>></term>
6732 <indexterm role="option">
6733 <primary><option>-Tqt</option></primary>
6735 This an option that is exclusively for use by the Exim testing suite. It is not
6736 recognized when Exim is run normally. It allows for the setting up of explicit
6737 <quote>queue times</quote> so that various warning/retry features can be tested.
6739 </listitem></varlistentry>
6741 <term><option>-t</option></term>
6744 <indexterm role="option">
6745 <primary><option>-t</option></primary>
6747 <indexterm role="concept">
6748 <primary>recipient</primary>
6749 <secondary>extracting from header lines</secondary>
6751 <indexterm role="concept">
6752 <primary><emphasis>Bcc:</emphasis> header line</primary>
6754 <indexterm role="concept">
6755 <primary><emphasis>Cc:</emphasis> header line</primary>
6757 <indexterm role="concept">
6758 <primary><emphasis>To:</emphasis> header line</primary>
6760 When Exim is receiving a locally-generated, non-SMTP message on its standard
6761 input, the <option>-t</option> option causes the recipients of the message to be obtained
6762 from the <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis> header lines in the message instead of
6763 from the command arguments. The addresses are extracted before any rewriting
6764 takes place and the <emphasis>Bcc:</emphasis> header line, if present, is then removed.
6767 <indexterm role="concept">
6768 <primary>Sendmail compatibility</primary>
6769 <secondary><option>-t</option> option</secondary>
6771 If the command has any arguments, they specify addresses to which the message
6772 is <emphasis>not</emphasis> to be delivered. That is, the argument addresses are removed from
6773 the recipients list obtained from the headers. This is compatible with Smail 3
6774 and in accordance with the documented behaviour of several versions of
6775 Sendmail, as described in man pages on a number of operating systems (e.g.
6776 Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail <emphasis>add</emphasis>
6777 argument addresses to those obtained from the headers, and the O’Reilly
6778 Sendmail book documents it that way. Exim can be made to add argument addresses
6779 instead of subtracting them by setting the option
6780 <option>extract_addresses_remove_arguments</option> false.
6783 <indexterm role="concept">
6784 <primary><option>Resent-</option> header lines</primary>
6785 <secondary>with <option>-t</option></secondary>
6787 If there are any <option>Resent-</option> header lines in the message, Exim extracts
6788 recipients from all <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>, and <emphasis>Resent-Bcc:</emphasis> header
6789 lines instead of from <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis>. This is for compatibility
6790 with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if
6791 <option>-t</option> was used in conjunction with <option>Resent-</option> header lines.)
6794 RFC 2822 talks about different sets of <option>Resent-</option> header lines (for when a
6795 message is resent several times). The RFC also specifies that they should be
6796 added at the front of the message, and separated by <emphasis>Received:</emphasis> lines. It is
6797 not at all clear how <option>-t</option> should operate in the present of multiple sets,
6798 nor indeed exactly what constitutes a <quote>set</quote>.
6799 In practice, it seems that MUAs do not follow the RFC. The <option>Resent-</option> lines
6800 are often added at the end of the header, and if a message is resent more than
6801 once, it is common for the original set of <option>Resent-</option> headers to be renamed as
6802 <option>X-Resent-</option> when a new set is added. This removes any possible ambiguity.
6804 </listitem></varlistentry>
6806 <term><option>-ti</option></term>
6809 <indexterm role="option">
6810 <primary><option>-ti</option></primary>
6812 This option is exactly equivalent to <option>-t</option> <option>-i</option>. It is provided for
6813 compatibility with Sendmail.
6815 </listitem></varlistentry>
6817 <term><option>-tls-on-connect</option></term>
6820 <indexterm role="option">
6821 <primary><option>-tls-on-connect</option></primary>
6823 <indexterm role="concept">
6824 <primary>TLS</primary>
6825 <secondary>use without STARTTLS</secondary>
6827 <indexterm role="concept">
6828 <primary>TLS</primary>
6829 <secondary>automatic start</secondary>
6831 This option is available when Exim is compiled with TLS support. It forces all
6832 incoming SMTP connections to behave as if the incoming port is listed in the
6833 <option>tls_on_connect_ports</option> option. See section <xref linkend="SECTsupobssmt"/> and chapter
6834 <xref linkend="CHAPTLS"/> for further details.
6836 </listitem></varlistentry>
6838 <term><option>-U</option></term>
6841 <indexterm role="option">
6842 <primary><option>-U</option></primary>
6844 <indexterm role="concept">
6845 <primary>Sendmail compatibility</primary>
6846 <secondary><option>-U</option> option ignored</secondary>
6848 Sendmail uses this option for <quote>initial message submission</quote>, and its
6849 documentation states that in future releases, it may complain about
6850 syntactically invalid messages rather than fixing them when this flag is not
6851 set. Exim ignores this option.
6853 </listitem></varlistentry>
6855 <term><option>-v</option></term>
6858 <indexterm role="option">
6859 <primary><option>-v</option></primary>
6861 This option causes Exim to write information to the standard error stream,
6862 describing what it is doing. In particular, it shows the log lines for
6863 receiving and delivering a message, and if an SMTP connection is made, the SMTP
6864 dialogue is shown. Some of the log lines shown may not actually be written to
6865 the log if the setting of <option>log_selector</option> discards them. Any relevant
6866 selectors are shown with each log line. If none are shown, the logging is
6869 </listitem></varlistentry>
6871 <term><option>-x</option></term>
6874 <indexterm role="option">
6875 <primary><option>-x</option></primary>
6877 AIX uses <option>-x</option> for a private purpose (<quote>mail from a local mail program has
6878 National Language Support extended characters in the body of the mail item</quote>).
6879 It sets <option>-x</option> when calling the MTA from its <option>mail</option> command. Exim ignores
6882 </listitem></varlistentry>
6885 <indexterm role="concept" startref="IIDclo1" class="endofrange"/>
6886 <indexterm role="concept" startref="IIDclo2" class="endofrange"/>
6888 <!-- === End of command line options === -->
6892 <chapter id="CHAPconf">
6893 <title>The Exim run time configuration file</title>
6894 <titleabbrev>The runtime configuration file</titleabbrev>
6896 <indexterm role="concept">
6897 <primary>run time configuration</primary>
6899 <indexterm role="concept">
6900 <primary>configuration file</primary>
6901 <secondary>general description</secondary>
6903 <indexterm role="concept">
6904 <primary>CONFIGURE_FILE</primary>
6906 <indexterm role="concept">
6907 <primary>configuration file</primary>
6908 <secondary>errors in</secondary>
6910 <indexterm role="concept">
6911 <primary>error</primary>
6912 <secondary>in configuration file</secondary>
6914 <indexterm role="concept">
6915 <primary>return code</primary>
6916 <secondary>for bad configuration</secondary>
6918 Exim uses a single run time configuration file that is read whenever an Exim
6919 binary is executed. Note that in normal operation, this happens frequently,
6920 because Exim is designed to operate in a distributed manner, without central
6924 If a syntax error is detected while reading the configuration file, Exim
6925 writes a message on the standard error, and exits with a non-zero return code.
6926 The message is also written to the panic log. <emphasis role="bold">Note</emphasis>: Only simple syntax
6927 errors can be detected at this time. The values of any expanded options are
6928 not checked until the expansion happens, even when the expansion does not
6929 actually alter the string.
6932 The name of the configuration file is compiled into the binary for security
6933 reasons, and is specified by the CONFIGURE_FILE compilation option. In
6934 most configurations, this specifies a single file. However, it is permitted to
6935 give a colon-separated list of file names, in which case Exim uses the first
6936 existing file in the list.
6939 <indexterm role="concept">
6940 <primary>EXIM_USER</primary>
6942 <indexterm role="concept">
6943 <primary>EXIM_GROUP</primary>
6945 <indexterm role="concept">
6946 <primary>CONFIGURE_OWNER</primary>
6948 <indexterm role="concept">
6949 <primary>CONFIGURE_GROUP</primary>
6951 <indexterm role="concept">
6952 <primary>configuration file</primary>
6953 <secondary>ownership</secondary>
6955 <indexterm role="concept">
6956 <primary>ownership</primary>
6957 <secondary>configuration file</secondary>
6959 The run time configuration file must be owned by root or by the user that is
6960 specified at compile time by the EXIM_USER option, or by the user that is
6961 specified at compile time by the CONFIGURE_OWNER option (if set). The
6962 configuration file must not be world-writeable or group-writeable, unless its
6963 group is the one specified at compile time by the EXIM_GROUP option or by the
6964 CONFIGURE_GROUP option.
6967 <emphasis role="bold">Warning</emphasis>: In a conventional configuration, where the Exim binary is setuid
6968 to root, anybody who is able to edit the run time configuration file has an
6969 easy way to run commands as root. If you make your mail administrators members
6970 of the Exim group, but do not trust them with root, make sure that the run time
6971 configuration is not group writeable.
6974 A default configuration file, which will work correctly in simple situations,
6975 is provided in the file <filename>src/configure.default</filename>. If CONFIGURE_FILE
6976 defines just one file name, the installation process copies the default
6977 configuration to a new file of that name if it did not previously exist. If
6978 CONFIGURE_FILE is a list, no default is automatically installed. Chapter
6979 <xref linkend="CHAPdefconfil"/> is a <quote>walk-through</quote> discussion of the default
6982 <section id="SECID40">
6983 <title>Using a different configuration file</title>
6985 <indexterm role="concept">
6986 <primary>configuration file</primary>
6987 <secondary>alternate</secondary>
6989 A one-off alternate configuration can be specified by the <option>-C</option> command line
6990 option, which may specify a single file or a list of files. However, when
6991 <option>-C</option> is used, Exim gives up its root privilege, unless called by root or the
6992 Exim user (or unless the argument for <option>-C</option> is identical to the built-in value
6993 from CONFIGURE_FILE). <option>-C</option> is useful mainly for checking the syntax of
6994 configuration files before installing them. No owner or group checks are done
6995 on a configuration file specified by <option>-C</option>.
6998 The privileged use of <option>-C</option> by the Exim user can be locked out by setting
6999 ALT_CONFIG_ROOT_ONLY in <filename>Local/Makefile</filename> when building Exim. However,
7000 if you do this, you also lock out the possibility of testing a
7001 configuration using <option>-C</option> right through message reception and delivery, even
7002 if the caller is root. The reception works, but by that time, Exim is running
7003 as the Exim user, so when it re-execs to regain privilege for the delivery, the
7004 use of <option>-C</option> causes privilege to be lost. However, root can test reception and
7005 delivery using two separate commands (one to put a message on the queue, using
7006 <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
7009 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
7010 prefix string with which any file named in a <option>-C</option> command line option must
7011 start. In addition, the file name must not contain the sequence <quote><literal>/../</literal></quote>.
7012 There is no default setting for ALT_CONFIG_PREFIX; when it is unset, any file
7013 name can be used with <option>-C</option>.
7016 One-off changes to a configuration can be specified by the <option>-D</option> command line
7017 option, which defines and overrides values for macros used inside the
7018 configuration file. However, like <option>-C</option>, the use of this option by a
7019 non-privileged user causes Exim to discard its root privilege.
7020 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
7021 completely disabled, and its use causes an immediate error exit.
7024 Some sites may wish to use the same Exim binary on different machines that
7025 share a file system, but to use different configuration files on each machine.
7026 If CONFIGURE_FILE_USE_NODE is defined in <filename>Local/Makefile</filename>, Exim first
7027 looks for a file whose name is the configuration file name followed by a dot
7028 and the machine’s node name, as obtained from the <function>uname()</function> function. If this
7029 file does not exist, the standard name is tried. This processing occurs for
7030 each file name in the list given by CONFIGURE_FILE or <option>-C</option>.
7033 In some esoteric situations different versions of Exim may be run under
7034 different effective uids and the CONFIGURE_FILE_USE_EUID is defined to
7035 help with this. See the comments in <filename>src/EDITME</filename> for details.
7038 <section id="SECTconffilfor">
7039 <title>Configuration file format</title>
7041 <indexterm role="concept">
7042 <primary>configuration file</primary>
7043 <secondary>format of</secondary>
7045 <indexterm role="concept">
7046 <primary>format</primary>
7047 <secondary>configuration file</secondary>
7049 Exim’s configuration file is divided into a number of different parts. General
7050 option settings must always appear at the start of the file. The other parts
7051 are all optional, and may appear in any order. Each part other than the first
7052 is introduced by the word <quote>begin</quote> followed by the name of the part. The
7058 <emphasis>ACL</emphasis>: Access control lists for controlling incoming SMTP mail (see chapter
7059 <xref linkend="CHAPACL"/>).
7064 <indexterm role="concept">
7065 <primary>AUTH</primary>
7066 <secondary>configuration</secondary>
7068 <emphasis>authenticators</emphasis>: Configuration settings for the authenticator drivers. These
7069 are concerned with the SMTP AUTH command (see chapter <xref linkend="CHAPSMTPAUTH"/>).
7074 <emphasis>routers</emphasis>: Configuration settings for the router drivers. Routers process
7075 addresses and determine how the message is to be delivered (see chapters
7076 <xref linkend="CHAProutergeneric"/>–<xref linkend="CHAPredirect"/>).
7081 <emphasis>transports</emphasis>: Configuration settings for the transport drivers. Transports
7082 define mechanisms for copying messages to destinations (see chapters
7083 <xref linkend="CHAPtransportgeneric"/>–<xref linkend="CHAPsmtptrans"/>).
7088 <emphasis>retry</emphasis>: Retry rules, for use when a message cannot be delivered immediately.
7089 If there is no retry section, or if it is empty (that is, no retry rules are
7090 defined), Exim will not retry deliveries. In this situation, temporary errors
7091 are treated the same as permanent errors. Retry rules are discussed in chapter
7092 <xref linkend="CHAPretry"/>.
7097 <emphasis>rewrite</emphasis>: Global address rewriting rules, for use when a message arrives and
7098 when new addresses are generated during delivery. Rewriting is discussed in
7099 chapter <xref linkend="CHAPrewrite"/>.
7104 <emphasis>local_scan</emphasis>: Private options for the <function>local_scan()</function> function. If you
7105 want to use this feature, you must set
7107 <literallayout class="monospaced">
7108 LOCAL_SCAN_HAS_OPTIONS=yes
7111 in <filename>Local/Makefile</filename> before building Exim. Details of the <function>local_scan()</function>
7112 facility are given in chapter <xref linkend="CHAPlocalscan"/>.
7117 <indexterm role="concept">
7118 <primary>configuration file</primary>
7119 <secondary>leading white space in</secondary>
7121 <indexterm role="concept">
7122 <primary>configuration file</primary>
7123 <secondary>trailing white space in</secondary>
7125 <indexterm role="concept">
7126 <primary>white space</primary>
7127 <secondary>in configuration file</secondary>
7129 Leading and trailing white space in configuration lines is always ignored.
7132 Blank lines in the file, and lines starting with a # character (ignoring
7133 leading white space) are treated as comments and are ignored. <emphasis role="bold">Note</emphasis>: A
7134 # character other than at the beginning of a line is not treated specially,
7135 and does not introduce a comment.
7138 Any non-comment line can be continued by ending it with a backslash. Note that
7139 the general rule for white space means that trailing white space after the
7140 backslash and leading white space at the start of continuation
7141 lines is ignored. Comment lines beginning with # (but not empty lines) may
7142 appear in the middle of a sequence of continuation lines.
7145 A convenient way to create a configuration file is to start from the
7146 default, which is supplied in <filename>src/configure.default</filename>, and add, delete, or
7147 change settings as required.
7150 The ACLs, retry rules, and rewriting rules have their own syntax which is
7151 described in chapters <xref linkend="CHAPACL"/>, <xref linkend="CHAPretry"/>, and <xref linkend="CHAPrewrite"/>,
7152 respectively. The other parts of the configuration file have some syntactic
7153 items in common, and these are described below, from section <xref linkend="SECTcos"/>
7154 onwards. Before that, the inclusion, macro, and conditional facilities are
7158 <section id="SECID41">
7159 <title>File inclusions in the configuration file</title>
7161 <indexterm role="concept">
7162 <primary>inclusions in configuration file</primary>
7164 <indexterm role="concept">
7165 <primary>configuration file</primary>
7166 <secondary>including other files</secondary>
7168 <indexterm role="concept">
7169 <primary><literal>.include</literal> in configuration file</primary>
7171 <indexterm role="concept">
7172 <primary><literal>.include_if_exists</literal> in configuration file</primary>
7174 You can include other files inside Exim’s run time configuration file by
7178 <literal>.include</literal> <<emphasis>file name</emphasis>>
7179 <literal>.include_if_exists</literal> <<emphasis>file name</emphasis>>
7182 on a line by itself. Double quotes round the file name are optional. If you use
7183 the first form, a configuration error occurs if the file does not exist; the
7184 second form does nothing for non-existent files. In all cases, an absolute file
7188 Includes may be nested to any depth, but remember that Exim reads its
7189 configuration file often, so it is a good idea to keep them to a minimum.
7190 If you change the contents of an included file, you must HUP the daemon,
7191 because an included file is read only when the configuration itself is read.
7194 The processing of inclusions happens early, at a physical line level, so, like
7195 comment lines, an inclusion can be used in the middle of an option setting,
7198 <literallayout class="monospaced">
7199 hosts_lookup = a.b.c \
7203 Include processing happens after macro processing (see below). Its effect is to
7204 process the lines of the included file as if they occurred inline where the
7208 <section id="SECTmacrodefs">
7209 <title>Macros in the configuration file</title>
7211 <indexterm role="concept">
7212 <primary>macro</primary>
7213 <secondary>description of</secondary>
7215 <indexterm role="concept">
7216 <primary>configuration file</primary>
7217 <secondary>macros</secondary>
7219 If a line in the main part of the configuration (that is, before the first
7220 <quote>begin</quote> line) begins with an upper case letter, it is taken as a macro
7221 definition, and must be of the form
7224 <<emphasis>name</emphasis>> = <<emphasis>rest of line</emphasis>>
7227 The name must consist of letters, digits, and underscores, and need not all be
7228 in upper case, though that is recommended. The rest of the line, including any
7229 continuations, is the replacement text, and has leading and trailing white
7230 space removed. Quotes are not removed. The replacement text can never end with
7231 a backslash character, but this doesn’t seem to be a serious limitation.
7234 Macros may also be defined between router, transport, authenticator, or ACL
7235 definitions. They may not, however, be defined within an individual driver or
7236 ACL, or in the <option>local_scan</option>, retry, or rewrite sections of the configuration.
7239 <section id="SECID42">
7240 <title>Macro substitution</title>
7242 Once a macro is defined, all subsequent lines in the file (and any included
7243 files) are scanned for the macro name; if there are several macros, the line is
7244 scanned for each in turn, in the order in which the macros are defined. The
7245 replacement text is not re-scanned for the current macro, though it is scanned
7246 for subsequently defined macros. For this reason, a macro name may not contain
7247 the name of a previously defined macro as a substring. You could, for example,
7251 <literal>ABCD_XYZ = </literal><<emphasis>something</emphasis>>
7252 <literal>ABCD = </literal><<emphasis>something else</emphasis>>
7255 but putting the definitions in the opposite order would provoke a configuration
7256 error. Macro expansion is applied to individual physical lines from the file,
7257 before checking for line continuation or file inclusion (see above). If a line
7258 consists solely of a macro name, and the expansion of the macro is empty, the
7259 line is ignored. A macro at the start of a line may turn the line into a
7260 comment line or a <literal>.include</literal> line.
7263 <section id="SECID43">
7264 <title>Redefining macros</title>
7266 Once defined, the value of a macro can be redefined later in the configuration
7267 (or in an included file). Redefinition is specified by using <emphasis>==</emphasis> instead of
7268 <emphasis>=</emphasis>. For example:
7270 <literallayout class="monospaced">
7273 MAC == updated value
7276 Redefinition does not alter the order in which the macros are applied to the
7277 subsequent lines of the configuration file. It is still the same order in which
7278 the macros were originally defined. All that changes is the macro’s value.
7279 Redefinition makes it possible to accumulate values. For example:
7281 <literallayout class="monospaced">
7284 MAC == MAC and something added
7287 This can be helpful in situations where the configuration file is built
7288 from a number of other files.
7291 <section id="SECID44">
7292 <title>Overriding macro values</title>
7294 The values set for macros in the configuration file can be overridden by the
7295 <option>-D</option> command line option, but Exim gives up its root privilege when <option>-D</option> is
7296 used, unless called by root or the Exim user. A definition on the command line
7297 using the <option>-D</option> option causes all definitions and redefinitions within the
7301 <section id="SECID45">
7302 <title>Example of macro usage</title>
7304 As an example of macro usage, consider a configuration where aliases are looked
7305 up in a MySQL database. It helps to keep the file less cluttered if long
7306 strings such as SQL statements are defined separately as macros, for example:
7308 <literallayout class="monospaced">
7309 ALIAS_QUERY = select mailbox from user where \
7310 login='${quote_mysql:$local_part}';
7313 This can then be used in a <command>redirect</command> router setting like this:
7315 <literallayout class="monospaced">
7316 data = ${lookup mysql{ALIAS_QUERY}}
7319 In earlier versions of Exim macros were sometimes used for domain, host, or
7320 address lists. In Exim 4 these are handled better by named lists – see
7321 section <xref linkend="SECTnamedlists"/>.
7324 <section id="SECID46">
7325 <title>Conditional skips in the configuration file</title>
7327 <indexterm role="concept">
7328 <primary>configuration file</primary>
7329 <secondary>conditional skips</secondary>
7331 <indexterm role="concept">
7332 <primary><literal>.ifdef</literal></primary>
7334 You can use the directives <literal>.ifdef</literal>, <literal>.ifndef</literal>, <literal>.elifdef</literal>,
7335 <literal>.elifndef</literal>, <literal>.else</literal>, and <literal>.endif</literal> to dynamically include or exclude
7336 portions of the configuration file. The processing happens whenever the file is
7337 read (that is, when an Exim binary starts to run).
7340 The implementation is very simple. Instances of the first four directives must
7341 be followed by text that includes the names of one or macros. The condition
7342 that is tested is whether or not any macro substitution has taken place in the
7345 <literallayout class="monospaced">
7347 message_size_limit = 50M
7349 message_size_limit = 100M
7353 sets a message size limit of 50M if the macro <literal>AAA</literal> is defined, and 100M
7354 otherwise. If there is more than one macro named on the line, the condition
7355 is true if any of them are defined. That is, it is an <quote>or</quote> condition. To
7356 obtain an <quote>and</quote> condition, you need to use nested <literal>.ifdef</literal>s.
7359 Although you can use a macro expansion to generate one of these directives,
7360 it is not very useful, because the condition <quote>there was a macro substitution
7361 in this line</quote> will always be true.
7364 Text following <literal>.else</literal> and <literal>.endif</literal> is ignored, and can be used as comment
7365 to clarify complicated nestings.
7368 <section id="SECTcos">
7369 <title>Common option syntax</title>
7371 <indexterm role="concept">
7372 <primary>common option syntax</primary>
7374 <indexterm role="concept">
7375 <primary>syntax of common options</primary>
7377 <indexterm role="concept">
7378 <primary>configuration file</primary>
7379 <secondary>common option syntax</secondary>
7381 For the main set of options, driver options, and <function>local_scan()</function> options,
7382 each setting is on a line by itself, and starts with a name consisting of
7383 lower-case letters and underscores. Many options require a data value, and in
7384 these cases the name must be followed by an equals sign (with optional white
7385 space) and then the value. For example:
7387 <literallayout class="monospaced">
7388 qualify_domain = mydomain.example.com
7391 <indexterm role="concept">
7392 <primary>hiding configuration option values</primary>
7394 <indexterm role="concept">
7395 <primary>configuration options</primary>
7396 <secondary>hiding value of</secondary>
7398 <indexterm role="concept">
7399 <primary>options</primary>
7400 <secondary>hiding value of</secondary>
7402 Some option settings may contain sensitive data, for example, passwords for
7403 accessing databases. To stop non-admin users from using the <option>-bP</option> command
7404 line option to read these values, you can precede the option settings with the
7405 word <quote>hide</quote>. For example:
7407 <literallayout class="monospaced">
7408 hide mysql_servers = localhost/users/admin/secret-password
7411 For non-admin users, such options are displayed like this:
7413 <literallayout class="monospaced">
7414 mysql_servers = <value not displayable>
7417 If <quote>hide</quote> is used on a driver option, it hides the value of that option on
7418 all instances of the same driver.
7421 The following sections describe the syntax used for the different data types
7422 that are found in option settings.
7425 <section id="SECID47">
7426 <title>Boolean options</title>
7428 <indexterm role="concept">
7429 <primary>format</primary>
7430 <secondary>boolean</secondary>
7432 <indexterm role="concept">
7433 <primary>boolean configuration values</primary>
7435 <indexterm role="option">
7436 <primary><option>no_</option><emphasis>xxx</emphasis></primary>
7438 <indexterm role="option">
7439 <primary><option>not_</option><emphasis>xxx</emphasis></primary>
7441 Options whose type is given as boolean are on/off switches. There are two
7442 different ways of specifying such options: with and without a data value. If
7443 the option name is specified on its own without data, the switch is turned on;
7444 if it is preceded by <quote>no_</quote> or <quote>not_</quote> the switch is turned off. However,
7445 boolean options may be followed by an equals sign and one of the words
7446 <quote>true</quote>, <quote>false</quote>, <quote>yes</quote>, or <quote>no</quote>, as an alternative syntax. For example,
7447 the following two settings have exactly the same effect:
7449 <literallayout class="monospaced">
7454 The following two lines also have the same (opposite) effect:
7456 <literallayout class="monospaced">
7461 You can use whichever syntax you prefer.
7464 <section id="SECID48">
7465 <title>Integer values</title>
7467 <indexterm role="concept">
7468 <primary>integer configuration values</primary>
7470 <indexterm role="concept">
7471 <primary>format</primary>
7472 <secondary>integer</secondary>
7474 If an option’s type is given as <quote>integer</quote>, the value can be given in decimal,
7475 hexadecimal, or octal. If it starts with a digit greater than zero, a decimal
7476 number is assumed. Otherwise, it is treated as an octal number unless it starts
7477 with the characters <quote>0x</quote>, in which case the remainder is interpreted as a
7481 If an integer value is followed by the letter K, it is multiplied by 1024; if
7482 it is followed by the letter M, it is multiplied by 1024x1024. When the values
7483 of integer option settings are output, values which are an exact multiple of
7484 1024 or 1024x1024 are sometimes, but not always, printed using the letters K
7485 and M. The printing style is independent of the actual input format that was
7489 <section id="SECID49">
7490 <title>Octal integer values</title>
7492 <indexterm role="concept">
7493 <primary>integer format</primary>
7495 <indexterm role="concept">
7496 <primary>format</primary>
7497 <secondary>octal integer</secondary>
7499 If an option’s type is given as <quote>octal integer</quote>, its value is always
7500 interpreted as an octal number, whether or not it starts with the digit zero.
7501 Such options are always output in octal.
7504 <section id="SECID50">
7505 <title>Fixed point numbers</title>
7507 <indexterm role="concept">
7508 <primary>fixed point configuration values</primary>
7510 <indexterm role="concept">
7511 <primary>format</primary>
7512 <secondary>fixed point</secondary>
7514 If an option’s type is given as <quote>fixed-point</quote>, its value must be a decimal
7515 integer, optionally followed by a decimal point and up to three further digits.
7518 <section id="SECTtimeformat">
7519 <title>Time intervals</title>
7521 <indexterm role="concept">
7522 <primary>time interval</primary>
7523 <secondary>specifying in configuration</secondary>
7525 <indexterm role="concept">
7526 <primary>format</primary>
7527 <secondary>time interval</secondary>
7529 A time interval is specified as a sequence of numbers, each followed by one of
7530 the following letters, with no intervening white space:
7532 <informaltable frame="none">
7533 <tgroup cols="2" colsep="0" rowsep="0">
7534 <colspec colwidth="30pt" align="left"/>
7535 <colspec colwidth="254pt" align="left"/>
7538 <entry> <option>s</option></entry>
7539 <entry>seconds</entry>
7542 <entry> <option>m</option></entry>
7543 <entry>minutes</entry>
7546 <entry> <option>h</option></entry>
7547 <entry>hours</entry>
7550 <entry> <option>d</option></entry>
7554 <entry> <option>w</option></entry>
7555 <entry>weeks</entry>
7561 For example, <quote>3h50m</quote> specifies 3 hours and 50 minutes. The values of time
7562 intervals are output in the same format. Exim does not restrict the values; it
7563 is perfectly acceptable, for example, to specify <quote>90m</quote> instead of <quote>1h30m</quote>.
7566 <section id="SECTstrings">
7567 <title>String values</title>
7569 <indexterm role="concept">
7570 <primary>string</primary>
7571 <secondary>format of configuration values</secondary>
7573 <indexterm role="concept">
7574 <primary>format</primary>
7575 <secondary>string</secondary>
7577 If an option’s type is specified as <quote>string</quote>, the value can be specified with
7578 or without double-quotes. If it does not start with a double-quote, the value
7579 consists of the remainder of the line plus any continuation lines, starting at
7580 the first character after any leading white space, with trailing white space
7581 removed, and with no interpretation of the characters in the string. Because
7582 Exim removes comment lines (those beginning with #) at an early stage, they can
7583 appear in the middle of a multi-line string. The following two settings are
7584 therefore equivalent:
7586 <literallayout class="monospaced">
7587 trusted_users = uucp:mail
7588 trusted_users = uucp:\
7589 # This comment line is ignored
7593 <indexterm role="concept">
7594 <primary>string</primary>
7595 <secondary>quoted</secondary>
7597 <indexterm role="concept">
7598 <primary>escape characters in quoted strings</primary>
7600 If a string does start with a double-quote, it must end with a closing
7601 double-quote, and any backslash characters other than those used for line
7602 continuation are interpreted as escape characters, as follows:
7604 <informaltable frame="none">
7605 <tgroup cols="2" colsep="0" rowsep="0">
7606 <colspec colwidth="100pt" align="left"/>
7607 <colspec colwidth="254pt" align="left"/>
7610 <entry> <literal>\\</literal></entry>
7611 <entry>single backslash</entry>
7614 <entry> <literal>\n</literal></entry>
7615 <entry>newline</entry>
7618 <entry> <literal>\r</literal></entry>
7619 <entry>carriage return</entry>
7622 <entry> <literal>\t</literal></entry>
7626 <entry> <literal>\</literal><<emphasis>octal digits</emphasis>></entry>
7627 <entry>up to 3 octal digits specify one character</entry>
7630 <entry> <literal>\x</literal><<emphasis>hex digits</emphasis>></entry>
7631 <entry>up to 2 hexadecimal digits specify one character</entry>
7637 If a backslash is followed by some other character, including a double-quote
7638 character, that character replaces the pair.
7641 Quoting is necessary only if you want to make use of the backslash escapes to
7642 insert special characters, or if you need to specify a value with leading or
7643 trailing spaces. These cases are rare, so quoting is almost never needed in
7644 current versions of Exim. In versions of Exim before 3.14, quoting was required
7645 in order to continue lines, so you may come across older configuration files
7646 and examples that apparently quote unnecessarily.
7649 <section id="SECID51">
7650 <title>Expanded strings</title>
7652 <indexterm role="concept">
7653 <primary>expansion</primary>
7654 <secondary>definition of</secondary>
7656 Some strings in the configuration file are subjected to <emphasis>string expansion</emphasis>,
7657 by which means various parts of the string may be changed according to the
7658 circumstances (see chapter <xref linkend="CHAPexpand"/>). The input syntax for such strings
7659 is as just described; in particular, the handling of backslashes in quoted
7660 strings is done as part of the input process, before expansion takes place.
7661 However, backslash is also an escape character for the expander, so any
7662 backslashes that are required for that reason must be doubled if they are
7663 within a quoted configuration string.
7666 <section id="SECID52">
7667 <title>User and group names</title>
7669 <indexterm role="concept">
7670 <primary>user name</primary>
7671 <secondary>format of</secondary>
7673 <indexterm role="concept">
7674 <primary>format</primary>
7675 <secondary>user name</secondary>
7677 <indexterm role="concept">
7678 <primary>groups</primary>
7679 <secondary>name format</secondary>
7681 <indexterm role="concept">
7682 <primary>format</primary>
7683 <secondary>group name</secondary>
7685 User and group names are specified as strings, using the syntax described
7686 above, but the strings are interpreted specially. A user or group name must
7687 either consist entirely of digits, or be a name that can be looked up using the
7688 <function>getpwnam()</function> or <function>getgrnam()</function> function, as appropriate.
7691 <section id="SECTlistconstruct">
7692 <title>List construction</title>
7694 <indexterm role="concept">
7695 <primary>list</primary>
7696 <secondary>syntax of in configuration</secondary>
7698 <indexterm role="concept">
7699 <primary>format</primary>
7700 <secondary>list item in configuration</secondary>
7702 <indexterm role="concept">
7703 <primary>string</primary>
7704 <secondary>list, definition of</secondary>
7706 The data for some configuration options is a list of items, with colon as the
7707 default separator. Many of these options are shown with type <quote>string list</quote> in
7708 the descriptions later in this document. Others are listed as <quote>domain list</quote>,
7709 <quote>host list</quote>, <quote>address list</quote>, or <quote>local part list</quote>. Syntactically, they
7710 are all the same; however, those other than <quote>string list</quote> are subject to
7711 particular kinds of interpretation, as described in chapter
7712 <xref linkend="CHAPdomhosaddlists"/>.
7715 In all these cases, the entire list is treated as a single string as far as the
7716 input syntax is concerned. The <option>trusted_users</option> setting in section
7717 <xref linkend="SECTstrings"/> above is an example. If a colon is actually needed in an item
7718 in a list, it must be entered as two colons. Leading and trailing white space
7719 on each item in a list is ignored. This makes it possible to include items that
7720 start with a colon, and in particular, certain forms of IPv6 address. For
7723 <literallayout class="monospaced">
7724 local_interfaces = 127.0.0.1 : ::::1
7727 contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1.
7730 <emphasis role="bold">Note</emphasis>: Although leading and trailing white space is ignored in individual
7731 list items, it is not ignored when parsing the list. The space after the first
7732 colon in the example above is necessary. If it were not there, the list would
7733 be interpreted as the two items 127.0.0.1:: and 1.
7736 <section id="SECID53">
7737 <title>Changing list separators</title>
7739 <indexterm role="concept">
7740 <primary>list separator</primary>
7741 <secondary>changing</secondary>
7743 <indexterm role="concept">
7744 <primary>IPv6</primary>
7745 <secondary>addresses in lists</secondary>
7747 Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was
7748 introduced to allow the separator character to be changed. If a list begins
7749 with a left angle bracket, followed by any punctuation character, that
7750 character is used instead of colon as the list separator. For example, the list
7751 above can be rewritten to use a semicolon separator like this:
7753 <literallayout class="monospaced">
7754 local_interfaces = <; 127.0.0.1 ; ::1
7757 This facility applies to all lists, with the exception of the list in
7758 <option>log_file_path</option>. It is recommended that the use of non-colon separators be
7759 confined to circumstances where they really are needed.
7762 <indexterm role="concept">
7763 <primary>list separator</primary>
7764 <secondary>newline as</secondary>
7766 <indexterm role="concept">
7767 <primary>newline</primary>
7768 <secondary>as list separator</secondary>
7770 It is also possible to use newline and other control characters (those with
7771 code values less than 32, plus DEL) as separators in lists. Such separators
7772 must be provided literally at the time the list is processed. For options that
7773 are string-expanded, you can write the separator using a normal escape
7774 sequence. This will be processed by the expander before the string is
7775 interpreted as a list. For example, if a newline-separated list of domains is
7776 generated by a lookup, you can process it directly by a line such as this:
7778 <literallayout class="monospaced">
7779 domains = <\n ${lookup mysql{.....}}
7782 This avoids having to change the list separator in such data. You are unlikely
7783 to want to use a control character as a separator in an option that is not
7784 expanded, because the value is literal text. However, it can be done by giving
7785 the value in quotes. For example:
7787 <literallayout class="monospaced">
7788 local_interfaces = "<\n 127.0.0.1 \n ::1"
7791 Unlike printing character separators, which can be included in list items by
7792 doubling, it is not possible to include a control character as data when it is
7793 set as the separator. Two such characters in succession are interpreted as
7794 enclosing an empty list item.
7797 <section id="SECTempitelis">
7798 <title>Empty items in lists</title>
7800 <indexterm role="concept">
7801 <primary>list</primary>
7802 <secondary>empty item in</secondary>
7804 An empty item at the end of a list is always ignored. In other words, trailing
7805 separator characters are ignored. Thus, the list in
7807 <literallayout class="monospaced">
7808 senders = user@domain :
7811 contains only a single item. If you want to include an empty string as one item
7812 in a list, it must not be the last item. For example, this list contains three
7813 items, the second of which is empty:
7815 <literallayout class="monospaced">
7816 senders = user1@domain : : user2@domain
7819 <emphasis role="bold">Note</emphasis>: There must be white space between the two colons, as otherwise they
7820 are interpreted as representing a single colon data character (and the list
7821 would then contain just one item). If you want to specify a list that contains
7822 just one, empty item, you can do it as in this example:
7824 <literallayout class="monospaced">
7828 In this case, the first item is empty, and the second is discarded because it
7829 is at the end of the list.
7832 <section id="SECTfordricon">
7833 <title>Format of driver configurations</title>
7835 <indexterm role="concept">
7836 <primary>drivers</primary>
7837 <secondary>configuration format</secondary>
7839 There are separate parts in the configuration for defining routers, transports,
7840 and authenticators. In each part, you are defining a number of driver
7841 instances, each with its own set of options. Each driver instance is defined by
7842 a sequence of lines like this:
7845 <<emphasis>instance name</emphasis>>:
7846 <<emphasis>option</emphasis>>
7848 <<emphasis>option</emphasis>>
7851 In the following example, the instance name is <command>localuser</command>, and it is
7852 followed by three options settings:
7854 <literallayout class="monospaced">
7858 transport = local_delivery
7861 For each driver instance, you specify which Exim code module it uses – by the
7862 setting of the <option>driver</option> option – and (optionally) some configuration
7863 settings. For example, in the case of transports, if you want a transport to
7864 deliver with SMTP you would use the <command>smtp</command> driver; if you want to deliver to
7865 a local file you would use the <command>appendfile</command> driver. Each of the drivers is
7866 described in detail in its own separate chapter later in this manual.
7869 You can have several routers, transports, or authenticators that are based on
7870 the same underlying driver (each must have a different instance name).
7873 The order in which routers are defined is important, because addresses are
7874 passed to individual routers one by one, in order. The order in which
7875 transports are defined does not matter at all. The order in which
7876 authenticators are defined is used only when Exim, as a client, is searching
7877 them to find one that matches an authentication mechanism offered by the
7881 <indexterm role="concept">
7882 <primary>generic options</primary>
7884 <indexterm role="concept">
7885 <primary>options</primary>
7886 <secondary>generic – definition of</secondary>
7888 Within a driver instance definition, there are two kinds of option: <emphasis>generic</emphasis>
7889 and <emphasis>private</emphasis>. The generic options are those that apply to all drivers of the
7890 same type (that is, all routers, all transports or all authenticators). The
7891 <option>driver</option> option is a generic option that must appear in every definition.
7892 <indexterm role="concept">
7893 <primary>private options</primary>
7895 The private options are special for each driver, and none need appear, because
7896 they all have default values.
7899 The options may appear in any order, except that the <option>driver</option> option must
7900 precede any private options, since these depend on the particular driver. For
7901 this reason, it is recommended that <option>driver</option> always be the first option.
7904 Driver instance names, which are used for reference in log entries and
7905 elsewhere, can be any sequence of letters, digits, and underscores (starting
7906 with a letter) and must be unique among drivers of the same type. A router and
7907 a transport (for example) can each have the same name, but no two router
7908 instances can have the same name. The name of a driver instance should not be
7909 confused with the name of the underlying driver module. For example, the
7910 configuration lines:
7912 <literallayout class="monospaced">
7917 create an instance of the <command>smtp</command> transport driver whose name is
7918 <command>remote_smtp</command>. The same driver code can be used more than once, with
7919 different instance names and different option settings each time. A second
7920 instance of the <command>smtp</command> transport, with different options, might be defined
7923 <literallayout class="monospaced">
7927 command_timeout = 10s
7930 The names <command>remote_smtp</command> and <command>special_smtp</command> would be used to reference
7931 these transport instances from routers, and these names would appear in log
7935 Comment lines may be present in the middle of driver specifications. The full
7936 list of option settings for any particular driver instance, including all the
7937 defaulted values, can be extracted by making use of the <option>-bP</option> command line
7943 <chapter id="CHAPdefconfil">
7944 <title>The default configuration file</title>
7946 <indexterm role="concept" id="IIDconfiwal" class="startofrange">
7947 <primary>configuration file</primary>
7948 <secondary>default <quote>walk through</quote></secondary>
7950 <indexterm role="concept">
7951 <primary>default</primary>
7952 <secondary>configuration file <quote>walk through</quote></secondary>
7954 The default configuration file supplied with Exim as <filename>src/configure.default</filename>
7955 is sufficient for a host with simple mail requirements. As an introduction to
7956 the way Exim is configured, this chapter <quote>walks through</quote> the default
7957 configuration, giving brief explanations of the settings. Detailed descriptions
7958 of the options are given in subsequent chapters. The default configuration file
7959 itself contains extensive comments about ways you might want to modify the
7960 initial settings. However, note that there are many options that are not
7961 mentioned at all in the default configuration.
7963 <section id="SECTdefconfmain">
7964 <title>Main configuration settings</title>
7966 The main (global) configuration option settings must always come first in the
7967 file. The first thing you’ll see in the file, after some initial comments, is
7970 <literallayout class="monospaced">
7971 # primary_hostname =
7974 This is a commented-out setting of the <option>primary_hostname</option> option. Exim needs
7975 to know the official, fully qualified name of your host, and this is where you
7976 can specify it. However, in most cases you do not need to set this option. When
7977 it is unset, Exim uses the <function>uname()</function> system function to obtain the host name.
7980 The first three non-comment configuration lines are as follows:
7982 <literallayout class="monospaced">
7983 domainlist local_domains = @
7984 domainlist relay_to_domains =
7985 hostlist relay_from_hosts = 127.0.0.1
7988 These are not, in fact, option settings. They are definitions of two named
7989 domain lists and one named host list. Exim allows you to give names to lists of
7990 domains, hosts, and email addresses, in order to make it easier to manage the
7991 configuration file (see section <xref linkend="SECTnamedlists"/>).
7994 The first line defines a domain list called <emphasis>local_domains</emphasis>; this is used
7995 later in the configuration to identify domains that are to be delivered
7999 <indexterm role="concept">
8000 <primary>@ in a domain list</primary>
8002 There is just one item in this list, the string <quote>@</quote>. This is a special form
8003 of entry which means <quote>the name of the local host</quote>. Thus, if the local host is
8004 called <emphasis>a.host.example</emphasis>, mail to <emphasis>any.user@a.host.example</emphasis> is expected to
8005 be delivered locally. Because the local host’s name is referenced indirectly,
8006 the same configuration file can be used on different hosts.
8009 The second line defines a domain list called <emphasis>relay_to_domains</emphasis>, but the
8010 list itself is empty. Later in the configuration we will come to the part that
8011 controls mail relaying through the local host; it allows relaying to any
8012 domains in this list. By default, therefore, no relaying on the basis of a mail
8013 domain is permitted.
8016 The third line defines a host list called <emphasis>relay_from_hosts</emphasis>. This list is
8017 used later in the configuration to permit relaying from any host or IP address
8018 that matches the list. The default contains just the IP address of the IPv4
8019 loopback interface, which means that processes on the local host are able to
8020 submit mail for relaying by sending it over TCP/IP to that interface. No other
8021 hosts are permitted to submit messages for relaying.
8024 Just to be sure there’s no misunderstanding: at this point in the configuration
8025 we aren’t actually setting up any controls. We are just defining some domains
8026 and hosts that will be used in the controls that are specified later.
8029 The next two configuration lines are genuine option settings:
8031 <literallayout class="monospaced">
8032 acl_smtp_rcpt = acl_check_rcpt
8033 acl_smtp_data = acl_check_data
8036 These options specify <emphasis>Access Control Lists</emphasis> (ACLs) that are to be used
8037 during an incoming SMTP session for every recipient of a message (every RCPT
8038 command), and after the contents of the message have been received,
8039 respectively. The names of the lists are <emphasis>acl_check_rcpt</emphasis> and
8040 <emphasis>acl_check_data</emphasis>, and we will come to their definitions below, in the ACL
8041 section of the configuration. The RCPT ACL controls which recipients are
8042 accepted for an incoming message – if a configuration does not provide an ACL
8043 to check recipients, no SMTP mail can be accepted. The DATA ACL allows the
8044 contents of a message to be checked.
8047 Two commented-out option settings are next:
8049 <literallayout class="monospaced">
8050 # av_scanner = clamd:/tmp/clamd
8051 # spamd_address = 127.0.0.1 783
8054 These are example settings that can be used when Exim is compiled with the
8055 content-scanning extension. The first specifies the interface to the virus
8056 scanner, and the second specifies the interface to SpamAssassin. Further
8057 details are given in chapter <xref linkend="CHAPexiscan"/>.
8060 Three more commented-out option settings follow:
8062 <literallayout class="monospaced">
8063 # tls_advertise_hosts = *
8064 # tls_certificate = /etc/ssl/exim.crt
8065 # tls_privatekey = /etc/ssl/exim.pem
8068 These are example settings that can be used when Exim is compiled with
8069 support for TLS (aka SSL) as described in section <xref linkend="SECTinctlsssl"/>. The
8070 first one specifies the list of clients that are allowed to use TLS when
8071 connecting to this server; in this case the wildcard means all clients. The
8072 other options specify where Exim should find its TLS certificate and private
8073 key, which together prove the server’s identity to any clients that connect.
8074 More details are given in chapter <xref linkend="CHAPTLS"/>.
8077 Another two commented-out option settings follow:
8079 <literallayout class="monospaced">
8080 # daemon_smtp_ports = 25 : 465 : 587
8081 # tls_on_connect_ports = 465
8084 <indexterm role="concept">
8085 <primary>port</primary>
8086 <secondary>465 and 587</secondary>
8088 <indexterm role="concept">
8089 <primary>port</primary>
8090 <secondary>for message submission</secondary>
8092 <indexterm role="concept">
8093 <primary>message</primary>
8094 <secondary>submission, ports for</secondary>
8096 <indexterm role="concept">
8097 <primary>ssmtp protocol</primary>
8099 <indexterm role="concept">
8100 <primary>smtps protocol</primary>
8102 <indexterm role="concept">
8103 <primary>SMTP</primary>
8104 <secondary>ssmtp protocol</secondary>
8106 <indexterm role="concept">
8107 <primary>SMTP</primary>
8108 <secondary>smtps protocol</secondary>
8110 These options provide better support for roaming users who wish to use this
8111 server for message submission. They are not much use unless you have turned on
8112 TLS (as described in the previous paragraph) and authentication (about which
8113 more in section <xref linkend="SECTdefconfauth"/>). The usual SMTP port 25 is often blocked
8114 on end-user networks, so RFC 4409 specifies that message submission should use
8115 port 587 instead. However some software (notably Microsoft Outlook) cannot be
8116 configured to use port 587 correctly, so these settings also enable the
8117 non-standard <quote>smtps</quote> (aka <quote>ssmtp</quote>) port 465 (see section
8118 <xref linkend="SECTsupobssmt"/>).
8121 Two more commented-out options settings follow:
8123 <literallayout class="monospaced">
8125 # qualify_recipient =
8128 The first of these specifies a domain that Exim uses when it constructs a
8129 complete email address from a local login name. This is often needed when Exim
8130 receives a message from a local process. If you do not set <option>qualify_domain</option>,
8131 the value of <option>primary_hostname</option> is used. If you set both of these options,
8132 you can have different qualification domains for sender and recipient
8133 addresses. If you set only the first one, its value is used in both cases.
8136 <indexterm role="concept">
8137 <primary>domain literal</primary>
8138 <secondary>recognizing format</secondary>
8140 The following line must be uncommented if you want Exim to recognize
8141 addresses of the form <emphasis>user@[10.11.12.13]</emphasis> that is, with a <quote>domain literal</quote>
8142 (an IP address within square brackets) instead of a named domain.
8144 <literallayout class="monospaced">
8145 # allow_domain_literals
8148 The RFCs still require this form, but many people think that in the modern
8149 Internet it makes little sense to permit mail to be sent to specific hosts by
8150 quoting their IP addresses. This ancient format has been used by people who
8151 try to abuse hosts by using them for unwanted relaying. However, some
8152 people believe there are circumstances (for example, messages addressed to
8153 <emphasis>postmaster</emphasis>) where domain literals are still useful.
8156 The next configuration line is a kind of trigger guard:
8158 <literallayout class="monospaced">
8162 It specifies that no delivery must ever be run as the root user. The normal
8163 convention is to set up <emphasis>root</emphasis> as an alias for the system administrator. This
8164 setting is a guard against slips in the configuration.
8165 The list of users specified by <option>never_users</option> is not, however, the complete
8166 list; the build-time configuration in <filename>Local/Makefile</filename> has an option called
8167 FIXED_NEVER_USERS specifying a list that cannot be overridden. The
8168 contents of <option>never_users</option> are added to this list. By default
8169 FIXED_NEVER_USERS also specifies root.
8172 When a remote host connects to Exim in order to send mail, the only information
8173 Exim has about the host’s identity is its IP address. The next configuration
8176 <literallayout class="monospaced">
8180 specifies that Exim should do a reverse DNS lookup on all incoming connections,
8181 in order to get a host name. This improves the quality of the logging
8182 information, but if you feel it is too expensive, you can remove it entirely,
8183 or restrict the lookup to hosts on <quote>nearby</quote> networks.
8184 Note that it is not always possible to find a host name from an IP address,
8185 because not all DNS reverse zones are maintained, and sometimes DNS servers are
8189 The next two lines are concerned with <emphasis>ident</emphasis> callbacks, as defined by RFC
8190 1413 (hence their names):
8192 <literallayout class="monospaced">
8194 rfc1413_query_timeout = 5s
8197 These settings cause Exim to make ident callbacks for all incoming SMTP calls.
8198 You can limit the hosts to which these calls are made, or change the timeout
8199 that is used. If you set the timeout to zero, all ident calls are disabled.
8200 Although they are cheap and can provide useful information for tracing problem
8201 messages, some hosts and firewalls have problems with ident calls. This can
8202 result in a timeout instead of an immediate refused connection, leading to
8203 delays on starting up an incoming SMTP session.
8206 When Exim receives messages over SMTP connections, it expects all addresses to
8207 be fully qualified with a domain, as required by the SMTP definition. However,
8208 if you are running a server to which simple clients submit messages, you may
8209 find that they send unqualified addresses. The two commented-out options:
8211 <literallayout class="monospaced">
8212 # sender_unqualified_hosts =
8213 # recipient_unqualified_hosts =
8216 show how you can specify hosts that are permitted to send unqualified sender
8217 and recipient addresses, respectively.
8220 The <option>percent_hack_domains</option> option is also commented out:
8222 <literallayout class="monospaced">
8223 # percent_hack_domains =
8226 It provides a list of domains for which the <quote>percent hack</quote> is to operate.
8227 This is an almost obsolete form of explicit email routing. If you do not know
8228 anything about it, you can safely ignore this topic.
8231 The last two settings in the main part of the default configuration are
8232 concerned with messages that have been <quote>frozen</quote> on Exim’s queue. When a
8233 message is frozen, Exim no longer continues to try to deliver it. Freezing
8234 occurs when a bounce message encounters a permanent failure because the sender
8235 address of the original message that caused the bounce is invalid, so the
8236 bounce cannot be delivered. This is probably the most common case, but there
8237 are also other conditions that cause freezing, and frozen messages are not
8238 always bounce messages.
8240 <literallayout class="monospaced">
8241 ignore_bounce_errors_after = 2d
8242 timeout_frozen_after = 7d
8245 The first of these options specifies that failing bounce messages are to be
8246 discarded after 2 days on the queue. The second specifies that any frozen
8247 message (whether a bounce message or not) is to be timed out (and discarded)
8248 after a week. In this configuration, the first setting ensures that no failing
8249 bounce message ever lasts a week.
8252 <section id="SECID54">
8253 <title>ACL configuration</title>
8255 <indexterm role="concept">
8256 <primary>default</primary>
8257 <secondary>ACLs</secondary>
8259 <indexterm role="concept">
8260 <primary>access control lists (ACLs)</primary>
8261 <secondary>default configuration</secondary>
8263 In the default configuration, the ACL section follows the main configuration.
8264 It starts with the line
8266 <literallayout class="monospaced">
8270 and it contains the definitions of two ACLs, called <emphasis>acl_check_rcpt</emphasis> and
8271 <emphasis>acl_check_data</emphasis>, that were referenced in the settings of <option>acl_smtp_rcpt</option>
8272 and <option>acl_smtp_data</option> above.
8275 <indexterm role="concept">
8276 <primary>RCPT</primary>
8277 <secondary>ACL for</secondary>
8279 The first ACL is used for every RCPT command in an incoming SMTP message. Each
8280 RCPT command specifies one of the message’s recipients. The ACL statements
8281 are considered in order, until the recipient address is either accepted or
8282 rejected. The RCPT command is then accepted or rejected, according to the
8283 result of the ACL processing.
8285 <literallayout class="monospaced">
8289 This line, consisting of a name terminated by a colon, marks the start of the
8292 <literallayout class="monospaced">
8296 This ACL statement accepts the recipient if the sending host matches the list.
8297 But what does that strange list mean? It doesn’t actually contain any host
8298 names or IP addresses. The presence of the colon puts an empty item in the
8299 list; Exim matches this only if the incoming message did not come from a remote
8300 host, because in that case, the remote hostname is empty. The colon is
8301 important. Without it, the list itself is empty, and can never match anything.
8304 What this statement is doing is to accept unconditionally all recipients in
8305 messages that are submitted by SMTP from local processes using the standard
8306 input and output (that is, not using TCP/IP). A number of MUAs operate in this
8309 <literallayout class="monospaced">
8310 deny message = Restricted characters in address
8311 domains = +local_domains
8312 local_parts = ^[.] : ^.*[@%!/|]
8314 deny message = Restricted characters in address
8315 domains = !+local_domains
8316 local_parts = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
8319 These statements are concerned with local parts that contain any of the
8320 characters <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>, <quote>|</quote>, or dots in unusual places.
8321 Although these characters are entirely legal in local parts (in the case of
8322 <quote>@</quote> and leading dots, only if correctly quoted), they do not commonly occur
8323 in Internet mail addresses.
8326 The first three have in the past been associated with explicitly routed
8327 addresses (percent is still sometimes used – see the <option>percent_hack_domains</option>
8328 option). Addresses containing these characters are regularly tried by spammers
8329 in an attempt to bypass relaying restrictions, and also by open relay testing
8330 programs. Unless you really need them it is safest to reject these characters
8331 at this early stage. This configuration is heavy-handed in rejecting these
8332 characters for all messages it accepts from remote hosts. This is a deliberate
8333 policy of being as safe as possible.
8336 The first rule above is stricter, and is applied to messages that are addressed
8337 to one of the local domains handled by this host. This is implemented by the
8338 first condition, which restricts it to domains that are listed in the
8339 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8340 reference to a named list. In this configuration, there is just one domain in
8341 <emphasis>local_domains</emphasis>, but in general there may be many.
8344 The second condition on the first statement uses two regular expressions to
8345 block local parts that begin with a dot or contain <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>,
8346 or <quote>|</quote>. If you have local accounts that include these characters, you will
8347 have to modify this rule.
8350 Empty components (two dots in a row) are not valid in RFC 2822, but Exim
8351 allows them because they have been encountered in practice. (Consider the
8352 common convention of local parts constructed as
8353 <quote><emphasis>first-initial.second-initial.family-name</emphasis></quote> when applied to someone like
8354 the author of Exim, who has no second initial.) However, a local part starting
8355 with a dot or containing <quote>/../</quote> can cause trouble if it is used as part of a
8356 file name (for example, for a mailing list). This is also true for local parts
8357 that contain slashes. A pipe symbol can also be troublesome if the local part
8358 is incorporated unthinkingly into a shell command line.
8361 The second rule above applies to all other domains, and is less strict. This
8362 allows your own users to send outgoing messages to sites that use slashes
8363 and vertical bars in their local parts. It blocks local parts that begin
8364 with a dot, slash, or vertical bar, but allows these characters within the
8365 local part. However, the sequence <quote>/../</quote> is barred. The use of <quote>@</quote>, <quote>%</quote>,
8366 and <quote>!</quote> is blocked, as before. The motivation here is to prevent your users
8367 (or your users’ viruses) from mounting certain kinds of attack on remote sites.
8369 <literallayout class="monospaced">
8370 accept local_parts = postmaster
8371 domains = +local_domains
8374 This statement, which has two conditions, accepts an incoming address if the
8375 local part is <emphasis>postmaster</emphasis> and the domain is one of those listed in the
8376 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8377 reference to a named list. In this configuration, there is just one domain in
8378 <emphasis>local_domains</emphasis>, but in general there may be many.
8381 The presence of this statement means that mail to postmaster is never blocked
8382 by any of the subsequent tests. This can be helpful while sorting out problems
8383 in cases where the subsequent tests are incorrectly denying access.
8385 <literallayout class="monospaced">
8386 require verify = sender
8389 This statement requires the sender address to be verified before any subsequent
8390 ACL statement can be used. If verification fails, the incoming recipient
8391 address is refused. Verification consists of trying to route the address, to
8392 see if a bounce message could be delivered to it. In the case of remote
8393 addresses, basic verification checks only the domain, but <emphasis>callouts</emphasis> can be
8394 used for more verification if required. Section <xref linkend="SECTaddressverification"/>
8395 discusses the details of address verification.
8397 <literallayout class="monospaced">
8398 accept hosts = +relay_from_hosts
8399 control = submission
8402 This statement accepts the address if the message is coming from one of the
8403 hosts that are defined as being allowed to relay through this host. Recipient
8404 verification is omitted here, because in many cases the clients are dumb MUAs
8405 that do not cope well with SMTP error responses. For the same reason, the
8406 second line specifies <quote>submission mode</quote> for messages that are accepted. This
8407 is described in detail in section <xref linkend="SECTsubmodnon"/>; it causes Exim to fix
8408 messages that are deficient in some way, for example, because they lack a
8409 <emphasis>Date:</emphasis> header line. If you are actually relaying out from MTAs, you should
8410 probably add recipient verification here, and disable submission mode.
8412 <literallayout class="monospaced">
8413 accept authenticated = *
8414 control = submission
8417 This statement accepts the address if the client host has authenticated itself.
8418 Submission mode is again specified, on the grounds that such messages are most
8419 likely to come from MUAs. The default configuration does not define any
8420 authenticators, though it does include some nearly complete commented-out
8421 examples described in <xref linkend="SECTdefconfauth"/>. This means that no client can in
8422 fact authenticate until you complete the authenticator definitions.
8424 <literallayout class="monospaced">
8425 require message = relay not permitted
8426 domains = +local_domains : +relay_domains
8429 This statement rejects the address if its domain is neither a local domain nor
8430 one of the domains for which this host is a relay.
8432 <literallayout class="monospaced">
8433 require verify = recipient
8436 This statement requires the recipient address to be verified; if verification
8437 fails, the address is rejected.
8439 <literallayout class="monospaced">
8440 # deny message = rejected because $sender_host_address \
8441 # is in a black list at $dnslist_domain\n\
8443 # dnslists = black.list.example
8445 # warn dnslists = black.list.example
8446 # add_header = X-Warning: $sender_host_address is in \
8447 # a black list at $dnslist_domain
8448 # log_message = found in $dnslist_domain
8451 These commented-out lines are examples of how you could configure Exim to check
8452 sending hosts against a DNS black list. The first statement rejects messages
8453 from blacklisted hosts, whereas the second just inserts a warning header
8456 <literallayout class="monospaced">
8457 # require verify = csa
8460 This commented-out line is an example of how you could turn on client SMTP
8461 authorization (CSA) checking. Such checks do DNS lookups for special SRV
8464 <literallayout class="monospaced">
8468 The final statement in the first ACL unconditionally accepts any recipient
8469 address that has successfully passed all the previous tests.
8471 <literallayout class="monospaced">
8475 This line marks the start of the second ACL, and names it. Most of the contents
8476 of this ACL are commented out:
8478 <literallayout class="monospaced">
8480 # message = This message contains a virus \
8484 These lines are examples of how to arrange for messages to be scanned for
8485 viruses when Exim has been compiled with the content-scanning extension, and a
8486 suitable virus scanner is installed. If the message is found to contain a
8487 virus, it is rejected with the given custom error message.
8489 <literallayout class="monospaced">
8490 # warn spam = nobody
8491 # message = X-Spam_score: $spam_score\n\
8492 # X-Spam_score_int: $spam_score_int\n\
8493 # X-Spam_bar: $spam_bar\n\
8494 # X-Spam_report: $spam_report
8497 These lines are an example of how to arrange for messages to be scanned by
8498 SpamAssassin when Exim has been compiled with the content-scanning extension,
8499 and SpamAssassin has been installed. The SpamAssassin check is run with
8500 <literal>nobody</literal> as its user parameter, and the results are added to the message as a
8501 series of extra header line. In this case, the message is not rejected,
8502 whatever the spam score.
8504 <literallayout class="monospaced">
8508 This final line in the DATA ACL accepts the message unconditionally.
8511 <section id="SECID55">
8512 <title>Router configuration</title>
8514 <indexterm role="concept">
8515 <primary>default</primary>
8516 <secondary>routers</secondary>
8518 <indexterm role="concept">
8519 <primary>routers</primary>
8520 <secondary>default</secondary>
8522 The router configuration comes next in the default configuration, introduced
8525 <literallayout class="monospaced">
8529 Routers are the modules in Exim that make decisions about where to send
8530 messages. An address is passed to each router in turn, until it is either
8531 accepted, or failed. This means that the order in which you define the routers
8532 matters. Each router is fully described in its own chapter later in this
8533 manual. Here we give only brief overviews.
8535 <literallayout class="monospaced">
8537 # driver = ipliteral
8538 # domains = !+local_domains
8539 # transport = remote_smtp
8542 <indexterm role="concept">
8543 <primary>domain literal</primary>
8544 <secondary>default router</secondary>
8546 This router is commented out because the majority of sites do not want to
8547 support domain literal addresses (those of the form <emphasis>user@[10.9.8.7]</emphasis>). If
8548 you uncomment this router, you also need to uncomment the setting of
8549 <option>allow_domain_literals</option> in the main part of the configuration.
8551 <literallayout class="monospaced">
8554 domains = ! +local_domains
8555 transport = remote_smtp
8556 ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
8560 The first uncommented router handles addresses that do not involve any local
8561 domains. This is specified by the line
8563 <literallayout class="monospaced">
8564 domains = ! +local_domains
8567 The <option>domains</option> option lists the domains to which this router applies, but the
8568 exclamation mark is a negation sign, so the router is used only for domains
8569 that are not in the domain list called <emphasis>local_domains</emphasis> (which was defined at
8570 the start of the configuration). The plus sign before <emphasis>local_domains</emphasis>
8571 indicates that it is referring to a named list. Addresses in other domains are
8572 passed on to the following routers.
8575 The name of the router driver is <command>dnslookup</command>,
8576 and is specified by the <option>driver</option> option. Do not be confused by the fact that
8577 the name of this router instance is the same as the name of the driver. The
8578 instance name is arbitrary, but the name set in the <option>driver</option> option must be
8579 one of the driver modules that is in the Exim binary.
8582 The <command>dnslookup</command> router routes addresses by looking up their domains in the
8583 DNS in order to obtain a list of hosts to which the address is routed. If the
8584 router succeeds, the address is queued for the <command>remote_smtp</command> transport, as
8585 specified by the <option>transport</option> option. If the router does not find the domain
8586 in the DNS, no further routers are tried because of the <option>no_more</option> setting, so
8587 the address fails and is bounced.
8590 The <option>ignore_target_hosts</option> option specifies a list of IP addresses that are to
8591 be entirely ignored. This option is present because a number of cases have been
8592 encountered where MX records in the DNS point to host names
8593 whose IP addresses are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1).
8594 Completely ignoring these IP addresses causes Exim to fail to route the
8595 email address, so it bounces. Otherwise, Exim would log a routing problem, and
8596 continue to try to deliver the message periodically until the address timed
8599 <literallayout class="monospaced">
8604 data = ${lookup{$local_part}lsearch{/etc/aliases}}
8606 file_transport = address_file
8607 pipe_transport = address_pipe
8610 Control reaches this and subsequent routers only for addresses in the local
8611 domains. This router checks to see whether the local part is defined as an
8612 alias in the <filename>/etc/aliases</filename> file, and if so, redirects it according to the
8613 data that it looks up from that file. If no data is found for the local part,
8614 the value of the <option>data</option> option is empty, causing the address to be passed to
8618 <filename>/etc/aliases</filename> is a conventional name for the system aliases file that is
8619 often used. That is why it is referenced by from the default configuration
8620 file. However, you can change this by setting SYSTEM_ALIASES_FILE in
8621 <filename>Local/Makefile</filename> before building Exim.
8623 <literallayout class="monospaced">
8627 # local_part_suffix = +* : -*
8628 # local_part_suffix_optional
8629 file = $home/.forward
8634 file_transport = address_file
8635 pipe_transport = address_pipe
8636 reply_transport = address_reply
8639 This is the most complicated router in the default configuration. It is another
8640 redirection router, but this time it is looking for forwarding data set up by
8641 individual users. The <option>check_local_user</option> setting specifies a check that the
8642 local part of the address is the login name of a local user. If it is not, the
8643 router is skipped. The two commented options that follow <option>check_local_user</option>,
8646 <literallayout class="monospaced">
8647 # local_part_suffix = +* : -*
8648 # local_part_suffix_optional
8651 <indexterm role="variable">
8652 <primary><varname>$local_part_suffix</varname></primary>
8654 show how you can specify the recognition of local part suffixes. If the first
8655 is uncommented, a suffix beginning with either a plus or a minus sign, followed
8656 by any sequence of characters, is removed from the local part and placed in the
8657 variable <varname>$local_part_suffix</varname>. The second suffix option specifies that the
8658 presence of a suffix in the local part is optional. When a suffix is present,
8659 the check for a local login uses the local part with the suffix removed.
8662 When a local user account is found, the file called <filename>.forward</filename> in the user’s
8663 home directory is consulted. If it does not exist, or is empty, the router
8664 declines. Otherwise, the contents of <filename>.forward</filename> are interpreted as
8665 redirection data (see chapter <xref linkend="CHAPredirect"/> for more details).
8668 <indexterm role="concept">
8669 <primary>Sieve filter</primary>
8670 <secondary>enabling in default router</secondary>
8672 Traditional <filename>.forward</filename> files contain just a list of addresses, pipes, or
8673 files. Exim supports this by default. However, if <option>allow_filter</option> is set (it
8674 is commented out by default), the contents of the file are interpreted as a set
8675 of Exim or Sieve filtering instructions, provided the file begins with <quote>#Exim
8676 filter</quote> or <quote>#Sieve filter</quote>, respectively. User filtering is discussed in the
8677 separate document entitled <emphasis>Exim’s interfaces to mail filtering</emphasis>.
8680 The <option>no_verify</option> and <option>no_expn</option> options mean that this router is skipped when
8681 verifying addresses, or when running as a consequence of an SMTP EXPN command.
8682 There are two reasons for doing this:
8684 <orderedlist numeration="arabic">
8687 Whether or not a local user has a <filename>.forward</filename> file is not really relevant when
8688 checking an address for validity; it makes sense not to waste resources doing
8694 More importantly, when Exim is verifying addresses or handling an EXPN
8695 command during an SMTP session, it is running as the Exim user, not as root.
8696 The group is the Exim group, and no additional groups are set up.
8697 It may therefore not be possible for Exim to read users’ <filename>.forward</filename> files at
8703 The setting of <option>check_ancestor</option> prevents the router from generating a new
8704 address that is the same as any previous address that was redirected. (This
8705 works round a problem concerning a bad interaction between aliasing and
8706 forwarding – see section <xref linkend="SECTredlocmai"/>).
8709 The final three option settings specify the transports that are to be used when
8710 forwarding generates a direct delivery to a file, or to a pipe, or sets up an
8711 auto-reply, respectively. For example, if a <filename>.forward</filename> file contains
8713 <literallayout class="monospaced">
8714 a.nother@elsewhere.example, /home/spqr/archive
8717 the delivery to <filename>/home/spqr/archive</filename> is done by running the <option>address_file</option>
8720 <literallayout class="monospaced">
8724 # local_part_suffix = +* : -*
8725 # local_part_suffix_optional
8726 transport = local_delivery
8729 The final router sets up delivery into local mailboxes, provided that the local
8730 part is the name of a local login, by accepting the address and assigning it to
8731 the <command>local_delivery</command> transport. Otherwise, we have reached the end of the
8732 routers, so the address is bounced. The commented suffix settings fulfil the
8733 same purpose as they do for the <command>userforward</command> router.
8736 <section id="SECID56">
8737 <title>Transport configuration</title>
8739 <indexterm role="concept">
8740 <primary>default</primary>
8741 <secondary>transports</secondary>
8743 <indexterm role="concept">
8744 <primary>transports</primary>
8745 <secondary>default</secondary>
8747 Transports define mechanisms for actually delivering messages. They operate
8748 only when referenced from routers, so the order in which they are defined does
8749 not matter. The transports section of the configuration starts with
8751 <literallayout class="monospaced">
8755 One remote transport and four local transports are defined.
8757 <literallayout class="monospaced">
8762 This transport is used for delivering messages over SMTP connections. All its
8763 options are defaulted. The list of remote hosts comes from the router.
8765 <literallayout class="monospaced">
8768 file = /var/mail/$local_part
8776 This <command>appendfile</command> transport is used for local delivery to user mailboxes in
8777 traditional BSD mailbox format. By default it runs under the uid and gid of the
8778 local user, which requires the sticky bit to be set on the <filename>/var/mail</filename>
8779 directory. Some systems use the alternative approach of running mail deliveries
8780 under a particular group instead of using the sticky bit. The commented options
8781 show how this can be done.
8784 Exim adds three headers to the message as it delivers it: <emphasis>Delivery-date:</emphasis>,
8785 <emphasis>Envelope-to:</emphasis> and <emphasis>Return-path:</emphasis>. This action is requested by the three
8786 similarly-named options above.
8788 <literallayout class="monospaced">
8794 This transport is used for handling deliveries to pipes that are generated by
8795 redirection (aliasing or users’ <filename>.forward</filename> files). The <option>return_output</option>
8796 option specifies that any output generated by the pipe is to be returned to the
8799 <literallayout class="monospaced">
8807 This transport is used for handling deliveries to files that are generated by
8808 redirection. The name of the file is not specified in this instance of
8809 <command>appendfile</command>, because it comes from the <command>redirect</command> router.
8811 <literallayout class="monospaced">
8816 This transport is used for handling automatic replies generated by users’
8820 <section id="SECID57">
8821 <title>Default retry rule</title>
8823 <indexterm role="concept">
8824 <primary>retry</primary>
8825 <secondary>default rule</secondary>
8827 <indexterm role="concept">
8828 <primary>default</primary>
8829 <secondary>retry rule</secondary>
8831 The retry section of the configuration file contains rules which affect the way
8832 Exim retries deliveries that cannot be completed at the first attempt. It is
8833 introduced by the line
8835 <literallayout class="monospaced">
8839 In the default configuration, there is just one rule, which applies to all
8842 <literallayout class="monospaced">
8843 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
8846 This causes any temporarily failing address to be retried every 15 minutes for
8847 2 hours, then at intervals starting at one hour and increasing by a factor of
8848 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address
8849 is not delivered after 4 days of temporary failure, it is bounced.
8852 If the retry section is removed from the configuration, or is empty (that is,
8853 if no retry rules are defined), Exim will not retry deliveries. This turns
8854 temporary errors into permanent errors.
8857 <section id="SECID58">
8858 <title>Rewriting configuration</title>
8860 The rewriting section of the configuration, introduced by
8862 <literallayout class="monospaced">
8866 contains rules for rewriting addresses in messages as they arrive. There are no
8867 rewriting rules in the default configuration file.
8870 <section id="SECTdefconfauth">
8871 <title>Authenticators configuration</title>
8873 <indexterm role="concept">
8874 <primary>AUTH</primary>
8875 <secondary>configuration</secondary>
8877 The authenticators section of the configuration, introduced by
8879 <literallayout class="monospaced">
8880 begin authenticators
8883 defines mechanisms for the use of the SMTP AUTH command. The default
8884 configuration file contains two commented-out example authenticators
8885 which support plaintext username/password authentication using the
8886 standard PLAIN mechanism and the traditional but non-standard LOGIN
8887 mechanism, with Exim acting as the server. PLAIN and LOGIN are enough
8888 to support most MUA software.
8891 The example PLAIN authenticator looks like this:
8893 <literallayout class="monospaced">
8895 # driver = plaintext
8896 # server_set_id = $auth2
8897 # server_prompts = :
8898 # server_condition = Authentication is not yet configured
8899 # server_advertise_condition = ${if def:tls_cipher }
8902 And the example LOGIN authenticator looks like this:
8904 <literallayout class="monospaced">
8906 # driver = plaintext
8907 # server_set_id = $auth1
8908 # server_prompts = <| Username: | Password:
8909 # server_condition = Authentication is not yet configured
8910 # server_advertise_condition = ${if def:tls_cipher }
8913 The <option>server_set_id</option> option makes Exim remember the authenticated username
8914 in <varname>$authenticated_id</varname>, which can be used later in ACLs or routers. The
8915 <option>server_prompts</option> option configures the <command>plaintext</command> authenticator so
8916 that it implements the details of the specific authentication mechanism,
8917 i.e. PLAIN or LOGIN. The <option>server_advertise_condition</option> setting controls
8918 when Exim offers authentication to clients; in the examples, this is only
8919 when TLS or SSL has been started, so to enable the authenticators you also
8920 need to add support for TLS as described in <xref linkend="SECTdefconfmain"/>.
8923 The <option>server_condition</option> setting defines how to verify that the username and
8924 password are correct. In the examples it just produces an error message.
8925 To make the authenticators work, you can use a string expansion
8926 expression like one of the examples in <xref linkend="CHAPplaintext"/>.
8929 Beware that the sequence of the parameters to PLAIN and LOGIN differ; the
8930 usercode and password are in different positions. <xref linkend="CHAPplaintext"/>
8934 <indexterm role="concept" startref="IIDconfiwal" class="endofrange"/>
8939 <chapter id="CHAPregexp">
8940 <title>Regular expressions</title>
8942 <indexterm role="concept">
8943 <primary>regular expressions</primary>
8944 <secondary>library</secondary>
8946 <indexterm role="concept">
8947 <primary>PCRE</primary>
8949 Exim supports the use of regular expressions in many of its options. It
8950 uses the PCRE regular expression library; this provides regular expression
8951 matching that is compatible with Perl 5. The syntax and semantics of
8952 regular expressions is discussed in many Perl reference books, and also in
8953 Jeffrey Friedl’s <emphasis>Mastering Regular Expressions</emphasis>, which is published by
8954 O’Reilly (see <emphasis role="bold"><ulink url="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</ulink></emphasis>).
8957 The documentation for the syntax and semantics of the regular expressions that
8958 are supported by PCRE is included in the PCRE distribution, and no further
8959 description is included here. The PCRE functions are called from Exim using
8960 the default option settings (that is, with no PCRE options set), except that
8961 the PCRE_CASELESS option is set when the matching is required to be
8965 In most cases, when a regular expression is required in an Exim configuration,
8966 it has to start with a circumflex, in order to distinguish it from plain text
8967 or an <quote>ends with</quote> wildcard. In this example of a configuration setting, the
8968 second item in the colon-separated list is a regular expression.
8970 <literallayout class="monospaced">
8971 domains = a.b.c : ^\\d{3} : *.y.z : ...
8974 The doubling of the backslash is required because of string expansion that
8975 precedes interpretation – see section <xref linkend="SECTlittext"/> for more discussion
8976 of this issue, and a way of avoiding the need for doubling backslashes. The
8977 regular expression that is eventually used in this example contains just one
8978 backslash. The circumflex is included in the regular expression, and has the
8979 normal effect of <quote>anchoring</quote> it to the start of the string that is being
8983 There are, however, two cases where a circumflex is not required for the
8984 recognition of a regular expression: these are the <option>match</option> condition in a
8985 string expansion, and the <option>matches</option> condition in an Exim filter file. In
8986 these cases, the relevant string is always treated as a regular expression; if
8987 it does not start with a circumflex, the expression is not anchored, and can
8988 match anywhere in the subject string.
8991 In all cases, if you want a regular expression to match at the end of a string,
8992 you must code the $ metacharacter to indicate this. For example:
8994 <literallayout class="monospaced">
8995 domains = ^\\d{3}\\.example
8998 matches the domain <emphasis>123.example</emphasis>, but it also matches <emphasis>123.example.com</emphasis>.
9001 <literallayout class="monospaced">
9002 domains = ^\\d{3}\\.example\$
9005 if you want <emphasis>example</emphasis> to be the top-level domain. The backslash before the
9006 $ is needed because string expansion also interprets dollar characters.
9010 <chapter id="CHAPfdlookup">
9011 <title>File and database lookups</title>
9013 <indexterm role="concept" id="IIDfidalo1" class="startofrange">
9014 <primary>file</primary>
9015 <secondary>lookups</secondary>
9017 <indexterm role="concept" id="IIDfidalo2" class="startofrange">
9018 <primary>database</primary>
9019 <secondary>lookups</secondary>
9021 <indexterm role="concept">
9022 <primary>lookup</primary>
9023 <secondary>description of</secondary>
9025 Exim can be configured to look up data in files or databases as it processes
9026 messages. Two different kinds of syntax are used:
9028 <orderedlist numeration="arabic">
9031 A string that is to be expanded may contain explicit lookup requests. These
9032 cause parts of the string to be replaced by data that is obtained from the
9033 lookup. Lookups of this type are conditional expansion items. Different results
9034 can be defined for the cases of lookup success and failure. See chapter
9035 <xref linkend="CHAPexpand"/>, where string expansions are described in detail.
9040 Lists of domains, hosts, and email addresses can contain lookup requests as a
9041 way of avoiding excessively long linear lists. In this case, the data that is
9042 returned by the lookup is often (but not always) discarded; whether the lookup
9043 succeeds or fails is what really counts. These kinds of list are described in
9044 chapter <xref linkend="CHAPdomhosaddlists"/>.
9049 String expansions, lists, and lookups interact with each other in such a way
9050 that there is no order in which to describe any one of them that does not
9051 involve references to the others. Each of these three chapters makes more sense
9052 if you have read the other two first. If you are reading this for the first
9053 time, be aware that some of it will make a lot more sense after you have read
9054 chapters <xref linkend="CHAPdomhosaddlists"/> and <xref linkend="CHAPexpand"/>.
9056 <section id="SECID60">
9057 <title>Examples of different lookup syntax</title>
9059 It is easy to confuse the two different kinds of lookup, especially as the
9060 lists that may contain the second kind are always expanded before being
9061 processed as lists. Therefore, they may also contain lookups of the first kind.
9062 Be careful to distinguish between the following two examples:
9064 <literallayout class="monospaced">
9065 domains = ${lookup{$sender_host_address}lsearch{/some/file}}
9066 domains = lsearch;/some/file
9069 The first uses a string expansion, the result of which must be a domain list.
9070 No strings have been specified for a successful or a failing lookup; the
9071 defaults in this case are the looked-up data and an empty string, respectively.
9072 The expansion takes place before the string is processed as a list, and the
9073 file that is searched could contain lines like this:
9075 <literallayout class="monospaced">
9076 192.168.3.4: domain1:domain2:...
9077 192.168.1.9: domain3:domain4:...
9080 When the lookup succeeds, the result of the expansion is a list of domains (and
9081 possibly other types of item that are allowed in domain lists).
9084 In the second example, the lookup is a single item in a domain list. It causes
9085 Exim to use a lookup to see if the domain that is being processed can be found
9086 in the file. The file could contains lines like this:
9088 <literallayout class="monospaced">
9093 Any data that follows the keys is not relevant when checking that the domain
9094 matches the list item.
9097 It is possible, though no doubt confusing, to use both kinds of lookup at once.
9098 Consider a file containing lines like this:
9100 <literallayout class="monospaced">
9101 192.168.5.6: lsearch;/another/file
9104 If the value of <varname>$sender_host_address</varname> is 192.168.5.6, expansion of the
9105 first <option>domains</option> setting above generates the second setting, which therefore
9106 causes a second lookup to occur.
9109 The rest of this chapter describes the different lookup types that are
9110 available. Any of them can be used in any part of the configuration where a
9111 lookup is permitted.
9114 <section id="SECID61">
9115 <title>Lookup types</title>
9117 <indexterm role="concept">
9118 <primary>lookup</primary>
9119 <secondary>types of</secondary>
9121 <indexterm role="concept">
9122 <primary>single-key lookup</primary>
9123 <secondary>definition of</secondary>
9125 Two different types of data lookup are implemented:
9130 The <emphasis>single-key</emphasis> type requires the specification of a file in which to look,
9131 and a single key to search for. The key must be a non-empty string for the
9132 lookup to succeed. The lookup type determines how the file is searched.
9137 <indexterm role="concept">
9138 <primary>query-style lookup</primary>
9139 <secondary>definition of</secondary>
9141 The <emphasis>query-style</emphasis> type accepts a generalized database query. No particular
9142 key value is assumed by Exim for query-style lookups. You can use whichever
9143 Exim variables you need to construct the database query.
9148 The code for each lookup type is in a separate source file that is included in
9149 the binary of Exim only if the corresponding compile-time option is set. The
9150 default settings in <filename>src/EDITME</filename> are:
9152 <literallayout class="monospaced">
9157 which means that only linear searching and DBM lookups are included by default.
9158 For some types of lookup (e.g. SQL databases), you need to install appropriate
9159 libraries and header files before building Exim.
9162 <section id="SECTsinglekeylookups">
9163 <title>Single-key lookup types</title>
9165 <indexterm role="concept">
9166 <primary>lookup</primary>
9167 <secondary>single-key types</secondary>
9169 <indexterm role="concept">
9170 <primary>single-key lookup</primary>
9171 <secondary>list of types</secondary>
9173 The following single-key lookup types are implemented:
9178 <indexterm role="concept">
9179 <primary>cdb</primary>
9180 <secondary>description of</secondary>
9182 <indexterm role="concept">
9183 <primary>lookup</primary>
9184 <secondary>cdb</secondary>
9186 <indexterm role="concept">
9187 <primary>binary zero</primary>
9188 <secondary>in lookup key</secondary>
9190 <command>cdb</command>: The given file is searched as a Constant DataBase file, using the key
9191 string without a terminating binary zero. The cdb format is designed for
9192 indexed files that are read frequently and never updated, except by total
9193 re-creation. As such, it is particularly suitable for large files containing
9194 aliases or other indexed data referenced by an MTA. Information about cdb can
9195 be found in several places:
9198 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>
9199 <emphasis role="bold"><ulink url="ftp://ftp.corpit.ru/pub/tinycdb/">ftp://ftp.corpit.ru/pub/tinycdb/</ulink></emphasis>
9200 <emphasis role="bold"><ulink url="http://packages.debian.org/stable/utils/freecdb.html">http://packages.debian.org/stable/utils/freecdb.html</ulink></emphasis>
9203 A cdb distribution is not needed in order to build Exim with cdb support,
9204 because the code for reading cdb files is included directly in Exim itself.
9205 However, no means of building or testing cdb files is provided with Exim, so
9206 you need to obtain a cdb distribution in order to do this.
9211 <indexterm role="concept">
9212 <primary>DBM</primary>
9213 <secondary>lookup type</secondary>
9215 <indexterm role="concept">
9216 <primary>lookup</primary>
9217 <secondary>dbm</secondary>
9219 <indexterm role="concept">
9220 <primary>binary zero</primary>
9221 <secondary>in lookup key</secondary>
9223 <command>dbm</command>: Calls to DBM library functions are used to extract data from the given
9224 DBM file by looking up the record with the given key. A terminating binary
9225 zero is included in the key that is passed to the DBM library. See section
9226 <xref linkend="SECTdb"/> for a discussion of DBM libraries.
9229 <indexterm role="concept">
9230 <primary>Berkeley DB library</primary>
9231 <secondary>file format</secondary>
9233 For all versions of Berkeley DB, Exim uses the DB_HASH style of database
9234 when building DBM files using the <option>exim_dbmbuild</option> utility. However, when
9235 using Berkeley DB versions 3 or 4, it opens existing databases for reading with
9236 the DB_UNKNOWN option. This enables it to handle any of the types of database
9237 that the library supports, and can be useful for accessing DBM files created by
9238 other applications. (For earlier DB versions, DB_HASH is always used.)
9243 <indexterm role="concept">
9244 <primary>lookup</primary>
9245 <secondary>dbmnz</secondary>
9247 <indexterm role="concept">
9248 <primary>lookup</primary>
9249 <secondary>dbm – terminating zero</secondary>
9251 <indexterm role="concept">
9252 <primary>binary zero</primary>
9253 <secondary>in lookup key</secondary>
9255 <indexterm role="concept">
9256 <primary>Courier</primary>
9258 <indexterm role="concept">
9259 <primary><filename>/etc/userdbshadow.dat</filename></primary>
9261 <indexterm role="concept">
9262 <primary>dmbnz lookup type</primary>
9264 <command>dbmnz</command>: This is the same as <command>dbm</command>, except that a terminating binary zero
9265 is not included in the key that is passed to the DBM library. You may need this
9266 if you want to look up data in files that are created by or shared with some
9267 other application that does not use terminating zeros. For example, you need to
9268 use <command>dbmnz</command> rather than <command>dbm</command> if you want to authenticate incoming SMTP
9269 calls using the passwords from Courier’s <filename>/etc/userdbshadow.dat</filename> file. Exim’s
9270 utility program for creating DBM files (<emphasis>exim_dbmbuild</emphasis>) includes the zeros
9271 by default, but has an option to omit them (see section <xref linkend="SECTdbmbuild"/>).
9276 <indexterm role="concept">
9277 <primary>lookup</primary>
9278 <secondary>dsearch</secondary>
9280 <indexterm role="concept">
9281 <primary>dsearch lookup type</primary>
9283 <command>dsearch</command>: The given file must be a directory; this is searched for an entry
9284 whose name is the key by calling the <function>lstat()</function> function. The key may not
9285 contain any forward slash characters. If <function>lstat()</function> succeeds, the result of
9286 the lookup is the name of the entry, which may be a file, directory,
9287 symbolic link, or any other kind of directory entry. An example of how this
9288 lookup can be used to support virtual domains is given in section
9289 <xref linkend="SECTvirtualdomains"/>.
9294 <indexterm role="concept">
9295 <primary>lookup</primary>
9296 <secondary>iplsearch</secondary>
9298 <indexterm role="concept">
9299 <primary>iplsearch lookup type</primary>
9301 <command>iplsearch</command>: The given file is a text file containing keys and data. A key is
9302 terminated by a colon or white space or the end of the line. The keys in the
9303 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
9304 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
9305 being interpreted as a key terminator. For example:
9307 <literallayout class="monospaced">
9308 1.2.3.4: data for 1.2.3.4
9309 192.168.0.0/16: data for 192.168.0.0/16
9310 "abcd::cdab": data for abcd::cdab
9311 "abcd:abcd::/32" data for abcd:abcd::/32
9314 The key for an <command>iplsearch</command> lookup must be an IP address (without a mask). The
9315 file is searched linearly, using the CIDR masks where present, until a matching
9316 key is found. The first key that matches is used; there is no attempt to find a
9317 <quote>best</quote> match. Apart from the way the keys are matched, the processing for
9318 <command>iplsearch</command> is the same as for <command>lsearch</command>.
9321 <emphasis role="bold">Warning 1</emphasis>: Unlike most other single-key lookup types, a file of data for
9322 <command>iplsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9323 lookup types support only literal keys.
9326 <emphasis role="bold">Warning 2</emphasis>: In a host list, you must always use <command>net-iplsearch</command> so that
9327 the implicit key is the host’s IP address rather than its name (see section
9328 <xref linkend="SECThoslispatsikey"/>).
9333 <indexterm role="concept">
9334 <primary>linear search</primary>
9336 <indexterm role="concept">
9337 <primary>lookup</primary>
9338 <secondary>lsearch</secondary>
9340 <indexterm role="concept">
9341 <primary>lsearch lookup type</primary>
9343 <indexterm role="concept">
9344 <primary>case sensitivity</primary>
9345 <secondary>in lsearch lookup</secondary>
9347 <command>lsearch</command>: The given file is a text file that is searched linearly for a
9348 line beginning with the search key, terminated by a colon or white space or the
9349 end of the line. The search is case-insensitive; that is, upper and lower case
9350 letters are treated as the same. The first occurrence of the key that is found
9351 in the file is used.
9354 White space between the key and the colon is permitted. The remainder of the
9355 line, with leading and trailing white space removed, is the data. This can be
9356 continued onto subsequent lines by starting them with any amount of white
9357 space, but only a single space character is included in the data at such a
9358 junction. If the data begins with a colon, the key must be terminated by a
9361 <literallayout class="monospaced">
9365 Empty lines and lines beginning with # are ignored, even if they occur in the
9366 middle of an item. This is the traditional textual format of alias files. Note
9367 that the keys in an <command>lsearch</command> file are literal strings. There is no
9368 wildcarding of any kind.
9371 <indexterm role="concept">
9372 <primary>lookup</primary>
9373 <secondary>lsearch – colons in keys</secondary>
9375 <indexterm role="concept">
9376 <primary>white space</primary>
9377 <secondary>in lsearch key</secondary>
9379 In most <command>lsearch</command> files, keys are not required to contain colons or #
9380 characters, or white space. However, if you need this feature, it is available.
9381 If a key begins with a doublequote character, it is terminated only by a
9382 matching quote (or end of line), and the normal escaping rules apply to its
9383 contents (see section <xref linkend="SECTstrings"/>). An optional colon is permitted after
9384 quoted keys (exactly as for unquoted keys). There is no special handling of
9385 quotes for the data part of an <command>lsearch</command> line.
9390 <indexterm role="concept">
9391 <primary>NIS lookup type</primary>
9393 <indexterm role="concept">
9394 <primary>lookup</primary>
9395 <secondary>NIS</secondary>
9397 <indexterm role="concept">
9398 <primary>binary zero</primary>
9399 <secondary>in lookup key</secondary>
9401 <command>nis</command>: The given file is the name of a NIS map, and a NIS lookup is done with
9402 the given key, without a terminating binary zero. There is a variant called
9403 <command>nis0</command> which does include the terminating binary zero in the key. This is
9404 reportedly needed for Sun-style alias files. Exim does not recognize NIS
9405 aliases; the full map names must be used.
9410 <indexterm role="concept">
9411 <primary>wildlsearch lookup type</primary>
9413 <indexterm role="concept">
9414 <primary>lookup</primary>
9415 <secondary>wildlsearch</secondary>
9417 <indexterm role="concept">
9418 <primary>nwildlsearch lookup type</primary>
9420 <indexterm role="concept">
9421 <primary>lookup</primary>
9422 <secondary>nwildlsearch</secondary>
9424 <command>wildlsearch</command> or <command>nwildlsearch</command>: These search a file linearly, like
9425 <command>lsearch</command>, but instead of being interpreted as a literal string, each key in
9426 the file may be wildcarded. The difference between these two lookup types is
9427 that for <command>wildlsearch</command>, each key in the file is string-expanded before being
9428 used, whereas for <command>nwildlsearch</command>, no expansion takes place.
9431 <indexterm role="concept">
9432 <primary>case sensitivity</primary>
9433 <secondary>in (n)wildlsearch lookup</secondary>
9435 Like <command>lsearch</command>, the testing is done case-insensitively. However, keys in the
9436 file that are regular expressions can be made case-sensitive by the use of
9437 <literal>(-i)</literal> within the pattern. The following forms of wildcard are recognized:
9439 <orderedlist numeration="arabic">
9442 The string may begin with an asterisk to mean <quote>ends with</quote>. For example:
9444 <literallayout class="monospaced">
9445 *.a.b.c data for anything.a.b.c
9446 *fish data for anythingfish
9451 The string may begin with a circumflex to indicate a regular expression. For
9452 example, for <command>wildlsearch</command>:
9454 <literallayout class="monospaced">
9455 ^\N\d+\.a\.b\N data for <digits>.a.b
9458 Note the use of <literal>\N</literal> to disable expansion of the contents of the regular
9459 expression. If you are using <command>nwildlsearch</command>, where the keys are not
9460 string-expanded, the equivalent entry is:
9462 <literallayout class="monospaced">
9463 ^\d+\.a\.b data for <digits>.a.b
9466 The case-insensitive flag is set at the start of compiling the regular
9467 expression, but it can be turned off by using <literal>(-i)</literal> at an appropriate point.
9468 For example, to make the entire pattern case-sensitive:
9470 <literallayout class="monospaced">
9471 ^(?-i)\d+\.a\.b data for <digits>.a.b
9474 If the regular expression contains white space or colon characters, you must
9475 either quote it (see <command>lsearch</command> above), or represent these characters in other
9476 ways. For example, <literal>\s</literal> can be used for white space and <literal>\x3A</literal> for a
9477 colon. This may be easier than quoting, because if you quote, you have to
9478 escape all the backslashes inside the quotes.
9481 <emphasis role="bold">Note</emphasis>: It is not possible to capture substrings in a regular expression
9482 match for later use, because the results of all lookups are cached. If a lookup
9483 is repeated, the result is taken from the cache, and no actual pattern matching
9484 takes place. The values of all the numeric variables are unset after a
9485 <command>(n)wildlsearch</command> match.
9490 Although I cannot see it being of much use, the general matching function that
9491 is used to implement <command>(n)wildlsearch</command> means that the string may begin with a
9492 lookup name terminated by a semicolon, and followed by lookup data. For
9495 <literallayout class="monospaced">
9496 cdb;/some/file data for keys that match the file
9499 The data that is obtained from the nested lookup is discarded.
9504 Keys that do not match any of these patterns are interpreted literally. The
9505 continuation rules for the data are the same as for <command>lsearch</command>, and keys may
9506 be followed by optional colons.
9509 <emphasis role="bold">Warning</emphasis>: Unlike most other single-key lookup types, a file of data for
9510 <command>(n)wildlsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9511 lookup types support only literal keys.
9516 <section id="SECID62">
9517 <title>Query-style lookup types</title>
9519 <indexterm role="concept">
9520 <primary>lookup</primary>
9521 <secondary>query-style types</secondary>
9523 <indexterm role="concept">
9524 <primary>query-style lookup</primary>
9525 <secondary>list of types</secondary>
9527 The supported query-style lookup types are listed below. Further details about
9528 many of them are given in later sections.
9533 <indexterm role="concept">
9534 <primary>DNS</primary>
9535 <secondary>as a lookup type</secondary>
9537 <indexterm role="concept">
9538 <primary>lookup</primary>
9539 <secondary>DNS</secondary>
9541 <command>dnsdb</command>: This does a DNS search for one or more records whose domain names
9542 are given in the supplied query. The resulting data is the contents of the
9543 records. See section <xref linkend="SECTdnsdb"/>.
9548 <indexterm role="concept">
9549 <primary>InterBase lookup type</primary>
9551 <indexterm role="concept">
9552 <primary>lookup</primary>
9553 <secondary>InterBase</secondary>
9555 <command>ibase</command>: This does a lookup in an InterBase database.
9560 <indexterm role="concept">
9561 <primary>LDAP</primary>
9562 <secondary>lookup type</secondary>
9564 <indexterm role="concept">
9565 <primary>lookup</primary>
9566 <secondary>LDAP</secondary>
9568 <command>ldap</command>: This does an LDAP lookup using a query in the form of a URL, and
9569 returns attributes from a single entry. There is a variant called <command>ldapm</command>
9570 that permits values from multiple entries to be returned. A third variant
9571 called <command>ldapdn</command> returns the Distinguished Name of a single entry instead of
9572 any attribute values. See section <xref linkend="SECTldap"/>.
9577 <indexterm role="concept">
9578 <primary>MySQL</primary>
9579 <secondary>lookup type</secondary>
9581 <indexterm role="concept">
9582 <primary>lookup</primary>
9583 <secondary>MySQL</secondary>
9585 <command>mysql</command>: The format of the query is an SQL statement that is passed to a
9586 MySQL database. See section <xref linkend="SECTsql"/>.
9591 <indexterm role="concept">
9592 <primary>NIS+ lookup type</primary>
9594 <indexterm role="concept">
9595 <primary>lookup</primary>
9596 <secondary>NIS+</secondary>
9598 <command>nisplus</command>: This does a NIS+ lookup using a query that can specify the name of
9599 the field to be returned. See section <xref linkend="SECTnisplus"/>.
9604 <indexterm role="concept">
9605 <primary>Oracle</primary>
9606 <secondary>lookup type</secondary>
9608 <indexterm role="concept">
9609 <primary>lookup</primary>
9610 <secondary>Oracle</secondary>
9612 <command>oracle</command>: The format of the query is an SQL statement that is passed to an
9613 Oracle database. See section <xref linkend="SECTsql"/>.
9618 <indexterm role="concept">
9619 <primary>lookup</primary>
9620 <secondary>passwd</secondary>
9622 <indexterm role="concept">
9623 <primary>passwd lookup type</primary>
9625 <indexterm role="concept">
9626 <primary><filename>/etc/passwd</filename></primary>
9628 <command>passwd</command> is a query-style lookup with queries that are just user names. The
9629 lookup calls <function>getpwnam()</function> to interrogate the system password data, and on
9630 success, the result string is the same as you would get from an <command>lsearch</command>
9631 lookup on a traditional <filename>/etc/passwd file</filename>, though with <literal>*</literal> for the
9632 password value. For example:
9634 <literallayout class="monospaced">
9635 *:42:42:King Rat:/home/kr:/bin/bash
9640 <indexterm role="concept">
9641 <primary>PostgreSQL lookup type</primary>
9643 <indexterm role="concept">
9644 <primary>lookup</primary>
9645 <secondary>PostgreSQL</secondary>
9647 <command>pgsql</command>: The format of the query is an SQL statement that is passed to a
9648 PostgreSQL database. See section <xref linkend="SECTsql"/>.
9653 <indexterm role="concept">
9654 <primary>sqlite lookup type</primary>
9656 <indexterm role="concept">
9657 <primary>lookup</primary>
9658 <secondary>sqlite</secondary>
9660 <command>sqlite</command>: The format of the query is a file name followed by an SQL statement
9661 that is passed to an SQLite database. See section <xref linkend="SECTsqlite"/>.
9666 <command>testdb</command>: This is a lookup type that is used for testing Exim. It is
9667 not likely to be useful in normal operation.
9672 <indexterm role="concept">
9673 <primary>whoson lookup type</primary>
9675 <indexterm role="concept">
9676 <primary>lookup</primary>
9677 <secondary>whoson</secondary>
9679 <command>whoson</command>: <emphasis>Whoson</emphasis> (<emphasis role="bold"><ulink url="http://whoson.sourceforge.net">http://whoson.sourceforge.net</ulink></emphasis>) is a protocol that
9680 allows a server to check whether a particular (dynamically allocated) IP
9681 address is currently allocated to a known (trusted) user and, optionally, to
9682 obtain the identity of the said user. For SMTP servers, <emphasis>Whoson</emphasis> was popular
9683 at one time for <quote>POP before SMTP</quote> authentication, but that approach has been
9684 superseded by SMTP authentication. In Exim, <emphasis>Whoson</emphasis> can be used to implement
9685 <quote>POP before SMTP</quote> checking using ACL statements such as
9687 <literallayout class="monospaced">
9688 require condition = \
9689 ${lookup whoson {$sender_host_address}{yes}{no}}
9692 The query consists of a single IP address. The value returned is the name of
9693 the authenticated user, which is stored in the variable <varname>$value</varname>. However, in
9694 this example, the data in <varname>$value</varname> is not used; the result of the lookup is
9695 one of the fixed strings <quote>yes</quote> or <quote>no</quote>.
9700 <section id="SECID63">
9701 <title>Temporary errors in lookups</title>
9703 <indexterm role="concept">
9704 <primary>lookup</primary>
9705 <secondary>temporary error in</secondary>
9707 Lookup functions can return temporary error codes if the lookup cannot be
9708 completed. For example, an SQL or LDAP database might be unavailable. For this
9709 reason, it is not advisable to use a lookup that might do this for critical
9710 options such as a list of local domains.
9713 When a lookup cannot be completed in a router or transport, delivery
9714 of the message (to the relevant address) is deferred, as for any other
9715 temporary error. In other circumstances Exim may assume the lookup has failed,
9716 or may give up altogether.
9719 <section id="SECTdefaultvaluelookups">
9720 <title>Default values in single-key lookups</title>
9722 <indexterm role="concept">
9723 <primary>wildcard lookups</primary>
9725 <indexterm role="concept">
9726 <primary>lookup</primary>
9727 <secondary>default values</secondary>
9729 <indexterm role="concept">
9730 <primary>lookup</primary>
9731 <secondary>wildcard</secondary>
9733 <indexterm role="concept">
9734 <primary>lookup</primary>
9735 <secondary>* added to type</secondary>
9737 <indexterm role="concept">
9738 <primary>default</primary>
9739 <secondary>in single-key lookups</secondary>
9741 In this context, a <quote>default value</quote> is a value specified by the administrator
9742 that is to be used if a lookup fails.
9745 <emphasis role="bold">Note:</emphasis> This section applies only to single-key lookups. For query-style
9746 lookups, the facilities of the query language must be used. An attempt to
9747 specify a default for a query-style lookup provokes an error.
9750 If <quote>*</quote> is added to a single-key lookup type (for example, <option>lsearch*</option>)
9751 and the initial lookup fails, the key <quote>*</quote> is looked up in the file to
9752 provide a default value. See also the section on partial matching below.
9755 <indexterm role="concept">
9756 <primary>*@ with single-key lookup</primary>
9758 <indexterm role="concept">
9759 <primary>lookup</primary>
9760 <secondary>*@ added to type</secondary>
9762 <indexterm role="concept">
9763 <primary>alias file</primary>
9764 <secondary>per-domain default</secondary>
9766 Alternatively, if <quote>*@</quote> is added to a single-key lookup type (for example
9767 <option>dbm*@</option>) then, if the initial lookup fails and the key contains an @
9768 character, a second lookup is done with everything before the last @ replaced
9769 by *. This makes it possible to provide per-domain defaults in alias files
9770 that include the domains in the keys. If the second lookup fails (or doesn’t
9771 take place because there is no @ in the key), <quote>*</quote> is looked up.
9772 For example, a <command>redirect</command> router might contain:
9774 <literallayout class="monospaced">
9775 data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}}
9778 Suppose the address that is being processed is <emphasis>jane@eyre.example</emphasis>. Exim
9779 looks up these keys, in this order:
9781 <literallayout class="monospaced">
9787 The data is taken from whichever key it finds first. <emphasis role="bold">Note</emphasis>: In an
9788 <command>lsearch</command> file, this does not mean the first of these keys in the file. A
9789 complete scan is done for each key, and only if it is not found at all does
9790 Exim move on to try the next key.
9793 <section id="SECTpartiallookup">
9794 <title>Partial matching in single-key lookups</title>
9796 <indexterm role="concept">
9797 <primary>partial matching</primary>
9799 <indexterm role="concept">
9800 <primary>wildcard lookups</primary>
9802 <indexterm role="concept">
9803 <primary>lookup</primary>
9804 <secondary>partial matching</secondary>
9806 <indexterm role="concept">
9807 <primary>lookup</primary>
9808 <secondary>wildcard</secondary>
9810 <indexterm role="concept">
9811 <primary>asterisk</primary>
9812 <secondary>in search type</secondary>
9814 The normal operation of a single-key lookup is to search the file for an exact
9815 match with the given key. However, in a number of situations where domains are
9816 being looked up, it is useful to be able to do partial matching. In this case,
9817 information in the file that has a key starting with <quote>*.</quote> is matched by any
9818 domain that ends with the components that follow the full stop. For example, if
9819 a key in a DBM file is
9821 <literallayout class="monospaced">
9822 *.dates.fict.example
9825 then when partial matching is enabled this is matched by (amongst others)
9826 <emphasis>2001.dates.fict.example</emphasis> and <emphasis>1984.dates.fict.example</emphasis>. It is also matched
9827 by <emphasis>dates.fict.example</emphasis>, if that does not appear as a separate key in the
9831 <emphasis role="bold">Note</emphasis>: Partial matching is not available for query-style lookups. It is
9832 also not available for any lookup items in address lists (see section
9833 <xref linkend="SECTaddresslist"/>).
9836 Partial matching is implemented by doing a series of separate lookups using
9837 keys constructed by modifying the original subject key. This means that it can
9838 be used with any of the single-key lookup types, provided that
9839 partial matching keys
9840 beginning with a special prefix (default <quote>*.</quote>) are included in the data file.
9841 Keys in the file that do not begin with the prefix are matched only by
9842 unmodified subject keys when partial matching is in use.
9845 Partial matching is requested by adding the string <quote>partial-</quote> to the front of
9846 the name of a single-key lookup type, for example, <option>partial-dbm</option>. When this
9847 is done, the subject key is first looked up unmodified; if that fails, <quote>*.</quote>
9848 is added at the start of the subject key, and it is looked up again. If that
9849 fails, further lookups are tried with dot-separated components removed from the
9850 start of the subject key, one-by-one, and <quote>*.</quote> added on the front of what
9854 A minimum number of two non-* components are required. This can be adjusted
9855 by including a number before the hyphen in the search type. For example,
9856 <option>partial3-lsearch</option> specifies a minimum of three non-* components in the
9857 modified keys. Omitting the number is equivalent to <quote>partial2-</quote>. If the
9858 subject key is <emphasis>2250.dates.fict.example</emphasis> then the following keys are looked
9859 up when the minimum number of non-* components is two:
9861 <literallayout class="monospaced">
9862 2250.dates.fict.example
9863 *.2250.dates.fict.example
9864 *.dates.fict.example
9868 As soon as one key in the sequence is successfully looked up, the lookup
9872 <indexterm role="concept">
9873 <primary>lookup</primary>
9874 <secondary>partial matching – changing prefix</secondary>
9876 <indexterm role="concept">
9877 <primary>prefix</primary>
9878 <secondary>for partial matching</secondary>
9880 The use of <quote>*.</quote> as the partial matching prefix is a default that can be
9881 changed. The motivation for this feature is to allow Exim to operate with file
9882 formats that are used by other MTAs. A different prefix can be supplied in
9883 parentheses instead of the hyphen after <quote>partial</quote>. For example:
9885 <literallayout class="monospaced">
9886 domains = partial(.)lsearch;/some/file
9889 In this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
9890 <literal>a.b.c</literal>, <literal>.a.b.c</literal>, and <literal>.b.c</literal> (the default minimum of 2 non-wild
9891 components is unchanged). The prefix may consist of any punctuation characters
9892 other than a closing parenthesis. It may be empty, for example:
9894 <literallayout class="monospaced">
9895 domains = partial1()cdb;/some/file
9898 For this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
9899 <literal>a.b.c</literal>, <literal>b.c</literal>, and <literal>c</literal>.
9902 If <quote>partial0</quote> is specified, what happens at the end (when the lookup with
9903 just one non-wild component has failed, and the original key is shortened right
9904 down to the null string) depends on the prefix:
9909 If the prefix has zero length, the whole lookup fails.
9914 If the prefix has length 1, a lookup for just the prefix is done. For
9915 example, the final lookup for <quote>partial0(.)</quote> is for <literal>.</literal> alone.
9920 Otherwise, if the prefix ends in a dot, the dot is removed, and the
9921 remainder is looked up. With the default prefix, therefore, the final lookup is
9922 for <quote>*</quote> on its own.
9927 Otherwise, the whole prefix is looked up.
9932 If the search type ends in <quote>*</quote> or <quote>*@</quote> (see section
9933 <xref linkend="SECTdefaultvaluelookups"/> above), the search for an ultimate default that
9934 this implies happens after all partial lookups have failed. If <quote>partial0</quote> is
9935 specified, adding <quote>*</quote> to the search type has no effect with the default
9936 prefix, because the <quote>*</quote> key is already included in the sequence of partial
9937 lookups. However, there might be a use for lookup types such as
9938 <quote>partial0(.)lsearch*</quote>.
9941 The use of <quote>*</quote> in lookup partial matching differs from its use as a wildcard
9942 in domain lists and the like. Partial matching works only in terms of
9943 dot-separated components; a key such as <literal>*fict.example</literal>
9944 in a database file is useless, because the asterisk in a partial matching
9945 subject key is always followed by a dot.
9948 <section id="SECID64">
9949 <title>Lookup caching</title>
9951 <indexterm role="concept">
9952 <primary>lookup</primary>
9953 <secondary>caching</secondary>
9955 <indexterm role="concept">
9956 <primary>caching</primary>
9957 <secondary>lookup data</secondary>
9959 Exim caches all lookup results in order to avoid needless repetition of
9960 lookups. However, because (apart from the daemon) Exim operates as a collection
9961 of independent, short-lived processes, this caching applies only within a
9962 single Exim process. There is no inter-process lookup caching facility.
9965 For single-key lookups, Exim keeps the relevant files open in case there is
9966 another lookup that needs them. In some types of configuration this can lead to
9967 many files being kept open for messages with many recipients. To avoid hitting
9968 the operating system limit on the number of simultaneously open files, Exim
9969 closes the least recently used file when it needs to open more files than its
9970 own internal limit, which can be changed via the <option>lookup_open_max</option> option.
9973 The single-key lookup files are closed and the lookup caches are flushed at
9974 strategic points during delivery – for example, after all routing is
9978 <section id="SECID65">
9979 <title>Quoting lookup data</title>
9981 <indexterm role="concept">
9982 <primary>lookup</primary>
9983 <secondary>quoting</secondary>
9985 <indexterm role="concept">
9986 <primary>quoting</primary>
9987 <secondary>in lookups</secondary>
9989 When data from an incoming message is included in a query-style lookup, there
9990 is the possibility of special characters in the data messing up the syntax of
9991 the query. For example, a NIS+ query that contains
9993 <literallayout class="monospaced">
9997 will be broken if the local part happens to contain a closing square bracket.
9998 For NIS+, data can be enclosed in double quotes like this:
10000 <literallayout class="monospaced">
10001 [name="$local_part"]
10004 but this still leaves the problem of a double quote in the data. The rule for
10005 NIS+ is that double quotes must be doubled. Other lookup types have different
10006 rules, and to cope with the differing requirements, an expansion operator
10007 of the following form is provided:
10009 <literallayout class="monospaced">
10010 ${quote_<lookup-type>:<string>}
10013 For example, the safest way to write the NIS+ query is
10015 <literallayout class="monospaced">
10016 [name="${quote_nisplus:$local_part}"]
10019 See chapter <xref linkend="CHAPexpand"/> for full coverage of string expansions. The quote
10020 operator can be used for all lookup types, but has no effect for single-key
10021 lookups, since no quoting is ever needed in their key strings.
10024 <section id="SECTdnsdb">
10025 <title>More about dnsdb</title>
10027 <indexterm role="concept">
10028 <primary>dnsdb lookup</primary>
10030 <indexterm role="concept">
10031 <primary>lookup</primary>
10032 <secondary>dnsdb</secondary>
10034 <indexterm role="concept">
10035 <primary>DNS</primary>
10036 <secondary>as a lookup type</secondary>
10038 The <command>dnsdb</command> lookup type uses the DNS as its database. A simple query consists
10039 of a record type and a domain name, separated by an equals sign. For example,
10040 an expansion string could contain:
10042 <literallayout class="monospaced">
10043 ${lookup dnsdb{mx=a.b.example}{$value}fail}
10046 If the lookup succeeds, the result is placed in <varname>$value</varname>, which in this case
10047 is used on its own as the result. If the lookup does not succeed, the
10048 <literal>fail</literal> keyword causes a <emphasis>forced expansion failure</emphasis> – see section
10049 <xref linkend="SECTforexpfai"/> for an explanation of what this means.
10052 The supported DNS record types are A, CNAME, MX, NS, PTR, SRV, and TXT, and,
10053 when Exim is compiled with IPv6 support, AAAA (and A6 if that is also
10054 configured). If no type is given, TXT is assumed. When the type is PTR,
10055 the data can be an IP address, written as normal; inversion and the addition of
10056 <option>in-addr.arpa</option> or <option>ip6.arpa</option> happens automatically. For example:
10058 <literallayout class="monospaced">
10059 ${lookup dnsdb{ptr=192.168.4.5}{$value}fail}
10062 If the data for a PTR record is not a syntactically valid IP address, it is not
10063 altered and nothing is added.
10066 <indexterm role="concept">
10067 <primary>MX record</primary>
10068 <secondary>in <command>dnsdb</command> lookup</secondary>
10070 <indexterm role="concept">
10071 <primary>SRV record</primary>
10072 <secondary>in <command>dnsdb</command> lookup</secondary>
10074 For an MX lookup, both the preference value and the host name are returned for
10075 each record, separated by a space. For an SRV lookup, the priority, weight,
10076 port, and host name are returned for each record, separated by spaces.
10079 For any record type, if multiple records are found (or, for A6 lookups, if a
10080 single record leads to multiple addresses), the data is returned as a
10081 concatenation, with newline as the default separator. The order, of course,
10082 depends on the DNS resolver. You can specify a different separator character
10083 between multiple records by putting a right angle-bracket followed immediately
10084 by the new separator at the start of the query. For example:
10086 <literallayout class="monospaced">
10087 ${lookup dnsdb{>: a=host1.example}}
10090 It is permitted to specify a space as the separator character. Further
10091 white space is ignored.
10093 <para revisionflag="changed">
10094 <indexterm role="concept">
10095 <primary>TXT record</primary>
10096 <secondary>in <command>dnsdb</command> lookup</secondary>
10098 For TXT records with multiple items of data, only the first item is returned,
10099 unless a separator for them is specified using a comma after the separator
10100 character followed immediately by the TXT record item separator. To concatenate
10101 items without a separator, use a semicolon instead.
10103 <literallayout class="monospaced" revisionflag="changed">
10104 ${lookup dnsdb{>\n,: txt=a.b.example}}
10105 ${lookup dnsdb{>\n; txt=a.b.example}}
10107 <para revisionflag="changed">
10108 It is permitted to specify a space as the separator character. Further
10109 white space is ignored.
10112 <section id="SECID66">
10113 <title>Pseudo dnsdb record types</title>
10115 <indexterm role="concept">
10116 <primary>MX record</primary>
10117 <secondary>in <command>dnsdb</command> lookup</secondary>
10119 By default, both the preference value and the host name are returned for
10120 each MX record, separated by a space. If you want only host names, you can use
10121 the pseudo-type MXH:
10123 <literallayout class="monospaced">
10124 ${lookup dnsdb{mxh=a.b.example}}
10127 In this case, the preference values are omitted, and just the host names are
10131 <indexterm role="concept">
10132 <primary>name server for enclosing domain</primary>
10134 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
10135 records on the given domain, but if none are found, it removes the first
10136 component of the domain name, and tries again. This process continues until NS
10137 records are found or there are no more components left (or there is a DNS
10138 error). In other words, it may return the name servers for a top-level domain,
10139 but it never returns the root name servers. If there are no NS records for the
10140 top-level domain, the lookup fails. Consider these examples:
10142 <literallayout class="monospaced">
10143 ${lookup dnsdb{zns=xxx.quercite.com}}
10144 ${lookup dnsdb{zns=xxx.edu}}
10147 Assuming that in each case there are no NS records for the full domain name,
10148 the first returns the name servers for <option>quercite.com</option>, and the second returns
10149 the name servers for <option>edu</option>.
10152 You should be careful about how you use this lookup because, unless the
10153 top-level domain does not exist, the lookup always returns some host names. The
10154 sort of use to which this might be put is for seeing if the name servers for a
10155 given domain are on a blacklist. You can probably assume that the name servers
10156 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
10160 <indexterm role="concept">
10161 <primary>CSA</primary>
10162 <secondary>in <command>dnsdb</command> lookup</secondary>
10164 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
10165 records according to the CSA rules, which are described in section
10166 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
10167 not sufficient because of the extra parent domain search behaviour of CSA. The
10168 result of a successful lookup such as:
10170 <literallayout class="monospaced">
10171 ${lookup dnsdb {csa=$sender_helo_name}}
10174 has two space-separated fields: an authorization code and a target host name.
10175 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
10176 authorization required but absent, or <quote>?</quote> for unknown.
10179 <section id="SECID67">
10180 <title>Multiple dnsdb lookups</title>
10182 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
10183 However, you can specify a list of domains or IP addresses in a single
10184 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
10185 the default separator, but with the ability to change this. For example:
10187 <literallayout class="monospaced">
10188 ${lookup dnsdb{one.domain.com:two.domain.com}}
10189 ${lookup dnsdb{a=one.host.com:two.host.com}}
10190 ${lookup dnsdb{ptr = <; 1.2.3.4 ; 4.5.6.8}}
10193 In order to retain backwards compatibility, there is one special case: if
10194 the lookup type is PTR and no change of separator is specified, Exim looks
10195 to see if the rest of the string is precisely one IPv6 address. In this
10196 case, it does not treat it as a list.
10199 The data from each lookup is concatenated, with newline separators by default,
10200 in the same way that multiple DNS records for a single item are handled. A
10201 different separator can be specified, as described above.
10204 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
10205 temporary DNS error for any of them, the behaviour is controlled by
10206 an optional keyword followed by a comma that may appear before the record
10207 type. The possible keywords are <quote>defer_strict</quote>, <quote>defer_never</quote>, and
10208 <quote>defer_lax</quote>. With <quote>strict</quote> behaviour, any temporary DNS error causes the
10209 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
10210 ignored, and the behaviour is as if the DNS lookup failed to find anything.
10211 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
10212 error causes the whole lookup to defer only if none of the other lookups
10213 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
10215 <literallayout class="monospaced">
10216 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
10217 ${lookup dnsdb{a=one.host.com:two.host.com}}
10220 Thus, in the default case, as long as at least one of the DNS lookups
10221 yields some data, the lookup succeeds.
10224 <section id="SECTldap">
10225 <title>More about LDAP</title>
10227 <indexterm role="concept">
10228 <primary>LDAP</primary>
10229 <secondary>lookup, more about</secondary>
10231 <indexterm role="concept">
10232 <primary>lookup</primary>
10233 <secondary>LDAP</secondary>
10235 <indexterm role="concept">
10236 <primary>Solaris</primary>
10237 <secondary>LDAP</secondary>
10239 The original LDAP implementation came from the University of Michigan; this has
10240 become <quote>Open LDAP</quote>, and there are now two different releases. Another
10241 implementation comes from Netscape, and Solaris 7 and subsequent releases
10242 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
10243 the lookup function level, their error handling is different. For this reason
10244 it is necessary to set a compile-time variable when building Exim with LDAP, to
10245 indicate which LDAP library is in use. One of the following should appear in
10246 your <filename>Local/Makefile</filename>:
10248 <literallayout class="monospaced">
10249 LDAP_LIB_TYPE=UMICHIGAN
10250 LDAP_LIB_TYPE=OPENLDAP1
10251 LDAP_LIB_TYPE=OPENLDAP2
10252 LDAP_LIB_TYPE=NETSCAPE
10253 LDAP_LIB_TYPE=SOLARIS
10256 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
10257 same interface as the University of Michigan version.
10260 There are three LDAP lookup types in Exim. These behave slightly differently in
10261 the way they handle the results of a query:
10266 <command>ldap</command> requires the result to contain just one entry; if there are more, it
10272 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
10273 Distinguished Name that is returned rather than any attribute values.
10278 <command>ldapm</command> permits the result to contain more than one entry; the attributes
10279 from all of them are returned.
10284 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
10285 Exim behaves as if the entry did not exist, and the lookup fails. The format of
10286 the data returned by a successful lookup is described in the next section.
10287 First we explain how LDAP queries are coded.
10290 <section id="SECTforldaque">
10291 <title>Format of LDAP queries</title>
10293 <indexterm role="concept">
10294 <primary>LDAP</primary>
10295 <secondary>query format</secondary>
10297 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
10298 the configuration of a <command>redirect</command> router one might have this setting:
10300 <literallayout class="monospaced">
10301 data = ${lookup ldap \
10302 {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
10303 c=UK?mailbox?base?}}
10306 <indexterm role="concept">
10307 <primary>LDAP</primary>
10308 <secondary>with TLS</secondary>
10310 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
10311 secure (encrypted) LDAP connections. The second of these ensures that an
10312 encrypted TLS connection is used.
10315 <section id="SECID68">
10316 <title>LDAP quoting</title>
10318 <indexterm role="concept">
10319 <primary>LDAP</primary>
10320 <secondary>quoting</secondary>
10322 Two levels of quoting are required in LDAP queries, the first for LDAP itself
10323 and the second because the LDAP query is represented as a URL. Furthermore,
10324 within an LDAP query, two different kinds of quoting are required. For this
10325 reason, there are two different LDAP-specific quoting operators.
10328 The <option>quote_ldap</option> operator is designed for use on strings that are part of
10329 filter specifications. Conceptually, it first does the following conversions on
10332 <literallayout class="monospaced">
10339 in accordance with RFC 2254. The resulting string is then quoted according
10340 to the rules for URLs, that is, all non-alphanumeric characters except
10342 <literallayout class="monospaced">
10343 ! $ ' - . _ ( ) * +
10346 are converted to their hex values, preceded by a percent sign. For example:
10348 <literallayout class="monospaced">
10349 ${quote_ldap: a(bc)*, a<yz>; }
10354 <literallayout class="monospaced">
10355 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
10358 Removing the URL quoting, this is (with a leading and a trailing space):
10360 <literallayout class="monospaced">
10361 a\28bc\29\2A, a<yz>;
10364 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
10365 base DN specifications in queries. Conceptually, it first converts the string
10366 by inserting a backslash in front of any of the following characters:
10368 <literallayout class="monospaced">
10369 , + " \ < > ;
10372 It also inserts a backslash before any leading spaces or # characters, and
10373 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
10374 is then quoted according to the rules for URLs. For example:
10376 <literallayout class="monospaced">
10377 ${quote_ldap_dn: a(bc)*, a<yz>; }
10382 <literallayout class="monospaced">
10383 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
10386 Removing the URL quoting, this is (with a trailing space):
10388 <literallayout class="monospaced">
10389 \ a(bc)*\, a\<yz\>\;\
10392 There are some further comments about quoting in the section on LDAP
10393 authentication below.
10396 <section id="SECID69">
10397 <title>LDAP connections</title>
10399 <indexterm role="concept">
10400 <primary>LDAP</primary>
10401 <secondary>connections</secondary>
10403 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
10404 is in use, via a Unix domain socket. The example given above does not specify
10405 an LDAP server. A server that is reached by TCP/IP can be specified in a query
10406 by starting it with
10408 <literallayout class="monospaced">
10409 ldap://<hostname>:<port>/...
10412 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
10413 used. When no server is specified in a query, a list of default servers is
10414 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
10415 colon-separated list of servers which are tried in turn until one successfully
10416 handles a query, or there is a serious error. Successful handling either
10417 returns the requested data, or indicates that it does not exist. Serious errors
10418 are syntactical, or multiple values when only a single value is expected.
10419 Errors which cause the next server to be tried are connection failures, bind
10420 failures, and timeouts.
10423 For each server name in the list, a port number can be given. The standard way
10424 of specifying a host and port is to use a colon separator (RFC 1738). Because
10425 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
10426 doubled. For example
10428 <literallayout class="monospaced">
10429 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
10432 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
10433 to the LDAP library with no server name, and the library’s default (normally
10434 the local host) is used.
10437 If you are using the OpenLDAP library, you can connect to an LDAP server using
10438 a Unix domain socket instead of a TCP/IP connection. This is specified by using
10439 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
10440 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
10444 For this type of connection, instead of a host name for the server, a pathname
10445 for the socket is required, and the port number is not relevant. The pathname
10446 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
10447 the query. In the former case, you can have settings such as
10449 <literallayout class="monospaced">
10450 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
10453 When the pathname is given in the query, you have to escape the slashes as
10454 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
10456 <literallayout class="monospaced">
10457 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
10460 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
10461 a pathname, it uses the Unix domain socket code, even if the query actually
10462 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
10463 socket connection. This behaviour means that you can use a setting of
10464 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
10465 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
10466 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
10470 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
10471 specified, an error is diagnosed. However, if there are more items in
10472 <option>ldap_default_servers</option>, they are tried. In other words:
10477 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
10483 Using <literal>ldapi</literal> with a host name causes an error.
10488 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
10489 <option>ldap_default_servers</option>, does whatever the library does by default.
10492 <section id="SECID70">
10493 <title>LDAP authentication and control information</title>
10495 <indexterm role="concept">
10496 <primary>LDAP</primary>
10497 <secondary>authentication</secondary>
10499 The LDAP URL syntax provides no way of passing authentication and other control
10500 information to the server. To make this possible, the URL in an LDAP query may
10501 be preceded by any number of <<emphasis>name</emphasis>>=<<emphasis>value</emphasis>> settings, separated by
10502 spaces. If a value contains spaces it must be enclosed in double quotes, and
10503 when double quotes are used, backslash is interpreted in the usual way inside
10504 them. The following names are recognized:
10507 <literal>DEREFERENCE</literal> set the dereferencing parameter
10508 <literal>NETTIME </literal> set a timeout for a network operation
10509 <literal>USER </literal> set the DN, for authenticating the LDAP bind
10510 <literal>PASS </literal> set the password, likewise
10511 <literal>REFERRALS </literal> set the referrals parameter
10512 <literal>SIZE </literal> set the limit for the number of entries returned
10513 <literal>TIME </literal> set the maximum waiting time for a query
10516 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
10517 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>. The value of the REFERRALS parameter
10518 must be <quote>follow</quote> (the default) or <quote>nofollow</quote>. The latter stops the LDAP
10519 library from trying to follow referrals issued by the LDAP server.
10522 The name CONNECT is an obsolete name for NETTIME, retained for
10523 backwards compatibility. This timeout (specified as a number of seconds) is
10524 enforced from the client end for operations that can be carried out over a
10525 network. Specifically, it applies to network connections and calls to the
10526 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
10527 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
10528 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
10529 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
10530 Netscape SDK; for OpenLDAP no action is taken.
10533 The TIME parameter (also a number of seconds) is passed to the server to
10534 set a server-side limit on the time taken to complete a search.
10537 Here is an example of an LDAP query in an Exim lookup that uses some of these
10538 values. This is a single line, folded to fit on the page:
10540 <literallayout class="monospaced">
10542 {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
10543 ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
10547 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
10548 any of the auxiliary data. Exim configuration settings that include lookups
10549 which contain password information should be preceded by <quote>hide</quote> to prevent
10550 non-admin users from using the <option>-bP</option> option to see their values.
10553 The auxiliary data items may be given in any order. The default is no
10554 connection timeout (the system timeout is used), no user or password, no limit
10555 on the number of entries returned, and no time limit on queries.
10558 When a DN is quoted in the USER= setting for LDAP authentication, Exim
10559 removes any URL quoting that it may contain before passing it LDAP. Apparently
10560 some libraries do this for themselves, but some do not. Removing the URL
10561 quoting has two advantages:
10566 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
10567 DNs as with DNs inside actual queries.
10572 It permits spaces inside USER= DNs.
10577 For example, a setting such as
10579 <literallayout class="monospaced">
10580 USER=cn=${quote_ldap_dn:$1}
10583 should work even if <varname>$1</varname> contains spaces.
10586 Expanded data for the PASS= value should be quoted using the <option>quote</option>
10587 expansion operator, rather than the LDAP quote operators. The only reason this
10588 field needs quoting is to ensure that it conforms to the Exim syntax, which
10589 does not allow unquoted spaces. For example:
10591 <literallayout class="monospaced">
10595 The LDAP authentication mechanism can be used to check passwords as part of
10596 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
10597 <xref linkend="CHAPexpand"/>.
10600 <section id="SECID71">
10601 <title>Format of data returned by LDAP</title>
10603 <indexterm role="concept">
10604 <primary>LDAP</primary>
10605 <secondary>returned data formats</secondary>
10607 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
10608 as a sequence of values, for example
10610 <literallayout class="monospaced">
10611 cn=manager, o=University of Cambridge, c=UK
10614 The <command>ldap</command> lookup type generates an error if more than one entry matches the
10615 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
10616 the result between the data from different entries. It is possible for multiple
10617 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
10618 you know that whatever values are returned all came from a single entry in the
10622 In the common case where you specify a single attribute in your LDAP query, the
10623 result is not quoted, and does not contain the attribute name. If the attribute
10624 has multiple values, they are separated by commas.
10627 If you specify multiple attributes, the result contains space-separated, quoted
10628 strings, each preceded by the attribute name and an equals sign. Within the
10629 quotes, the quote character, backslash, and newline are escaped with
10630 backslashes, and commas are used to separate multiple values for the attribute.
10631 Apart from the escaping, the string within quotes takes the same form as the
10632 output when a single attribute is requested. Specifying no attributes is the
10633 same as specifying all of an entry’s attributes.
10636 Here are some examples of the output format. The first line of each pair is an
10637 LDAP query, and the second is the data that is returned. The attribute called
10638 <option>attr1</option> has two values, whereas <option>attr2</option> has only one value:
10640 <literallayout class="monospaced">
10641 ldap:///o=base?attr1?sub?(uid=fred)
10644 ldap:///o=base?attr2?sub?(uid=fred)
10647 ldap:///o=base?attr1,attr2?sub?(uid=fred)
10648 attr1="value1.1, value1.2" attr2="value two"
10650 ldap:///o=base??sub?(uid=fred)
10651 objectClass="top" attr1="value1.1, value1.2" attr2="value two"
10654 The <option>extract</option> operator in string expansions can be used to pick out
10655 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs. You can
10656 make use of Exim’s <option>-be</option> option to run expansion tests and thereby check the
10657 results of LDAP lookups.
10660 <section id="SECTnisplus">
10661 <title>More about NIS+</title>
10663 <indexterm role="concept">
10664 <primary>NIS+ lookup type</primary>
10666 <indexterm role="concept">
10667 <primary>lookup</primary>
10668 <secondary>NIS+</secondary>
10670 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
10671 and field name. If this is given, the result of a successful query is the
10672 contents of the named field; otherwise the result consists of a concatenation
10673 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
10674 values containing spaces are quoted. For example, the query
10676 <literallayout class="monospaced">
10677 [name=mg1456],passwd.org_dir
10680 might return the string
10682 <literallayout class="monospaced">
10683 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
10684 home=/home/mg1456 shell=/bin/bash shadow=""
10687 (split over two lines here to fit on the page), whereas
10689 <literallayout class="monospaced">
10690 [name=mg1456],passwd.org_dir:gcos
10695 <literallayout class="monospaced">
10699 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
10700 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
10701 operator is to double any quote characters within the text.
10704 <section id="SECTsql">
10705 <title>SQL lookups</title>
10707 <indexterm role="concept">
10708 <primary>SQL lookup types</primary>
10710 <indexterm role="concept">
10711 <primary>MySQL</primary>
10712 <secondary>lookup type</secondary>
10714 <indexterm role="concept">
10715 <primary>PostgreSQL lookup type</primary>
10717 <indexterm role="concept">
10718 <primary>lookup</primary>
10719 <secondary>MySQL</secondary>
10721 <indexterm role="concept">
10722 <primary>lookup</primary>
10723 <secondary>PostgreSQL</secondary>
10725 <indexterm role="concept">
10726 <primary>Oracle</primary>
10727 <secondary>lookup type</secondary>
10729 <indexterm role="concept">
10730 <primary>lookup</primary>
10731 <secondary>Oracle</secondary>
10733 <indexterm role="concept">
10734 <primary>InterBase lookup type</primary>
10736 <indexterm role="concept">
10737 <primary>lookup</primary>
10738 <secondary>InterBase</secondary>
10740 Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, and SQLite
10741 databases. Queries for these databases contain SQL statements, so an example
10744 <literallayout class="monospaced">
10745 ${lookup mysql{select mailbox from users where id='userx'}\
10749 If the result of the query contains more than one field, the data for each
10750 field in the row is returned, preceded by its name, so the result of
10752 <literallayout class="monospaced">
10753 ${lookup pgsql{select home,name from users where id='userx'}\
10759 <literallayout class="monospaced">
10760 home=/home/userx name="Mister X"
10763 Empty values and values containing spaces are double quoted, with embedded
10764 quotes escaped by a backslash. If the result of the query contains just one
10765 field, the value is passed back verbatim, without a field name, for example:
10767 <literallayout class="monospaced">
10771 If the result of the query yields more than one row, it is all concatenated,
10772 with a newline between the data for each row.
10775 <section id="SECID72">
10776 <title>More about MySQL, PostgreSQL, Oracle, and InterBase</title>
10778 <indexterm role="concept">
10779 <primary>MySQL</primary>
10780 <secondary>lookup type</secondary>
10782 <indexterm role="concept">
10783 <primary>PostgreSQL lookup type</primary>
10785 <indexterm role="concept">
10786 <primary>lookup</primary>
10787 <secondary>MySQL</secondary>
10789 <indexterm role="concept">
10790 <primary>lookup</primary>
10791 <secondary>PostgreSQL</secondary>
10793 <indexterm role="concept">
10794 <primary>Oracle</primary>
10795 <secondary>lookup type</secondary>
10797 <indexterm role="concept">
10798 <primary>lookup</primary>
10799 <secondary>Oracle</secondary>
10801 <indexterm role="concept">
10802 <primary>InterBase lookup type</primary>
10804 <indexterm role="concept">
10805 <primary>lookup</primary>
10806 <secondary>InterBase</secondary>
10808 If any MySQL, PostgreSQL, Oracle, or InterBase lookups are used, the
10809 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, or <option>ibase_servers</option>
10810 option (as appropriate) must be set to a colon-separated list of server
10812 (For MySQL and PostgreSQL only, the global option need not be set if all
10813 queries contain their own server information – see section
10814 <xref linkend="SECTspeserque"/>.) Each item in the list is a slash-separated list of four
10815 items: host name, database name, user name, and password. In the case of
10816 Oracle, the host name field is used for the <quote>service name</quote>, and the database
10817 name field is not used and should be empty. For example:
10819 <literallayout class="monospaced">
10820 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
10823 Because password data is sensitive, you should always precede the setting with
10824 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
10825 option. Here is an example where two MySQL servers are listed:
10827 <literallayout class="monospaced">
10828 hide mysql_servers = localhost/users/root/secret:\
10829 otherhost/users/root/othersecret
10832 For MySQL and PostgreSQL, a host may be specified as <<emphasis>name</emphasis>>:<<emphasis>port</emphasis>> but
10833 because this is a colon-separated list, the colon has to be doubled. For each
10834 query, these parameter groups are tried in order until a connection is made and
10835 a query is successfully processed. The result of a query may be that no data is
10836 found, but that is still a successful query. In other words, the list of
10837 servers provides a backup facility, not a list of different places to look.
10840 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
10841 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
10842 respectively, and the characters single-quote, double-quote, and backslash
10843 itself are escaped with backslashes. The <option>quote_pgsql</option> expansion operator, in
10844 addition, escapes the percent and underscore characters. This cannot be done
10845 for MySQL because these escapes are not recognized in contexts where these
10846 characters are not special.
10849 <section id="SECTspeserque">
10850 <title>Specifying the server in the query</title>
10852 For MySQL and PostgreSQL lookups (but not currently for Oracle and InterBase),
10853 it is possible to specify a list of servers with an individual query. This is
10854 done by starting the query with
10857 <literal>servers=</literal><emphasis>server1:server2:server3:...</emphasis><literal>;</literal>
10860 Each item in the list may take one of two forms:
10862 <orderedlist numeration="arabic">
10865 If it contains no slashes it is assumed to be just a host name. The appropriate
10866 global option (<option>mysql_servers</option> or <option>pgsql_servers</option>) is searched for a host
10867 of the same name, and the remaining parameters (database, user, password) are
10873 If it contains any slashes, it is taken as a complete parameter set.
10878 The list of servers is used in exactly the same way as the global list.
10879 Once a connection to a server has happened and a query has been
10880 successfully executed, processing of the lookup ceases.
10883 This feature is intended for use in master/slave situations where updates
10884 are occurring and you want to update the master rather than a slave. If the
10885 master is in the list as a backup for reading, you might have a global setting
10888 <literallayout class="monospaced">
10889 mysql_servers = slave1/db/name/pw:\
10890 slave2/db/name/pw:\
10894 In an updating lookup, you could then write:
10896 <literallayout class="monospaced">
10897 ${lookup mysql{servers=master; UPDATE ...} }
10900 That query would then be sent only to the master server. If, on the other hand,
10901 the master is not to be used for reading, and so is not present in the global
10902 option, you can still update it by a query of this form:
10904 <literallayout class="monospaced">
10905 ${lookup pgsql{servers=master/db/name/pw; UPDATE ...} }
10908 <section id="SECID73">
10909 <title>Special MySQL features</title>
10911 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
10912 causes a connection to the server on the local host by means of a Unix domain
10913 socket. An alternate socket can be specified in parentheses. The full syntax of
10914 each item in <option>mysql_servers</option> is:
10917 <<emphasis>hostname</emphasis>>::<<emphasis>port</emphasis>>(<<emphasis>socket name</emphasis>>)/<<emphasis>database</emphasis>>/<<emphasis>user</emphasis>>/<<emphasis>password</emphasis>>
10920 Any of the three sub-parts of the first field can be omitted. For normal use on
10921 the local host it can be left blank or set to just <quote>localhost</quote>.
10924 No database need be supplied – but if it is absent here, it must be given in
10928 If a MySQL query is issued that does not request any data (an insert, update,
10929 or delete command), the result of the lookup is the number of rows affected.
10932 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
10933 anything (for example, setting a field to the value it already has), the result
10934 is zero because no rows are affected.
10937 <section id="SECID74">
10938 <title>Special PostgreSQL features</title>
10940 PostgreSQL lookups can also use Unix domain socket connections to the database.
10941 This is usually faster and costs less CPU time than a TCP/IP connection.
10942 However it can be used only if the mail server runs on the same machine as the
10943 database server. A configuration line for PostgreSQL via Unix domain sockets
10946 <literallayout class="monospaced">
10947 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
10950 In other words, instead of supplying a host name, a path to the socket is
10951 given. The path name is enclosed in parentheses so that its slashes aren’t
10952 visually confused with the delimiters for the other server parameters.
10955 If a PostgreSQL query is issued that does not request any data (an insert,
10956 update, or delete command), the result of the lookup is the number of rows
10960 <section id="SECTsqlite">
10961 <title>More about SQLite</title>
10963 <indexterm role="concept">
10964 <primary>lookup</primary>
10965 <secondary>SQLite</secondary>
10967 <indexterm role="concept">
10968 <primary>sqlite lookup type</primary>
10970 SQLite is different to the other SQL lookups because a file name is required in
10971 addition to the SQL query. An SQLite database is a single file, and there is no
10972 daemon as in the other SQL databases. The interface to Exim requires the name
10973 of the file, as an absolute path, to be given at the start of the query. It is
10974 separated from the query by white space. This means that the path name cannot
10975 contain white space. Here is a lookup expansion example:
10977 <literallayout class="monospaced">
10978 ${lookup sqlite {/some/thing/sqlitedb \
10979 select name from aliases where id='userx';}}
10982 In a list, the syntax is similar. For example:
10984 <literallayout class="monospaced">
10985 domainlist relay_domains = sqlite;/some/thing/sqlitedb \
10986 select * from relays where ip='$sender_host_address';
10989 The only character affected by the <option>quote_sqlite</option> operator is a single
10990 quote, which it doubles.
10993 The SQLite library handles multiple simultaneous accesses to the database
10994 internally. Multiple readers are permitted, but only one process can
10995 update at once. Attempts to access the database while it is being updated
10996 are rejected after a timeout period, during which the SQLite library
10997 waits for the lock to be released. In Exim, the default timeout is set
10998 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
11000 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
11001 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
11006 <chapter id="CHAPdomhosaddlists">
11007 <title>Domain, host, address, and local part lists</title>
11008 <titleabbrev>Domain, host, and address lists</titleabbrev>
11010 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
11011 <primary>lists of domains; hosts; etc.</primary>
11013 A number of Exim configuration options contain lists of domains, hosts,
11014 email addresses, or local parts. For example, the <option>hold_domains</option> option
11015 contains a list of domains whose delivery is currently suspended. These lists
11016 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
11017 arguments to expansion conditions such as <option>match_domain</option>.
11020 Each item in one of these lists is a pattern to be matched against a domain,
11021 host, email address, or local part, respectively. In the sections below, the
11022 different types of pattern for each case are described, but first we cover some
11023 general facilities that apply to all four kinds of list.
11025 <section id="SECID75">
11026 <title>Expansion of lists</title>
11028 <indexterm role="concept">
11029 <primary>expansion</primary>
11030 <secondary>of lists</secondary>
11032 Each list is expanded as a single string before it is used. The result of
11033 expansion must be a list, possibly containing empty items, which is split up
11034 into separate items for matching. By default, colon is the separator character,
11035 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
11036 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
11037 discusses the way to specify empty list items.
11040 If the string expansion is forced to fail, Exim behaves as if the item it is
11041 testing (domain, host, address, or local part) is not in the list. Other
11042 expansion failures cause temporary errors.
11045 If an item in a list is a regular expression, backslashes, dollars and possibly
11046 other special characters in the expression must be protected against
11047 misinterpretation by the string expander. The easiest way to do this is to use
11048 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
11049 expression should not be expanded. For example, in an ACL you might have:
11051 <literallayout class="monospaced">
11052 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
11053 ${lookup{$domain}lsearch{/badsenders/bydomain}}
11056 The first item is a regular expression that is protected from expansion by
11057 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
11058 senders based on the receiving domain.
11061 <section id="SECID76">
11062 <title>Negated items in lists</title>
11064 <indexterm role="concept">
11065 <primary>list</primary>
11066 <secondary>negation</secondary>
11068 <indexterm role="concept">
11069 <primary>negation</primary>
11070 <secondary>in lists</secondary>
11072 Items in a list may be positive or negative. Negative items are indicated by a
11073 leading exclamation mark, which may be followed by optional white space. A list
11074 defines a set of items (domains, etc). When Exim processes one of these lists,
11075 it is trying to find out whether a domain, host, address, or local part
11076 (respectively) is in the set that is defined by the list. It works like this:
11079 The list is scanned from left to right. If a positive item is matched, the
11080 subject that is being checked is in the set; if a negative item is matched, the
11081 subject is not in the set. If the end of the list is reached without the
11082 subject having matched any of the patterns, it is in the set if the last item
11083 was a negative one, but not if it was a positive one. For example, the list in
11085 <literallayout class="monospaced">
11086 domainlist relay_domains = !a.b.c : *.b.c
11089 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
11090 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
11091 list is positive. However, if the setting were
11093 <literallayout class="monospaced">
11094 domainlist relay_domains = !a.b.c
11097 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
11098 list is negative. In other words, a list that ends with a negative item behaves
11099 as if it had an extra item <literal>:*</literal> on the end.
11102 Another way of thinking about positive and negative items in lists is to read
11103 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
11107 <section id="SECTfilnamlis">
11108 <title>File names in lists</title>
11110 <indexterm role="concept">
11111 <primary>list</primary>
11112 <secondary>file name in</secondary>
11114 If an item in a domain, host, address, or local part list is an absolute file
11115 name (beginning with a slash character), each line of the file is read and
11116 processed as if it were an independent item in the list, except that further
11117 file names are not allowed,
11118 and no expansion of the data from the file takes place.
11119 Empty lines in the file are ignored, and the file may also contain comment
11125 For domain and host lists, if a # character appears anywhere in a line of the
11126 file, it and all following characters are ignored.
11131 Because local parts may legitimately contain # characters, a comment in an
11132 address list or local part list file is recognized only if # is preceded by
11133 white space or the start of the line. For example:
11135 <literallayout class="monospaced">
11136 not#comment@x.y.z # but this is a comment
11141 Putting a file name in a list has the same effect as inserting each line of the
11142 file as an item in the list (blank lines and comments excepted). However, there
11143 is one important difference: the file is read each time the list is processed,
11144 so if its contents vary over time, Exim’s behaviour changes.
11147 If a file name is preceded by an exclamation mark, the sense of any match
11148 within the file is inverted. For example, if
11150 <literallayout class="monospaced">
11151 hold_domains = !/etc/nohold-domains
11154 and the file contains the lines
11156 <literallayout class="monospaced">
11161 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
11162 any domain matching <literal>*.b.c</literal> is not.
11165 <section id="SECID77">
11166 <title>An lsearch file is not an out-of-line list</title>
11168 As will be described in the sections that follow, lookups can be used in lists
11169 to provide indexed methods of checking list membership. There has been some
11170 confusion about the way <command>lsearch</command> lookups work in lists. Because
11171 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
11172 sometimes thought that it is allowed to contain wild cards and other kinds of
11173 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
11174 always fixed strings, just as for any other single-key lookup type.
11177 If you want to use a file to contain wild-card patterns that form part of a
11178 list, just give the file name on its own, without a search type, as described
11179 in the previous section. You could also use the <command>wildlsearch</command> or
11180 <command>nwildlsearch</command>, but there is no advantage in doing this.
11183 <section id="SECTnamedlists">
11184 <title>Named lists</title>
11186 <indexterm role="concept">
11187 <primary>named lists</primary>
11189 <indexterm role="concept">
11190 <primary>list</primary>
11191 <secondary>named</secondary>
11193 A list of domains, hosts, email addresses, or local parts can be given a name
11194 which is then used to refer to the list elsewhere in the configuration. This is
11195 particularly convenient if the same list is required in several different
11196 places. It also allows lists to be given meaningful names, which can improve
11197 the readability of the configuration. For example, it is conventional to define
11198 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
11199 locally on a host, using a configuration line such as
11201 <literallayout class="monospaced">
11202 domainlist local_domains = localhost:my.dom.example
11205 Named lists are referenced by giving their name preceded by a plus sign, so,
11206 for example, a router that is intended to handle local domains would be
11207 configured with the line
11209 <literallayout class="monospaced">
11210 domains = +local_domains
11213 The first router in a configuration is often one that handles all domains
11214 except the local ones, using a configuration with a negated item like this:
11216 <literallayout class="monospaced">
11219 domains = ! +local_domains
11220 transport = remote_smtp
11224 The four kinds of named list are created by configuration lines starting with
11225 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
11226 respectively. Then there follows the name that you are defining, followed by an
11227 equals sign and the list itself. For example:
11229 <literallayout class="monospaced">
11230 hostlist relay_hosts = 192.168.23.0/24 : my.friend.example
11231 addresslist bad_senders = cdb;/etc/badsenders
11234 A named list may refer to other named lists:
11236 <literallayout class="monospaced">
11237 domainlist dom1 = first.example : second.example
11238 domainlist dom2 = +dom1 : third.example
11239 domainlist dom3 = fourth.example : +dom2 : fifth.example
11242 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
11243 effect may not be what you intended, because the negation does not propagate
11244 out to the higher level. For example, consider:
11246 <literallayout class="monospaced">
11247 domainlist dom1 = !a.b
11248 domainlist dom2 = +dom1 : *.b
11251 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
11252 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
11253 means it matches the second list as well. The effect is not the same as
11255 <literallayout class="monospaced">
11256 domainlist dom2 = !a.b : *.b
11259 where <emphasis>x.y</emphasis> does not match. It’s best to avoid negation altogether in
11260 referenced lists if you can.
11263 Named lists may have a performance advantage. When Exim is routing an
11264 address or checking an incoming message, it caches the result of tests on named
11265 lists. So, if you have a setting such as
11267 <literallayout class="monospaced">
11268 domains = +local_domains
11271 on several of your routers
11272 or in several ACL statements,
11273 the actual test is done only for the first one. However, the caching works only
11274 if there are no expansions within the list itself or any sublists that it
11275 references. In other words, caching happens only for lists that are known to be
11276 the same each time they are referenced.
11279 By default, there may be up to 16 named lists of each type. This limit can be
11280 extended by changing a compile-time variable. The use of domain and host lists
11281 is recommended for concepts such as local domains, relay domains, and relay
11282 hosts. The default configuration is set up like this.
11285 <section id="SECID78">
11286 <title>Named lists compared with macros</title>
11288 <indexterm role="concept">
11289 <primary>list</primary>
11290 <secondary>named compared with macro</secondary>
11292 <indexterm role="concept">
11293 <primary>macro</primary>
11294 <secondary>compared with named list</secondary>
11296 At first sight, named lists might seem to be no different from macros in the
11297 configuration file. However, macros are just textual substitutions. If you
11300 <literallayout class="monospaced">
11301 ALIST = host1 : host2
11302 auth_advertise_hosts = !ALIST
11305 it probably won’t do what you want, because that is exactly the same as
11307 <literallayout class="monospaced">
11308 auth_advertise_hosts = !host1 : host2
11311 Notice that the second host name is not negated. However, if you use a host
11314 <literallayout class="monospaced">
11315 hostlist alist = host1 : host2
11316 auth_advertise_hosts = ! +alist
11319 the negation applies to the whole list, and so that is equivalent to
11321 <literallayout class="monospaced">
11322 auth_advertise_hosts = !host1 : !host2
11325 <section id="SECID79">
11326 <title>Named list caching</title>
11328 <indexterm role="concept">
11329 <primary>list</primary>
11330 <secondary>caching of named</secondary>
11332 <indexterm role="concept">
11333 <primary>caching</primary>
11334 <secondary>named lists</secondary>
11336 While processing a message, Exim caches the result of checking a named list if
11337 it is sure that the list is the same each time. In practice, this means that
11338 the cache operates only if the list contains no $ characters, which guarantees
11339 that it will not change when it is expanded. Sometimes, however, you may have
11340 an expanded list that you know will be the same each time within a given
11341 message. For example:
11343 <literallayout class="monospaced">
11344 domainlist special_domains = \
11345 ${lookup{$sender_host_address}cdb{/some/file}}
11348 This provides a list of domains that depends only on the sending host’s IP
11349 address. If this domain list is referenced a number of times (for example,
11350 in several ACL lines, or in several routers) the result of the check is not
11351 cached by default, because Exim does not know that it is going to be the
11352 same list each time.
11355 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
11356 cache the result anyway. For example:
11358 <literallayout class="monospaced">
11359 domainlist_cache special_domains = ${lookup{...
11362 If you do this, you should be absolutely sure that caching is going to do
11363 the right thing in all cases. When in doubt, leave it out.
11366 <section id="SECTdomainlist">
11367 <title>Domain lists</title>
11369 <indexterm role="concept">
11370 <primary>domain list</primary>
11371 <secondary>patterns for</secondary>
11373 <indexterm role="concept">
11374 <primary>list</primary>
11375 <secondary>domain list</secondary>
11377 Domain lists contain patterns that are to be matched against a mail domain.
11378 The following types of item may appear in domain lists:
11383 <indexterm role="concept">
11384 <primary>primary host name</primary>
11386 <indexterm role="concept">
11387 <primary>host name</primary>
11388 <secondary>matched in domain list</secondary>
11390 <indexterm role="option">
11391 <primary><option>primary_hostname</option></primary>
11393 <indexterm role="concept">
11394 <primary>domain list</primary>
11395 <secondary>matching primary host name</secondary>
11397 <indexterm role="concept">
11398 <primary>@ in a domain list</primary>
11400 If a pattern consists of a single @ character, it matches the local host name,
11401 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
11402 possible to use the same configuration file on several different hosts that
11403 differ only in their names.
11408 <indexterm role="concept">
11409 <primary>@[] in a domain list</primary>
11411 <indexterm role="concept">
11412 <primary>domain list</primary>
11413 <secondary>matching local IP interfaces</secondary>
11415 <indexterm role="concept">
11416 <primary>domain literal</primary>
11418 If a pattern consists of the string <literal>@[]</literal> it matches an IP address enclosed
11419 in square brackets (as in an email address that contains a domain literal), but
11420 only if that IP address is recognized as local for email routing purposes. The
11421 <option>local_interfaces</option> and <option>extra_local_interfaces</option> options can be used to
11422 control which of a host’s several IP addresses are treated as local.
11423 In today’s Internet, the use of domain literals is controversial.
11428 <indexterm role="concept">
11429 <primary>@mx_any</primary>
11431 <indexterm role="concept">
11432 <primary>@mx_primary</primary>
11434 <indexterm role="concept">
11435 <primary>@mx_secondary</primary>
11437 <indexterm role="concept">
11438 <primary>domain list</primary>
11439 <secondary>matching MX pointers to local host</secondary>
11441 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
11442 has an MX record pointing to the local host or to any host that is listed in
11443 <indexterm role="option">
11444 <primary><option>hosts_treat_as_local</option></primary>
11446 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
11447 are similar, except that the first matches only when a primary MX target is the
11448 local host, and the second only when no primary MX target is the local host,
11449 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
11450 preference value – there may of course be more than one of them.
11453 The MX lookup that takes place when matching a pattern of this type is
11454 performed with the resolver options for widening names turned off. Thus, for
11455 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
11456 resolver’s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
11457 options of the <command>dnslookup</command> router for a discussion of domain widening.
11460 Sometimes you may want to ignore certain IP addresses when using one of these
11461 patterns. You can specify this by following the pattern with <literal>/ignore=</literal><<emphasis>ip
11462 list</emphasis>>, where <<emphasis>ip list</emphasis>> is a list of IP addresses. These addresses are
11463 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
11464 on a router). For example:
11466 <literallayout class="monospaced">
11467 domains = @mx_any/ignore=127.0.0.1
11470 This example matches any domain that has an MX record pointing to one of
11471 the local host’s IP addresses other than 127.0.0.1.
11474 The list of IP addresses is in fact processed by the same code that processes
11475 host lists, so it may contain CIDR-coded network specifications and it may also
11476 contain negative items.
11479 Because the list of IP addresses is a sublist within a domain list, you have to
11480 be careful about delimiters if there is more than one address. Like any other
11481 list, the default delimiter can be changed. Thus, you might have:
11483 <literallayout class="monospaced">
11484 domains = @mx_any/ignore=<;127.0.0.1;0.0.0.0 : \
11485 an.other.domain : ...
11488 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
11489 involved, it is easiest to change the delimiter for the main list as well:
11491 <literallayout class="monospaced">
11492 domains = <? @mx_any/ignore=<;127.0.0.1;::1 ? \
11493 an.other.domain ? ...
11498 <indexterm role="concept">
11499 <primary>asterisk</primary>
11500 <secondary>in domain list</secondary>
11502 <indexterm role="concept">
11503 <primary>domain list</primary>
11504 <secondary>asterisk in</secondary>
11506 <indexterm role="concept">
11507 <primary>domain list</primary>
11508 <secondary>matching <quote>ends with</quote></secondary>
11510 If a pattern starts with an asterisk, the remaining characters of the pattern
11511 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
11512 domain lists differs from its use in partial matching lookups. In a domain
11513 list, the character following the asterisk need not be a dot, whereas partial
11514 matching works only in terms of dot-separated components. For example, a domain
11515 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
11516 <emphasis>cipher.key.ex</emphasis>.
11521 <indexterm role="concept">
11522 <primary>regular expressions</primary>
11523 <secondary>in domain list</secondary>
11525 <indexterm role="concept">
11526 <primary>domain list</primary>
11527 <secondary>matching regular expression</secondary>
11529 If a pattern starts with a circumflex character, it is treated as a regular
11530 expression, and matched against the domain using a regular expression matching
11531 function. The circumflex is treated as part of the regular expression.
11532 Email domains are case-independent, so this regular expression match is by
11533 default case-independent, but you can make it case-dependent by starting it
11534 with <literal>(?-i)</literal>. References to descriptions of the syntax of regular expressions
11535 are given in chapter <xref linkend="CHAPregexp"/>.
11538 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
11539 must escape any backslash and dollar characters in the regular expression, or
11540 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
11541 it is not to be expanded (unless you really do want to build a regular
11542 expression by expansion, of course).
11547 <indexterm role="concept">
11548 <primary>lookup</primary>
11549 <secondary>in domain list</secondary>
11551 <indexterm role="concept">
11552 <primary>domain list</primary>
11553 <secondary>matching by lookup</secondary>
11555 If a pattern starts with the name of a single-key lookup type followed by a
11556 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
11557 must be a file name in a suitable format for the lookup type. For example, for
11558 <quote>cdb;</quote> it must be an absolute path:
11560 <literallayout class="monospaced">
11561 domains = cdb;/etc/mail/local_domains.cdb
11564 The appropriate type of lookup is done on the file using the domain name as the
11565 key. In most cases, the data that is looked up is not used; Exim is interested
11566 only in whether or not the key is present in the file. However, when a lookup
11567 is used for the <option>domains</option> option on a router
11568 or a <option>domains</option> condition in an ACL statement, the data is preserved in the
11569 <varname>$domain_data</varname> variable and can be referred to in other router options or
11570 other statements in the same ACL.
11575 Any of the single-key lookup type names may be preceded by
11576 <literal>partial</literal><<emphasis>n</emphasis>><literal>-</literal>, where the <<emphasis>n</emphasis>> is optional, for example,
11578 <literallayout class="monospaced">
11579 domains = partial-dbm;/partial/domains
11582 This causes partial matching logic to be invoked; a description of how this
11583 works is given in section <xref linkend="SECTpartiallookup"/>.
11588 <indexterm role="concept">
11589 <primary>asterisk</primary>
11590 <secondary>in lookup type</secondary>
11592 Any of the single-key lookup types may be followed by an asterisk. This causes
11593 a default lookup for a key consisting of a single asterisk to be done if the
11594 original lookup fails. This is not a useful feature when using a domain list to
11595 select particular domains (because any domain would match), but it might have
11596 value if the result of the lookup is being used via the <varname>$domain_data</varname>
11597 expansion variable.
11602 If the pattern starts with the name of a query-style lookup type followed by a
11603 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
11604 pattern must be an appropriate query for the lookup type, as described in
11605 chapter <xref linkend="CHAPfdlookup"/>. For example:
11607 <literallayout class="monospaced">
11608 hold_domains = mysql;select domain from holdlist \
11609 where domain = '$domain';
11612 In most cases, the data that is looked up is not used (so for an SQL query, for
11613 example, it doesn’t matter what field you select). Exim is interested only in
11614 whether or not the query succeeds. However, when a lookup is used for the
11615 <option>domains</option> option on a router, the data is preserved in the <varname>$domain_data</varname>
11616 variable and can be referred to in other options.
11621 <indexterm role="concept">
11622 <primary>domain list</primary>
11623 <secondary>matching literal domain name</secondary>
11625 If none of the above cases apply, a caseless textual comparison is made
11626 between the pattern and the domain.
11631 Here is an example that uses several different kinds of pattern:
11633 <literallayout class="monospaced">
11634 domainlist funny_domains = \
11637 *.foundation.fict.example : \
11638 \N^[1-2]\d{3}\.fict\.example$\N : \
11639 partial-dbm;/opt/data/penguin/book : \
11640 nis;domains.byname : \
11641 nisplus;[name=$domain,status=local],domains.org_dir
11644 There are obvious processing trade-offs among the various matching modes. Using
11645 an asterisk is faster than a regular expression, and listing a few names
11646 explicitly probably is too. The use of a file or database lookup is expensive,
11647 but may be the only option if hundreds of names are required. Because the
11648 patterns are tested in order, it makes sense to put the most commonly matched
11652 <section id="SECThostlist">
11653 <title>Host lists</title>
11655 <indexterm role="concept">
11656 <primary>host list</primary>
11657 <secondary>patterns in</secondary>
11659 <indexterm role="concept">
11660 <primary>list</primary>
11661 <secondary>host list</secondary>
11663 Host lists are used to control what remote hosts are allowed to do. For
11664 example, some hosts may be allowed to use the local host as a relay, and some
11665 may be permitted to use the SMTP ETRN command. Hosts can be identified in
11666 two different ways, by name or by IP address. In a host list, some types of
11667 pattern are matched to a host name, and some are matched to an IP address.
11668 You need to be particularly careful with this when single-key lookups are
11669 involved, to ensure that the right value is being used as the key.
11672 <section id="SECID80">
11673 <title>Special host list patterns</title>
11675 <indexterm role="concept">
11676 <primary>empty item in hosts list</primary>
11678 <indexterm role="concept">
11679 <primary>host list</primary>
11680 <secondary>empty string in</secondary>
11682 If a host list item is the empty string, it matches only when no remote host is
11683 involved. This is the case when a message is being received from a local
11684 process using SMTP on the standard input, that is, when a TCP/IP connection is
11688 <indexterm role="concept">
11689 <primary>asterisk</primary>
11690 <secondary>in host list</secondary>
11692 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
11693 the IP address nor the name is actually inspected.
11696 <section id="SECThoslispatip">
11697 <title>Host list patterns that match by IP address</title>
11699 <indexterm role="concept">
11700 <primary>host list</primary>
11701 <secondary>matching IP addresses</secondary>
11703 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
11704 the incoming address actually appears in the IPv6 host as
11705 <literal>::ffff:</literal><<emphasis>v4address</emphasis>>. When such an address is tested against a host
11706 list, it is converted into a traditional IPv4 address first. (Not all operating
11707 systems accept IPv4 calls on IPv6 sockets, as there have been some security
11711 The following types of pattern in a host list check the remote host by
11712 inspecting its IP address:
11717 If the pattern is a plain domain name (not a regular expression, not starting
11718 with *, not a lookup of any kind), Exim calls the operating system function
11719 to find the associated IP address(es). Exim uses the newer
11720 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
11721 This typically causes a forward DNS lookup of the name. The result is compared
11722 with the IP address of the subject host.
11725 If there is a temporary problem (such as a DNS timeout) with the host name
11726 lookup, a temporary error occurs. For example, if the list is being used in an
11727 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
11728 temporary SMTP error code. If no IP address can be found for the host name,
11729 what happens is described in section <xref linkend="SECTbehipnot"/> below.
11734 <indexterm role="concept">
11735 <primary>@ in a host list</primary>
11737 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
11738 domain name, as just described.
11743 If the pattern is an IP address, it is matched against the IP address of the
11744 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
11745 IPv6 addresses can be given in colon-separated format, but the colons have to
11746 be doubled so as not to be taken as item separators when the default list
11747 separator is used. IPv6 addresses are recognized even when Exim is compiled
11748 without IPv6 support. This means that if they appear in a host list on an
11749 IPv4-only host, Exim will not treat them as host names. They are just addresses
11750 that can never match a client host.
11755 <indexterm role="concept">
11756 <primary>@[] in a host list</primary>
11758 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
11759 the local host. For example, if the local host is an IPv4 host with one
11760 interface address 10.45.23.56, these two ACL statements have the same effect:
11762 <literallayout class="monospaced">
11763 accept hosts = 127.0.0.1 : 10.45.23.56
11769 <indexterm role="concept">
11770 <primary>CIDR notation</primary>
11772 If the pattern is an IP address followed by a slash and a mask length (for
11773 example 10.11.42.0/24), it is matched against the IP address of the subject
11774 host under the given mask. This allows, an entire network of hosts to be
11775 included (or excluded) by a single item. The mask uses CIDR notation; it
11776 specifies the number of address bits that must match, starting from the most
11777 significant end of the address.
11780 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
11781 of a range of addresses. It is the number of bits in the network portion of the
11782 address. The above example specifies a 24-bit netmask, so it matches all 256
11783 addresses in the 10.11.42.0 network. An item such as
11785 <literallayout class="monospaced">
11789 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
11790 32 for an IPv4 address is the same as no mask at all; just a single address
11794 Here is another example which shows an IPv4 and an IPv6 network:
11796 <literallayout class="monospaced">
11797 recipient_unqualified_hosts = 192.168.0.0/16: \
11798 3ffe::ffff::836f::::/48
11801 The doubling of list separator characters applies only when these items
11802 appear inline in a host list. It is not required when indirecting via a file.
11805 <literallayout class="monospaced">
11806 recipient_unqualified_hosts = /opt/exim/unqualnets
11809 could make use of a file containing
11811 <literallayout class="monospaced">
11813 3ffe:ffff:836f::/48
11816 to have exactly the same effect as the previous example. When listing IPv6
11817 addresses inline, it is usually more convenient to use the facility for
11818 changing separator characters. This list contains the same two networks:
11820 <literallayout class="monospaced">
11821 recipient_unqualified_hosts = <; 172.16.0.0/12; \
11822 3ffe:ffff:836f::/48
11825 The separator is changed to semicolon by the leading <quote><;</quote> at the start of the
11831 <section id="SECThoslispatsikey">
11832 <title>Host list patterns for single-key lookups by host address</title>
11834 <indexterm role="concept">
11835 <primary>host list</primary>
11836 <secondary>lookup of IP address</secondary>
11838 When a host is to be identified by a single-key lookup of its complete IP
11839 address, the pattern takes this form:
11842 <literal>net-<</literal><emphasis>single-key-search-type</emphasis><literal>>;<</literal><emphasis>search-data</emphasis><literal>></literal>
11847 <literallayout class="monospaced">
11848 hosts_lookup = net-cdb;/hosts-by-ip.db
11851 The text form of the IP address of the subject host is used as the lookup key.
11852 IPv6 addresses are converted to an unabbreviated form, using lower case
11853 letters, with dots as separators because colon is the key terminator in
11854 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
11855 quoting the keys, but this is a facility that was added later.] The data
11856 returned by the lookup is not used.
11859 <indexterm role="concept">
11860 <primary>IP address</primary>
11861 <secondary>masking</secondary>
11863 <indexterm role="concept">
11864 <primary>host list</primary>
11865 <secondary>masked IP address</secondary>
11867 Single-key lookups can also be performed using masked IP addresses, using
11868 patterns of this form:
11871 <literal>net<</literal><emphasis>number</emphasis><literal>>-<</literal><emphasis>single-key-search-type</emphasis><literal>>;<</literal><emphasis>search-data</emphasis><literal>></literal>
11876 <literallayout class="monospaced">
11877 net24-dbm;/networks.db
11880 The IP address of the subject host is masked using <<emphasis>number</emphasis>> as the mask
11881 length. A textual string is constructed from the masked value, followed by the
11882 mask, and this is used as the lookup key. For example, if the host’s IP address
11883 is 192.168.34.6, the key that is looked up for the above example is
11884 <quote>192.168.34.0/24</quote>.
11887 When an IPv6 address is converted to a string, dots are normally used instead
11888 of colons, so that keys in <command>lsearch</command> files need not contain colons (which
11889 terminate <command>lsearch</command> keys). This was implemented some time before the ability
11890 to quote keys was made available in <command>lsearch</command> files. However, the more
11891 recently implemented <command>iplsearch</command> files do require colons in IPv6 keys
11892 (notated using the quoting facility) so as to distinguish them from IPv4 keys.
11893 For this reason, when the lookup type is <command>iplsearch</command>, IPv6 addresses are
11894 converted using colons and not dots. In all cases, full, unabbreviated IPv6
11895 addresses are always used.
11898 Ideally, it would be nice to tidy up this anomalous situation by changing to
11899 colons in all cases, given that quoting is now available for <command>lsearch</command>.
11900 However, this would be an incompatible change that might break some existing
11904 <emphasis role="bold">Warning</emphasis>: Specifying <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
11905 IPv6 address) is not the same as specifying just <option>net-</option> without a number. In
11906 the former case the key strings include the mask value, whereas in the latter
11907 case the IP address is used on its own.
11910 <section id="SECThoslispatnam">
11911 <title>Host list patterns that match by host name</title>
11913 <indexterm role="concept">
11914 <primary>host</primary>
11915 <secondary>lookup failures</secondary>
11917 <indexterm role="concept">
11918 <primary>unknown host name</primary>
11920 <indexterm role="concept">
11921 <primary>host list</primary>
11922 <secondary>matching host name</secondary>
11924 There are several types of pattern that require Exim to know the name of the
11925 remote host. These are either wildcard patterns or lookups by name. (If a
11926 complete hostname is given without any wildcarding, it is used to find an IP
11927 address to match against, as described in the section <xref linkend="SECThoslispatip"/>
11931 If the remote host name is not already known when Exim encounters one of these
11932 patterns, it has to be found from the IP address.
11933 Although many sites on the Internet are conscientious about maintaining reverse
11934 DNS data for their hosts, there are also many that do not do this.
11935 Consequently, a name cannot always be found, and this may lead to unwanted
11936 effects. Take care when configuring host lists with wildcarded name patterns.
11937 Consider what will happen if a name cannot be found.
11940 Because of the problems of determining host names from IP addresses, matching
11941 against host names is not as common as matching against IP addresses.
11944 By default, in order to find a host name, Exim first does a reverse DNS lookup;
11945 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
11946 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
11947 are done can be changed by setting the <option>host_lookup_order</option> option. For
11948 security, once Exim has found one or more names, it looks up the IP addresses
11949 for these names and compares them with the IP address that it started with.
11950 Only those names whose IP addresses match are accepted. Any other names are
11951 discarded. If no names are left, Exim behaves as if the host name cannot be
11952 found. In the most common case there is only one name and one IP address.
11955 There are some options that control what happens if a host name cannot be
11956 found. These are described in section <xref linkend="SECTbehipnot"/> below.
11959 <indexterm role="concept">
11960 <primary>host</primary>
11961 <secondary>alias for</secondary>
11963 <indexterm role="concept">
11964 <primary>alias for host</primary>
11966 As a result of aliasing, hosts may have more than one name. When processing any
11967 of the following types of pattern, all the host’s names are checked:
11972 <indexterm role="concept">
11973 <primary>asterisk</primary>
11974 <secondary>in host list</secondary>
11976 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
11977 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
11978 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
11979 requirement. Other kinds of wildcarding require the use of a regular
11985 <indexterm role="concept">
11986 <primary>regular expressions</primary>
11987 <secondary>in host list</secondary>
11989 <indexterm role="concept">
11990 <primary>host list</primary>
11991 <secondary>regular expression in</secondary>
11993 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
11994 matched against the host name. Host names are case-independent, so this regular
11995 expression match is by default case-independent, but you can make it
11996 case-dependent by starting it with <literal>(?-i)</literal>. References to descriptions of the
11997 syntax of regular expressions are given in chapter <xref linkend="CHAPregexp"/>. For
12000 <literallayout class="monospaced">
12004 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
12005 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
12006 that backslash and dollar characters are not misinterpreted as part of the
12007 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
12008 part of the string as non-expandable. For example:
12010 <literallayout class="monospaced">
12011 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
12014 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
12015 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
12016 example. Without it, a match at the start of the host name is all that is
12022 <section id="SECTbehipnot">
12023 <title>Behaviour when an IP address or name cannot be found</title>
12025 <indexterm role="concept">
12026 <primary>host</primary>
12027 <secondary>lookup failures, permanent</secondary>
12029 While processing a host list, Exim may need to look up an IP address from a
12030 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
12031 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
12032 behaviour when it fails to find the information it is seeking is the same.
12035 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
12036 apply to temporary DNS errors, whose handling is described in the next section.
12039 <indexterm role="concept">
12040 <primary><literal>+include_unknown</literal></primary>
12042 <indexterm role="concept">
12043 <primary><literal>+ignore_unknown</literal></primary>
12045 By default, Exim behaves as if the host does not match the list. This may not
12046 always be what you want to happen. To change Exim’s behaviour, the special
12047 items <literal>+include_unknown</literal> or <literal>+ignore_unknown</literal> may appear in the list (at
12048 top level – they are not recognized in an indirected file).
12053 If any item that follows <literal>+include_unknown</literal> requires information that
12054 cannot found, Exim behaves as if the host does match the list. For example,
12056 <literallayout class="monospaced">
12057 host_reject_connection = +include_unknown:*.enemy.ex
12060 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
12061 any hosts whose name it cannot find.
12066 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
12067 be found, Exim ignores that item and proceeds to the rest of the list. For
12070 <literallayout class="monospaced">
12071 accept hosts = +ignore_unknown : friend.example : \
12075 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
12076 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
12077 name can be found for 192.168.4.5, it is rejected.
12082 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
12083 list. The effect of each one lasts until the next, or until the end of the
12087 <section id="SECTtemdnserr">
12088 <title>Temporary DNS errors when looking up host information</title>
12090 <indexterm role="concept">
12091 <primary>host</primary>
12092 <secondary>lookup failures, temporary</secondary>
12094 <indexterm role="concept">
12095 <primary><literal>+include_defer</literal></primary>
12097 <indexterm role="concept">
12098 <primary><literal>+ignore_defer</literal></primary>
12100 A temporary DNS lookup failure normally causes a defer action (except when
12101 <option>dns_again_means_nonexist</option> converts it into a permanent error). However,
12102 host lists can include <literal>+ignore_defer</literal> and <literal>+include_defer</literal>, analagous to
12103 <literal>+ignore_unknown</literal> and <literal>+include_unknown</literal>, as described in the previous
12104 section. These options should be used with care, probably only in non-critical
12105 host lists such as whitelists.
12108 <section id="SECThoslispatnamsk">
12109 <title>Host list patterns for single-key lookups by host name</title>
12111 <indexterm role="concept">
12112 <primary>unknown host name</primary>
12114 <indexterm role="concept">
12115 <primary>host list</primary>
12116 <secondary>matching host name</secondary>
12118 If a pattern is of the form
12121 <<emphasis>single-key-search-type</emphasis>>;<<emphasis>search-data</emphasis>>
12126 <literallayout class="monospaced">
12127 dbm;/host/accept/list
12130 a single-key lookup is performed, using the host name as its key. If the
12131 lookup succeeds, the host matches the item. The actual data that is looked up
12135 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
12136 keys in the file, not IP addresses. If you want to do lookups based on IP
12137 addresses, you must precede the search type with <quote>net-</quote> (see section
12138 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
12139 two items in the same list, one doing an address lookup and one doing a name
12140 lookup, both using the same file.
12143 <section id="SECID81">
12144 <title>Host list patterns for query-style lookups</title>
12146 If a pattern is of the form
12149 <<emphasis>query-style-search-type</emphasis>>;<<emphasis>query</emphasis>>
12152 the query is obeyed, and if it succeeds, the host matches the item. The actual
12153 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
12154 <varname>$sender_host_name</varname> can be used in the query. For example:
12156 <literallayout class="monospaced">
12157 hosts_lookup = pgsql;\
12158 select ip from hostlist where ip='$sender_host_address'
12161 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
12162 can use the <option>sg</option> expansion item to change this if you need to. If you want to
12163 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
12167 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
12168 looks up the host name if has not already done so. (See section
12169 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
12172 Historical note: prior to release 4.30, Exim would always attempt to find a
12173 host name before running the query, unless the search type was preceded by
12174 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
12175 still recognized for query-style lookups, but its presence or absence has no
12176 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
12177 See section <xref linkend="SECThoslispatsikey"/>.)
12180 <section id="SECTmixwilhos">
12181 <title>Mixing wildcarded host names and addresses in host lists</title>
12183 <indexterm role="concept">
12184 <primary>host list</primary>
12185 <secondary>mixing names and addresses in</secondary>
12187 If you have name lookups or wildcarded host names and IP addresses in the same
12188 host list, you should normally put the IP addresses first. For example, in an
12189 ACL you could have:
12191 <literallayout class="monospaced">
12192 accept hosts = 10.9.8.7 : *.friend.example
12195 The reason for this lies in the left-to-right way that Exim processes lists.
12196 It can test IP addresses without doing any DNS lookups, but when it reaches an
12197 item that requires a host name, it fails if it cannot find a host name to
12198 compare with the pattern. If the above list is given in the opposite order, the
12199 <option>accept</option> statement fails for a host whose name cannot be found, even if its
12200 IP address is 10.9.8.7.
12203 If you really do want to do the name check first, and still recognize the IP
12204 address, you can rewrite the ACL like this:
12206 <literallayout class="monospaced">
12207 accept hosts = *.friend.example
12208 accept hosts = 10.9.8.7
12211 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
12212 <xref linkend="CHAPACL"/> for details of ACLs.
12215 <section id="SECTaddresslist">
12216 <title>Address lists</title>
12218 <indexterm role="concept">
12219 <primary>list</primary>
12220 <secondary>address list</secondary>
12222 <indexterm role="concept">
12223 <primary>address list</primary>
12224 <secondary>empty item</secondary>
12226 <indexterm role="concept">
12227 <primary>address list</primary>
12228 <secondary>patterns</secondary>
12230 Address lists contain patterns that are matched against mail addresses. There
12231 is one special case to be considered: the sender address of a bounce message is
12232 always empty. You can test for this by providing an empty item in an address
12233 list. For example, you can set up a router to process bounce messages by
12234 using this option setting:
12236 <literallayout class="monospaced">
12240 The presence of the colon creates an empty item. If you do not provide any
12241 data, the list is empty and matches nothing. The empty sender can also be
12242 detected by a regular expression that matches an empty string,
12243 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
12246 Non-empty items in an address list can be straightforward email addresses. For
12249 <literallayout class="monospaced">
12250 senders = jbc@askone.example : hs@anacreon.example
12253 A certain amount of wildcarding is permitted. If a pattern contains an @
12254 character, but is not a regular expression and does not begin with a
12255 semicolon-terminated lookup type (described below), the local part of the
12256 subject address is compared with the local part of the pattern, which may start
12257 with an asterisk. If the local parts match, the domain is checked in exactly
12258 the same way as for a pattern in a domain list. For example, the domain can be
12259 wildcarded, refer to a named list, or be a lookup:
12261 <literallayout class="monospaced">
12262 deny senders = *@*.spamming.site:\
12263 *@+hostile_domains:\
12264 bozo@partial-lsearch;/list/of/dodgy/sites:\
12265 *@dbm;/bad/domains.db
12268 <indexterm role="concept">
12269 <primary>local part</primary>
12270 <secondary>starting with !</secondary>
12272 <indexterm role="concept">
12273 <primary>address list</primary>
12274 <secondary>local part starting with !</secondary>
12276 If a local part that begins with an exclamation mark is required, it has to be
12277 specified using a regular expression, because otherwise the exclamation mark is
12278 treated as a sign of negation, as is standard in lists.
12281 If a non-empty pattern that is not a regular expression or a lookup does not
12282 contain an @ character, it is matched against the domain part of the subject
12283 address. The only two formats that are recognized this way are a literal
12284 domain, or a domain pattern that starts with *. In both these cases, the effect
12285 is the same as if <literal>*@</literal> preceded the pattern. For example:
12287 <literallayout class="monospaced">
12288 deny senders = enemy.domain : *.enemy.domain
12291 The following kinds of more complicated address list pattern can match any
12292 address, including the empty address that is characteristic of bounce message
12298 <indexterm role="concept">
12299 <primary>regular expressions</primary>
12300 <secondary>in address list</secondary>
12302 <indexterm role="concept">
12303 <primary>address list</primary>
12304 <secondary>regular expression in</secondary>
12306 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
12307 done against the complete address, with the pattern as the regular expression.
12308 You must take care that backslash and dollar characters are not misinterpreted
12309 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
12310 to mark that part of the string as non-expandable. For example:
12312 <literallayout class="monospaced">
12313 deny senders = \N^.*this.*@example\.com$\N : \
12314 \N^\d{8}.+@spamhaus.example$\N : ...
12317 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
12318 start with <quote>^</quote> by the time they are being interpreted as address patterns.
12323 <indexterm role="concept">
12324 <primary>address list</primary>
12325 <secondary>lookup for complete address</secondary>
12327 Complete addresses can be looked up by using a pattern that starts with a
12328 lookup type terminated by a semicolon, followed by the data for the lookup. For
12331 <literallayout class="monospaced">
12332 deny senders = cdb;/etc/blocked.senders : \
12333 mysql;select address from blocked where \
12334 address='${quote_mysql:$sender_address}'
12337 Both query-style and single-key lookup types can be used. For a single-key
12338 lookup type, Exim uses the complete address as the key. However, empty keys are
12339 not supported for single-key lookups, so a match against the empty address
12340 always fails. This restriction does not apply to query-style lookups.
12343 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
12344 cannot be used, and is ignored if specified, with an entry being written to the
12346 <indexterm role="concept">
12347 <primary>*@ with single-key lookup</primary>
12349 However, you can configure lookup defaults, as described in section
12350 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
12351 default. For example, with this lookup:
12353 <literallayout class="monospaced">
12354 accept senders = lsearch*@;/some/file
12357 the file could contains lines like this:
12359 <literallayout class="monospaced">
12360 user1@domain1.example
12364 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
12367 <literallayout class="monospaced">
12368 nimrod@jaeger.example
12373 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
12374 would mean that every address matches, thus rendering the test useless.
12377 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
12379 <literallayout class="monospaced">
12380 deny recipients = dbm*@;/some/file
12381 deny recipients = *@dbm;/some/file
12384 The first does a whole address lookup, with defaulting, as just described,
12385 because it starts with a lookup type. The second matches the local part and
12386 domain independently, as described in a bullet point below.
12391 The following kinds of address list pattern can match only non-empty addresses.
12392 If the subject address is empty, a match against any of these pattern types
12398 <indexterm role="concept">
12399 <primary>@@ with single-key lookup</primary>
12401 <indexterm role="concept">
12402 <primary>address list</primary>
12403 <secondary>@@ lookup type</secondary>
12405 <indexterm role="concept">
12406 <primary>address list</primary>
12407 <secondary>split local part and domain</secondary>
12409 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
12410 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
12411 split into a local part and a domain. The domain is looked up in the file. If
12412 it is not found, there is no match. If it is found, the data that is looked up
12413 from the file is treated as a colon-separated list of local part patterns, each
12414 of which is matched against the subject local part in turn.
12417 <indexterm role="concept">
12418 <primary>asterisk</primary>
12419 <secondary>in address list</secondary>
12421 The lookup may be a partial one, and/or one involving a search for a default
12422 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
12423 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
12424 even be further lookups. They may also be independently negated. For example,
12427 <literallayout class="monospaced">
12428 deny senders = @@dbm;/etc/reject-by-domain
12431 the data from which the DBM file is built could contain lines like
12433 <literallayout class="monospaced">
12434 baddomain.com: !postmaster : *
12437 to reject all senders except <option>postmaster</option> from that domain.
12440 <indexterm role="concept">
12441 <primary>local part</primary>
12442 <secondary>starting with !</secondary>
12444 If a local part that actually begins with an exclamation mark is required, it
12445 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
12446 may be split over several lines by indenting the second and subsequent lines,
12447 but the separating colon must still be included at line breaks. White space
12448 surrounding the colons is ignored. For example:
12450 <literallayout class="monospaced">
12451 aol.com: spammer1 : spammer2 : ^[0-9]+$ :
12452 spammer3 : spammer4
12455 As in all colon-separated lists in Exim, a colon can be included in an item by
12459 If the last item in the list starts with a right angle-bracket, the remainder
12460 of the item is taken as a new key to look up in order to obtain a continuation
12461 list of local parts. The new key can be any sequence of characters. Thus one
12462 might have entries like
12464 <literallayout class="monospaced">
12465 aol.com: spammer1 : spammer 2 : >*
12466 xyz.com: spammer3 : >*
12470 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
12471 local parts for all domains, in addition to the specific local parts listed for
12472 each domain. Of course, using this feature costs another lookup each time a
12473 chain is followed, but the effort needed to maintain the data is reduced.
12476 <indexterm role="concept">
12477 <primary>loop</primary>
12478 <secondary>in lookups</secondary>
12480 It is possible to construct loops using this facility, and in order to catch
12481 them, the chains may be no more than fifty items long.
12486 The @@<<emphasis>lookup</emphasis>> style of item can also be used with a query-style
12487 lookup, but in this case, the chaining facility is not available. The lookup
12488 can only return a single list of local parts.
12493 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
12494 in these two examples:
12496 <literallayout class="monospaced">
12498 senders = *@+my_list
12501 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
12502 example it is a named domain list.
12505 <section id="SECTcasletadd">
12506 <title>Case of letters in address lists</title>
12508 <indexterm role="concept">
12509 <primary>case of local parts</primary>
12511 <indexterm role="concept">
12512 <primary>address list</primary>
12513 <secondary>case forcing</secondary>
12515 <indexterm role="concept">
12516 <primary>case forcing in address lists</primary>
12518 Domains in email addresses are always handled caselessly, but for local parts
12519 case may be significant on some systems (see <option>caseful_local_part</option> for how
12520 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
12521 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
12522 blocking lists should be done in a case-independent manner. Since most address
12523 lists in Exim are used for this kind of control, Exim attempts to do this by
12527 The domain portion of an address is always lowercased before matching it to an
12528 address list. The local part is lowercased by default, and any string
12529 comparisons that take place are done caselessly. This means that the data in
12530 the address list itself, in files included as plain file names, and in any file
12531 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
12532 keys in files that are looked up by a search type other than <command>lsearch</command> (which
12533 works caselessly) must be in lower case, because these lookups are not
12537 <indexterm role="concept">
12538 <primary><literal>+caseful</literal></primary>
12540 To allow for the possibility of caseful address list matching, if an item in
12541 an address list is the string <quote>+caseful</quote>, the original case of the local
12542 part is restored for any comparisons that follow, and string comparisons are no
12543 longer case-independent. This does not affect the domain, which remains in
12544 lower case. However, although independent matches on the domain alone are still
12545 performed caselessly, regular expressions that match against an entire address
12546 become case-sensitive after <quote>+caseful</quote> has been seen.
12549 <section id="SECTlocparlis">
12550 <title>Local part lists</title>
12552 <indexterm role="concept">
12553 <primary>list</primary>
12554 <secondary>local part list</secondary>
12556 <indexterm role="concept">
12557 <primary>local part</primary>
12558 <secondary>list</secondary>
12560 Case-sensitivity in local part lists is handled in the same way as for address
12561 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
12562 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
12563 set false, the subject is lowercased and the matching is initially
12564 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
12565 matching in the local part list, but not elsewhere in the router. If
12566 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
12567 option is case-sensitive from the start.
12570 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
12571 comments are handled in the same way as address lists – they are recognized
12572 only if the # is preceded by white space or the start of the line.
12573 Otherwise, local part lists are matched in the same way as domain lists, except
12574 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
12575 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
12576 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
12578 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
12583 <chapter id="CHAPexpand">
12584 <title>String expansions</title>
12586 <indexterm role="concept" id="IIDstrexp" class="startofrange">
12587 <primary>expansion</primary>
12588 <secondary>of strings</secondary>
12590 Many strings in Exim’s run time configuration are expanded before use. Some of
12591 them are expanded every time they are used; others are expanded only once.
12594 When a string is being expanded it is copied verbatim from left to right except
12595 when a dollar or backslash character is encountered. A dollar specifies the
12596 start of a portion of the string that is interpreted and replaced as described
12597 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
12598 escape character, as described in the following section.
12600 <section id="SECTlittext">
12601 <title>Literal text in expanded strings</title>
12603 <indexterm role="concept">
12604 <primary>expansion</primary>
12605 <secondary>including literal text</secondary>
12607 An uninterpreted dollar can be included in an expanded string by putting a
12608 backslash in front of it. A backslash can be used to prevent any special
12609 character being treated specially in an expansion, including backslash itself.
12610 If the string appears in quotes in the configuration file, two backslashes are
12611 required because the quotes themselves cause interpretation of backslashes when
12612 the string is read in (see section <xref linkend="SECTstrings"/>).
12615 <indexterm role="concept">
12616 <primary>expansion</primary>
12617 <secondary>non-expandable substrings</secondary>
12619 A portion of the string can specified as non-expandable by placing it between
12620 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
12621 expressions, which often contain backslashes and dollar signs. For example:
12623 <literallayout class="monospaced">
12624 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
12627 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
12628 without interpretation until it reaches the next <literal>\N</literal> or the end of the
12632 <section id="SECID82">
12633 <title>Character escape sequences in expanded strings</title>
12635 <indexterm role="concept">
12636 <primary>expansion</primary>
12637 <secondary>escape sequences</secondary>
12639 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
12640 expanded string is recognized as an escape sequence for the character newline,
12641 carriage return, or tab, respectively. A backslash followed by up to three
12642 octal digits is recognized as an octal encoding for a single character, and a
12643 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
12647 These escape sequences are also recognized in quoted strings when they are read
12648 in. Their interpretation in expansions as well is useful for unquoted strings,
12649 and for other cases such as looked-up strings that are then expanded.
12652 <section id="SECID83">
12653 <title>Testing string expansions</title>
12655 <indexterm role="concept">
12656 <primary>expansion</primary>
12657 <secondary>testing</secondary>
12659 <indexterm role="concept">
12660 <primary>testing</primary>
12661 <secondary>string expansion</secondary>
12663 <indexterm role="option">
12664 <primary><option>-be</option></primary>
12666 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
12667 takes the command arguments, or lines from the standard input if there are no
12668 arguments, runs them through the string expansion code, and writes the results
12669 to the standard output. Variables based on configuration values are set up, but
12670 since no message is being processed, variables such as <varname>$local_part</varname> have no
12671 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
12672 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
12673 and <option>nhash</option>.
12676 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
12677 instead runs under the uid and gid it was called with, to prevent users from
12678 using <option>-be</option> for reading files to which they do not have access.
12681 <indexterm role="option">
12682 <primary><option>-bem</option></primary>
12684 If you want to test expansions that include variables whose values are taken
12685 from a message, there are two other options that can be used. The <option>-bem</option>
12686 option is like <option>-be</option> except that it is followed by a file name. The file is
12687 read as a message before doing the test expansions. For example:
12689 <literallayout class="monospaced">
12690 exim -bem /tmp/test.message '$h_subject:'
12693 The <option>-Mset</option> option is used in conjunction with <option>-be</option> and is followed by an
12694 Exim message identifier. For example:
12696 <literallayout class="monospaced">
12697 exim -be -Mset 1GrA8W-0004WS-LQ '$recipients'
12700 This loads the message from Exim’s spool before doing the test expansions, and
12701 is therefore restricted to admin users.
12704 <section id="SECTforexpfai">
12705 <title>Forced expansion failure</title>
12707 <indexterm role="concept">
12708 <primary>expansion</primary>
12709 <secondary>forced failure</secondary>
12711 A number of expansions that are described in the following section have
12712 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
12713 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
12714 used depends on some condition that is evaluated as part of the expansion. If,
12715 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
12716 the entire string expansion fails in a way that can be detected by the code
12717 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
12718 its consequences depend on the circumstances. In some cases it is no different
12719 from any other expansion failure, but in others a different action may be
12720 taken. Such variations are mentioned in the documentation of the option that is
12724 <section id="SECTexpansionitems">
12725 <title>Expansion items</title>
12727 The following items are recognized in expanded strings. White space may be used
12728 between sub-items that are keywords or substrings enclosed in braces inside an
12729 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
12730 white space is significant.
12734 <term><emphasis role="bold">$</emphasis><<emphasis>variable name</emphasis>> or <emphasis role="bold">${</emphasis><<emphasis>variable name</emphasis>><emphasis role="bold">}</emphasis></term>
12737 <indexterm role="concept">
12738 <primary>expansion</primary>
12739 <secondary>variables</secondary>
12741 Substitute the contents of the named variable, for example:
12743 <literallayout class="monospaced">
12748 The second form can be used to separate the name from subsequent alphanumeric
12749 characters. This form (using braces) is available only for variables; it does
12750 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
12751 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
12752 given, the expansion fails.
12754 </listitem></varlistentry>
12756 <term><emphasis role="bold">${</emphasis><<emphasis>op</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
12759 <indexterm role="concept">
12760 <primary>expansion</primary>
12761 <secondary>operators</secondary>
12763 The string is first itself expanded, and then the operation specified by
12764 <<emphasis>op</emphasis>> is applied to it. For example:
12766 <literallayout class="monospaced">
12770 The string starts with the first character after the colon, which may be
12771 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
12772 below. The operator notation is used for simple expansion items that have just
12773 one argument, because it reduces the number of braces and therefore makes the
12774 string easier to understand.
12776 </listitem></varlistentry>
12778 <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>
12781 This item inserts <quote>basic</quote> header lines. It is described with the <option>header</option>
12782 expansion item below.
12784 </listitem></varlistentry>
12786 <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>
12789 <indexterm role="concept">
12790 <primary><option>dlfunc</option></primary>
12792 This expansion dynamically loads and then calls a locally-written C function.
12793 This functionality is available only if Exim is compiled with
12795 <literallayout class="monospaced">
12799 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
12800 object so that it doesn’t reload the same object file in the same Exim process
12801 (but of course Exim does start new processes frequently).
12804 There may be from zero to eight arguments to the function. When compiling
12805 a local function that is to be called in this way, <filename>local_scan.h</filename> should be
12806 included. The Exim variables and functions that are defined by that API
12807 are also available for dynamically loaded functions. The function itself
12808 must have the following type:
12810 <literallayout class="monospaced">
12811 int dlfunction(uschar **yield, int argc, uschar *argv[])
12814 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
12815 function should return one of the following values:
12818 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
12819 into the expanded string that is being built.
12822 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
12823 from <emphasis>yield</emphasis>, if it is set.
12826 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
12827 taken from <emphasis>yield</emphasis> if it is set.
12830 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
12833 When compiling a function that is to be used in this way with gcc,
12834 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
12835 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
12837 </listitem></varlistentry>
12839 <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>
12842 <indexterm role="concept">
12843 <primary>expansion</primary>
12844 <secondary>extracting substrings by key</secondary>
12846 <indexterm role="concept">
12847 <primary><option>extract</option></primary>
12848 <secondary>substrings by key</secondary>
12850 The key and <<emphasis>string1</emphasis>> are first expanded separately. Leading and trailing
12851 white space is removed from the key (but not from any of the strings). The key
12852 must not consist entirely of digits. The expanded <<emphasis>string1</emphasis>> must be of the
12856 <<emphasis>key1</emphasis>> = <<emphasis>value1</emphasis>> <<emphasis>key2</emphasis>> = <<emphasis>value2</emphasis>> ...
12859 <indexterm role="variable">
12860 <primary><varname>$value</varname></primary>
12862 where the equals signs and spaces (but not both) are optional. If any of the
12863 values contain white space, they must be enclosed in double quotes, and any
12864 values that are enclosed in double quotes are subject to escape processing as
12865 described in section <xref linkend="SECTstrings"/>. The expanded <<emphasis>string1</emphasis>> is searched
12866 for the value that corresponds to the key. The search is case-insensitive. If
12867 the key is found, <<emphasis>string2</emphasis>> is expanded, and replaces the whole item;
12868 otherwise <<emphasis>string3</emphasis>> is used. During the expansion of <<emphasis>string2</emphasis>> the
12869 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
12870 is restored to any previous value it might have had.
12873 If {<<emphasis>string3</emphasis>>} is omitted, the item is replaced by an empty string if the
12874 key is not found. If {<<emphasis>string2</emphasis>>} is also omitted, the value that was
12875 extracted is used. Thus, for example, these two expansions are identical, and
12876 yield <quote>2001</quote>:
12878 <literallayout class="monospaced">
12879 ${extract{gid}{uid=1984 gid=2001}}
12880 ${extract{gid}{uid=1984 gid=2001}{$value}}
12883 Instead of {<<emphasis>string3</emphasis>>} the word <quote>fail</quote> (not in curly brackets) can
12884 appear, for example:
12886 <literallayout class="monospaced">
12887 ${extract{Z}{A=... B=...}{$value} fail }
12890 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
12891 {<<emphasis>string2</emphasis>>} must be present for <quote>fail</quote> to be recognized.
12893 </listitem></varlistentry>
12895 <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>
12898 <indexterm role="concept">
12899 <primary>expansion</primary>
12900 <secondary>extracting substrings by number</secondary>
12902 <indexterm role="concept">
12903 <primary><option>extract</option></primary>
12904 <secondary>substrings by number</secondary>
12906 The <<emphasis>number</emphasis>> argument must consist entirely of decimal digits,
12907 apart from leading and trailing white space, which is ignored.
12908 This is what distinguishes this form of <option>extract</option> from the previous kind. It
12909 behaves in the same way, except that, instead of extracting a named field, it
12910 extracts from <<emphasis>string1</emphasis>> the field whose number is given as the first
12911 argument. You can use <varname>$value</varname> in <<emphasis>string2</emphasis>> or <literal>fail</literal> instead of
12912 <<emphasis>string3</emphasis>> as before.
12915 The fields in the string are separated by any one of the characters in the
12916 separator string. These may include space or tab characters.
12917 The first field is numbered one. If the number is negative, the fields are
12918 counted from the end of the string, with the rightmost one numbered -1. If the
12919 number given is zero, the entire string is returned. If the modulus of the
12920 number is greater than the number of fields in the string, the result is the
12921 expansion of <<emphasis>string3</emphasis>>, or the empty string if <<emphasis>string3</emphasis>> is not
12922 provided. For example:
12924 <literallayout class="monospaced">
12925 ${extract{2}{:}{x:42:99:& Mailer::/bin/bash}}
12928 yields <quote>42</quote>, and
12930 <literallayout class="monospaced">
12931 ${extract{-4}{:}{x:42:99:& Mailer::/bin/bash}}
12934 yields <quote>99</quote>. Two successive separators mean that the field between them is
12935 empty (for example, the fifth field above).
12937 </listitem></varlistentry>
12939 <term><emphasis role="bold">${filter{</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>condition</emphasis>><emphasis role="bold">}}</emphasis></term>
12942 <indexterm role="concept">
12943 <primary>list</primary>
12944 <secondary>selecting by condition</secondary>
12946 <indexterm role="concept">
12947 <primary>expansion</primary>
12948 <secondary>selecting from list by condition</secondary>
12950 <indexterm role="variable">
12951 <primary><varname>$item</varname></primary>
12953 After expansion, <<emphasis>string</emphasis>> is interpreted as a list, colon-separated by
12954 default, but the separator can be changed in the usual way. For each item
12955 in this list, its value is place in <varname>$item</varname>, and then the condition is
12956 evaluated. If the condition is true, <varname>$item</varname> is added to the output as an
12957 item in a new list; if the condition is false, the item is discarded. The
12958 separator used for the output list is the same as the one used for the
12959 input, but a separator setting is not included in the output. For example:
12961 <literallayout class="monospaced">
12962 ${filter{a:b:c}{!eq{$item}{b}}
12965 yields <literal>a:c</literal>. At the end of the expansion, the value of <varname>$item</varname> is restored
12966 to what it was before. See also the <emphasis role="bold">map</emphasis> and <emphasis role="bold">reduce</emphasis> expansion items.
12968 </listitem></varlistentry>
12970 <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>
12973 <indexterm role="concept">
12974 <primary>hash function</primary>
12975 <secondary>textual</secondary>
12977 <indexterm role="concept">
12978 <primary>expansion</primary>
12979 <secondary>textual hash</secondary>
12981 This is a textual hashing function, and was the first to be implemented in
12982 early versions of Exim. In current releases, there are other hashing functions
12983 (numeric, MD5, and SHA-1), which are described below.
12986 The first two strings, after expansion, must be numbers. Call them <<emphasis>m</emphasis>> and
12987 <<emphasis>n</emphasis>>. If you are using fixed values for these numbers, that is, if
12988 <<emphasis>string1</emphasis>> and <<emphasis>string2</emphasis>> do not change when they are expanded, you can
12989 use the simpler operator notation that avoids some of the braces:
12991 <literallayout class="monospaced">
12992 ${hash_<n>_<m>:<string>}
12995 The second number is optional (in both notations). If <<emphasis>n</emphasis>> is greater than
12996 or equal to the length of the string, the expansion item returns the string.
12997 Otherwise it computes a new string of length <<emphasis>n</emphasis>> by applying a hashing
12998 function to the string. The new string consists of characters taken from the
12999 first <<emphasis>m</emphasis>> characters of the string
13001 <literallayout class="monospaced">
13002 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
13005 If <<emphasis>m</emphasis>> is not present the value 26 is used, so that only lower case
13006 letters appear. For example:
13009 <literal>$hash{3}{monty}} </literal> yields <literal>jmg</literal>
13010 <literal>$hash{5}{monty}} </literal> yields <literal>monty</literal>
13011 <literal>$hash{4}{62}{monty python}}</literal> yields <literal>fbWx</literal>
13013 </listitem></varlistentry>
13015 <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>
13016 <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>
13017 <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>
13020 <indexterm role="concept">
13021 <primary>expansion</primary>
13022 <secondary>header insertion</secondary>
13024 <indexterm role="variable">
13025 <primary><varname>$header_</varname></primary>
13027 <indexterm role="variable">
13028 <primary><varname>$bheader_</varname></primary>
13030 <indexterm role="variable">
13031 <primary><varname>$rheader_</varname></primary>
13033 <indexterm role="concept">
13034 <primary>header lines</primary>
13035 <secondary>in expansion strings</secondary>
13037 <indexterm role="concept">
13038 <primary>header lines</primary>
13039 <secondary>character sets</secondary>
13041 <indexterm role="concept">
13042 <primary>header lines</primary>
13043 <secondary>decoding</secondary>
13045 Substitute the contents of the named message header line, for example
13047 <literallayout class="monospaced">
13051 The newline that terminates a header line is not included in the expansion, but
13052 internal newlines (caused by splitting the header line over several physical
13053 lines) may be present.
13056 The difference between <option>rheader</option>, <option>bheader</option>, and <option>header</option> is in the way
13057 the data in the header line is interpreted.
13062 <indexterm role="concept">
13063 <primary>white space</primary>
13064 <secondary>in header lines</secondary>
13066 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
13067 processing at all, and without the removal of leading and trailing white space.
13072 <indexterm role="concept">
13073 <primary>base64 encoding</primary>
13074 <secondary>in header lines</secondary>
13076 <option>bheader</option> removes leading and trailing white space, and then decodes base64
13077 or quoted-printable MIME <quote>words</quote> within the header text, but does no
13078 character set translation. If decoding of what looks superficially like a MIME
13079 <quote>word</quote> fails, the raw string is returned. If decoding
13080 <indexterm role="concept">
13081 <primary>binary zero</primary>
13082 <secondary>in header line</secondary>
13084 produces a binary zero character, it is replaced by a question mark – this is
13085 what Exim does for binary zeros that are actually received in header lines.
13090 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
13091 standard character set. This is an attempt to produce the same string as would
13092 be displayed on a user’s MUA. If translation fails, the <option>bheader</option> string is
13093 returned. Translation is attempted only on operating systems that support the
13094 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
13095 a system Makefile or in <filename>Local/Makefile</filename>.
13100 In a filter file, the target character set for <option>header</option> can be specified by a
13101 command of the following form:
13103 <literallayout class="monospaced">
13104 headers charset "UTF-8"
13107 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
13108 subsequently obeyed filter commands. In the absence of this command, the target
13109 character set in a filter is taken from the setting of the <option>headers_charset</option>
13110 option in the runtime configuration. The value of this option defaults to the
13111 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
13115 Header names follow the syntax of RFC 2822, which states that they may contain
13116 any printing characters except space and colon. Consequently, curly brackets
13117 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
13118 if they were variables. Attempting to do so causes a syntax error.
13121 Only header lines that are common to all copies of a message are visible to
13122 this mechanism. These are the original header lines that are received with the
13123 message, and any that are added by an ACL statement or by a system
13124 filter. Header lines that are added to a particular copy of a message by a
13125 router or transport are not accessible.
13128 For incoming SMTP messages, no header lines are visible in ACLs that are obeyed
13129 before the DATA ACL, because the header structure is not set up until the
13130 message is received. Header lines that are added in a RCPT ACL (for example)
13131 are saved until the message’s incoming header lines are available, at which
13132 point they are added. When a DATA ACL is running, however, header lines added
13133 by earlier ACLs are visible.
13136 Upper case and lower case letters are synonymous in header names. If the
13137 following character is white space, the terminating colon may be omitted, but
13138 this is not recommended, because you may then forget it when it is needed. When
13139 white space terminates the header name, it is included in the expanded string.
13140 If the message does not contain the given header, the expansion item is
13141 replaced by an empty string. (See the <option>def</option> condition in section
13142 <xref linkend="SECTexpcond"/> for a means of testing for the existence of a header.)
13145 If there is more than one header with the same name, they are all concatenated
13146 to form the substitution string, up to a maximum length of 64K. Unless
13147 <option>rheader</option> is being used, leading and trailing white space is removed from
13148 each header before concatenation, and a completely empty header is ignored. A
13149 newline character is then inserted between non-empty headers, but there is no
13150 newline at the very end. For the <option>header</option> and <option>bheader</option> expansion, for
13151 those headers that contain lists of addresses, a comma is also inserted at the
13152 junctions between headers. This does not happen for the <option>rheader</option> expansion.
13154 </listitem></varlistentry>
13156 <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>
13159 <indexterm role="concept">
13160 <primary>expansion</primary>
13161 <secondary>hmac hashing</secondary>
13163 <indexterm role="concept">
13164 <primary><option>hmac</option></primary>
13166 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
13167 shared secret and some text into a message authentication code, as specified in
13168 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
13169 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
13170 cryptographic hash, allowing for authentication that is not possible with MD5
13171 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
13172 present. For example:
13174 <literallayout class="monospaced">
13175 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
13178 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
13181 <literallayout class="monospaced">
13182 dd97e3ba5d1a61b5006108f8c8252953
13185 As an example of how this might be used, you might put in the main part of
13186 an Exim configuration:
13188 <literallayout class="monospaced">
13189 SPAMSCAN_SECRET=cohgheeLei2thahw
13192 In a router or a transport you could then have:
13194 <literallayout class="monospaced">
13196 X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
13197 ${hmac{md5}{SPAMSCAN_SECRET}\
13198 {${primary_hostname},${message_exim_id},$h_message-id:}}
13201 Then given a message, you can check where it was scanned by looking at the
13202 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
13203 this header line is authentic by recomputing the authentication code from the
13204 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
13205 using Exim’s <option>-be</option> option, or by other means, for example by using the
13206 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
13208 </listitem></varlistentry>
13210 <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>
13213 <indexterm role="concept">
13214 <primary>expansion</primary>
13215 <secondary>conditional</secondary>
13217 <indexterm role="concept">
13218 <primary><option>if</option>, expansion item</primary>
13220 If <<emphasis>condition</emphasis>> is true, <<emphasis>string1</emphasis>> is expanded and replaces the whole
13221 item; otherwise <<emphasis>string2</emphasis>> is used. The available conditions are described
13222 in section <xref linkend="SECTexpcond"/> below. For example:
13224 <literallayout class="monospaced">
13225 ${if eq {$local_part}{postmaster} {yes}{no} }
13228 The second string need not be present; if it is not and the condition is not
13229 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
13230 be present instead of the second string (without any curly brackets). In this
13231 case, the expansion is forced to fail if the condition is not true (see section
13232 <xref linkend="SECTforexpfai"/>).
13235 If both strings are omitted, the result is the string <literal>true</literal> if the condition
13236 is true, and the empty string if the condition is false. This makes it less
13237 cumbersome to write custom ACL and router conditions. For example, instead of
13239 <literallayout class="monospaced">
13240 condition = ${if >{$acl_m4}{3}{true}{false}}
13245 <literallayout class="monospaced">
13246 condition = ${if >{$acl_m4}{3}}
13248 </listitem></varlistentry>
13250 <term><emphasis role="bold">${length{</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}}</emphasis></term>
13253 <indexterm role="concept">
13254 <primary>expansion</primary>
13255 <secondary>string truncation</secondary>
13257 <indexterm role="concept">
13258 <primary><option>length</option> expansion item</primary>
13260 The <option>length</option> item is used to extract the initial portion of a string. Both
13261 strings are expanded, and the first one must yield a number, <<emphasis>n</emphasis>>, say. If
13262 you are using a fixed value for the number, that is, if <<emphasis>string1</emphasis>> does not
13263 change when expanded, you can use the simpler operator notation that avoids
13264 some of the braces:
13266 <literallayout class="monospaced">
13267 ${length_<n>:<string>}
13270 The result of this item is either the first <<emphasis>n</emphasis>> characters or the whole
13271 of <<emphasis>string2</emphasis>>, whichever is the shorter. Do not confuse <option>length</option> with
13272 <option>strlen</option>, which gives the length of a string.
13274 </listitem></varlistentry>
13276 <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>
13279 This is the first of one of two different types of lookup item, which are both
13280 described in the next item.
13282 </listitem></varlistentry>
13284 <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>
13287 <indexterm role="concept">
13288 <primary>expansion</primary>
13289 <secondary>lookup in</secondary>
13291 <indexterm role="concept">
13292 <primary>file</primary>
13293 <secondary>lookups</secondary>
13295 <indexterm role="concept">
13296 <primary>lookup</primary>
13297 <secondary>in expanded string</secondary>
13299 The two forms of lookup item specify data lookups in files and databases, as
13300 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
13301 lookups, and the second is used for query-style lookups. The <<emphasis>key</emphasis>>,
13302 <<emphasis>file</emphasis>>, and <<emphasis>query</emphasis>> strings are expanded before use.
13305 If there is any white space in a lookup item which is part of a filter command,
13306 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
13307 other place where white space is significant, the lookup item must be enclosed
13308 in double quotes. The use of data lookups in users’ filter files may be locked
13309 out by the system administrator.
13312 <indexterm role="variable">
13313 <primary><varname>$value</varname></primary>
13315 If the lookup succeeds, <<emphasis>string1</emphasis>> is expanded and replaces the entire item.
13316 During its expansion, the variable <varname>$value</varname> contains the data returned by the
13317 lookup. Afterwards it reverts to the value it had previously (at the outer
13318 level it is empty). If the lookup fails, <<emphasis>string2</emphasis>> is expanded and replaces
13319 the entire item. If {<<emphasis>string2</emphasis>>} is omitted, the replacement is the empty
13320 string on failure. If <<emphasis>string2</emphasis>> is provided, it can itself be a nested
13321 lookup, thus providing a mechanism for looking up a default value when the
13322 original lookup fails.
13325 If a nested lookup is used as part of <<emphasis>string1</emphasis>>, <varname>$value</varname> contains the
13326 data for the outer lookup while the parameters of the second lookup are
13327 expanded, and also while <<emphasis>string2</emphasis>> of the second lookup is expanded, should
13328 the second lookup fail. Instead of {<<emphasis>string2</emphasis>>} the word <quote>fail</quote> can
13329 appear, and in this case, if the lookup fails, the entire expansion is forced
13330 to fail (see section <xref linkend="SECTforexpfai"/>). If both {<<emphasis>string1</emphasis>>} and
13331 {<<emphasis>string2</emphasis>>} are omitted, the result is the looked up value in the case of a
13332 successful lookup, and nothing in the case of failure.
13335 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
13336 search type in order to do partial matching, and * or *@ may follow a search
13337 type to request default lookups if the key does not match (see sections
13338 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
13341 <indexterm role="concept">
13342 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
13343 <secondary>in lookup expansion</secondary>
13345 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
13346 and non-wild parts of the key during the expansion of the replacement text.
13347 They return to their previous values at the end of the lookup item.
13350 This example looks up the postmaster alias in the conventional alias file:
13352 <literallayout class="monospaced">
13353 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
13356 This example uses NIS+ to look up the full name of the user corresponding to
13357 the local part of an address, forcing the expansion to fail if it is not found:
13359 <literallayout class="monospaced">
13360 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
13363 </listitem></varlistentry>
13365 <term><emphasis role="bold">${map{</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}}</emphasis></term>
13368 <indexterm role="concept">
13369 <primary>expansion</primary>
13370 <secondary>list creation</secondary>
13372 <indexterm role="variable">
13373 <primary><varname>$item</varname></primary>
13375 After expansion, <<emphasis>string1</emphasis>> is interpreted as a list, colon-separated by
13376 default, but the separator can be changed in the usual way. For each item
13377 in this list, its value is place in <varname>$item</varname>, and then <<emphasis>string2</emphasis>> is
13378 expanded and added to the output as an item in a new list. The separator used
13379 for the output list is the same as the one used for the input, but a separator
13380 setting is not included in the output. For example:
13382 <literallayout class="monospaced">
13383 ${map{a:b:c}{[$item]}} ${map{<- x-y-z}{($item)}}
13386 expands to <literal>[a]:[b]:[c] (x)-(y)-(z)</literal>. At the end of the expansion, the
13387 value of <varname>$item</varname> is restored to what it was before. See also the <emphasis role="bold">filter</emphasis>
13388 and <emphasis role="bold">reduce</emphasis> expansion items.
13390 </listitem></varlistentry>
13392 <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>
13395 <indexterm role="concept">
13396 <primary>expansion</primary>
13397 <secondary>numeric hash</secondary>
13399 <indexterm role="concept">
13400 <primary>hash function</primary>
13401 <secondary>numeric</secondary>
13403 The three strings are expanded; the first two must yield numbers. Call them
13404 <<emphasis>n</emphasis>> and <<emphasis>m</emphasis>>. If you are using fixed values for these numbers, that is,
13405 if <<emphasis>string1</emphasis>> and <<emphasis>string2</emphasis>> do not change when they are expanded, you
13406 can use the simpler operator notation that avoids some of the braces:
13408 <literallayout class="monospaced">
13409 ${nhash_<n>_<m>:<string>}
13412 The second number is optional (in both notations). If there is only one number,
13413 the result is a number in the range 0–<<emphasis>n</emphasis>>-1. Otherwise, the string is
13414 processed by a div/mod hash function that returns two numbers, separated by a
13415 slash, in the ranges 0 to <<emphasis>n</emphasis>>-1 and 0 to <<emphasis>m</emphasis>>-1, respectively. For
13418 <literallayout class="monospaced">
13419 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
13422 returns the string <quote>6/33</quote>.
13424 </listitem></varlistentry>
13426 <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>
13429 <indexterm role="concept">
13430 <primary>Perl</primary>
13431 <secondary>use in expanded string</secondary>
13433 <indexterm role="concept">
13434 <primary>expansion</primary>
13435 <secondary>calling Perl from</secondary>
13437 This item is available only if Exim has been built to include an embedded Perl
13438 interpreter. The subroutine name and the arguments are first separately
13439 expanded, and then the Perl subroutine is called with those arguments. No
13440 additional arguments need be given; the maximum number permitted, including the
13441 name of the subroutine, is nine.
13444 The return value of the subroutine is inserted into the expanded string, unless
13445 the return value is <option>undef</option>. In that case, the expansion fails in the same
13446 way as an explicit <quote>fail</quote> on a lookup item. The return value is a scalar.
13447 Whatever you return is evaluated in a scalar context. For example, if you
13448 return the name of a Perl vector, the return value is the size of the vector,
13452 If the subroutine exits by calling Perl’s <option>die</option> function, the expansion fails
13453 with the error message that was passed to <option>die</option>. More details of the embedded
13454 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
13457 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
13458 out the use of this expansion item in filter files.
13460 </listitem></varlistentry>
13462 <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>
13465 <indexterm role="concept">
13466 <primary><option>prvs</option> expansion item</primary>
13468 The first argument is a complete email address and the second is secret
13469 keystring. The third argument, specifying a key number, is optional. If absent,
13470 it defaults to 0. The result of the expansion is a prvs-signed email address,
13471 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
13472 as part of a bounce address tag validation (BATV) scheme. For more discussion
13473 and an example, see section <xref linkend="SECTverifyPRVS"/>.
13475 </listitem></varlistentry>
13477 <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>
13480 <indexterm role="concept">
13481 <primary><option>prvscheck</option> expansion item</primary>
13483 This expansion item is the complement of the <option>prvs</option> item. It is used for
13484 checking prvs-signed addresses. If the expansion of the first argument does not
13485 yield a syntactically valid prvs-signed address, the whole item expands to the
13486 empty string. When the first argument does expand to a syntactically valid
13487 prvs-signed address, the second argument is expanded, with the prvs-decoded
13488 version of the address and the key number extracted from the address in the
13489 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
13492 These two variables can be used in the expansion of the second argument to
13493 retrieve the secret. The validity of the prvs-signed address is then checked
13494 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
13495 which is empty for failure or <quote>1</quote> for success.
13498 The third argument is optional; if it is missing, it defaults to an empty
13499 string. This argument is now expanded. If the result is an empty string, the
13500 result of the expansion is the decoded version of the address. This is the case
13501 whether or not the signature was valid. Otherwise, the result of the expansion
13502 is the expansion of the third argument.
13505 All three variables can be used in the expansion of the third argument.
13506 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
13507 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
13509 </listitem></varlistentry>
13511 <term><emphasis role="bold">${readfile{</emphasis><<emphasis>file name</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>eol string</emphasis>><emphasis role="bold">}}</emphasis></term>
13514 <indexterm role="concept">
13515 <primary>expansion</primary>
13516 <secondary>inserting an entire file</secondary>
13518 <indexterm role="concept">
13519 <primary>file</primary>
13520 <secondary>inserting into expansion</secondary>
13522 <indexterm role="concept">
13523 <primary><option>readfile</option> expansion item</primary>
13525 The file name and end-of-line string are first expanded separately. The file is
13526 then read, and its contents replace the entire item. All newline characters in
13527 the file are replaced by the end-of-line string if it is present. Otherwise,
13528 newlines are left in the string.
13529 String expansion is not applied to the contents of the file. If you want this,
13530 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
13531 the string expansion fails.
13534 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
13535 locks out the use of this expansion item in filter files.
13537 </listitem></varlistentry>
13539 <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>
13542 <indexterm role="concept">
13543 <primary>expansion</primary>
13544 <secondary>inserting from a socket</secondary>
13546 <indexterm role="concept">
13547 <primary>socket, use of in expansion</primary>
13549 <indexterm role="concept">
13550 <primary><option>readsocket</option> expansion item</primary>
13552 This item inserts data from a Unix domain or Internet socket into the expanded
13553 string. The minimal way of using it uses just two arguments, as in these
13556 <literallayout class="monospaced">
13557 ${readsocket{/socket/name}{request string}}
13558 ${readsocket{inet:some.host:1234}{request string}}
13561 For a Unix domain socket, the first substring must be the path to the socket.
13562 For an Internet socket, the first substring must contain <literal>inet:</literal> followed by
13563 a host name or IP address, followed by a colon and a port, which can be a
13564 number or the name of a TCP port in <filename>/etc/services</filename>. An IP address may
13565 optionally be enclosed in square brackets. This is best for IPv6 addresses. For
13568 <literallayout class="monospaced">
13569 ${readsocket{inet:[::1]:1234}{request string}}
13572 Only a single host name may be given, but if looking it up yields more than
13573 one IP address, they are each tried in turn until a connection is made. For
13574 both kinds of socket, Exim makes a connection, writes the request string
13575 (unless it is an empty string) and reads from the socket until an end-of-file
13576 is read. A timeout of 5 seconds is applied. Additional, optional arguments
13577 extend what can be done. Firstly, you can vary the timeout. For example:
13579 <literallayout class="monospaced">
13580 ${readsocket{/socket/name}{request string}{3s}}
13583 A fourth argument allows you to change any newlines that are in the data
13584 that is read, in the same way as for <option>readfile</option> (see above). This example
13585 turns them into spaces:
13587 <literallayout class="monospaced">
13588 ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }}
13591 As with all expansions, the substrings are expanded before the processing
13592 happens. Errors in these sub-expansions cause the expansion to fail. In
13593 addition, the following errors can occur:
13598 Failure to create a socket file descriptor;
13603 Failure to connect the socket;
13608 Failure to write the request string;
13613 Timeout on reading from the socket.
13618 By default, any of these errors causes the expansion to fail. However, if
13619 you supply a fifth substring, it is expanded and used when any of the above
13620 errors occurs. For example:
13622 <literallayout class="monospaced">
13623 ${readsocket{/socket/name}{request string}{3s}{\n}\
13627 You can test for the existence of a Unix domain socket by wrapping this
13628 expansion in <literal>${if exists</literal>, but there is a race condition between that test
13629 and the actual opening of the socket, so it is safer to use the fifth argument
13630 if you want to be absolutely sure of avoiding an expansion error for a
13631 non-existent Unix domain socket, or a failure to connect to an Internet socket.
13634 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
13635 locks out the use of this expansion item in filter files.
13637 </listitem></varlistentry>
13639 <term><emphasis role="bold">${reduce{</emphasis><<emphasis>string1</emphasis>>}{<<emphasis>string2</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string3</emphasis>><emphasis role="bold">}}</emphasis></term>
13642 <indexterm role="concept">
13643 <primary>expansion</primary>
13644 <secondary>reducing a list to a scalar</secondary>
13646 <indexterm role="concept">
13647 <primary>list</primary>
13648 <secondary>reducing to a scalar</secondary>
13650 <indexterm role="variable">
13651 <primary><varname>$value</varname></primary>
13653 <indexterm role="variable">
13654 <primary><varname>$item</varname></primary>
13656 This operation reduces a list to a single, scalar string. After expansion,
13657 <<emphasis>string1</emphasis>> is interpreted as a list, colon-separated by default, but the
13658 separator can be changed in the usual way. Then <<emphasis>string2</emphasis>> is expanded and
13659 assigned to the <varname>$value</varname> variable. After this, each item in the <<emphasis>string1</emphasis>>
13660 list is assigned to <varname>$item</varname> in turn, and <<emphasis>string3</emphasis>> is expanded for each of
13661 them. The result of that expansion is assigned to <varname>$value</varname> before the next
13662 iteration. When the end of the list is reached, the final value of <varname>$value</varname> is
13663 added to the expansion output. The <emphasis role="bold">reduce</emphasis> expansion item can be used in a
13664 number of ways. For example, to add up a list of numbers:
13666 <literallayout class="monospaced">
13667 ${reduce {<, 1,2,3}{0}{${eval:$value+$item}}}
13670 The result of that expansion would be <literal>6</literal>. The maximum of a list of numbers
13673 <literallayout class="monospaced">
13674 ${reduce {3:0:9:4:6}{0}{${if >{$item}{$value}{$item}{$value}}}}
13677 At the end of a <emphasis role="bold">reduce</emphasis> expansion, the values of <varname>$item</varname> and <varname>$value</varname> are
13678 restored to what they were before. See also the <emphasis role="bold">filter</emphasis> and <emphasis role="bold">map</emphasis>
13681 </listitem></varlistentry>
13683 <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>
13686 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
13687 expansion item above.
13689 </listitem></varlistentry>
13691 <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>
13694 <indexterm role="concept">
13695 <primary>expansion</primary>
13696 <secondary>running a command</secondary>
13698 <indexterm role="concept">
13699 <primary><option>run</option> expansion item</primary>
13701 The command and its arguments are first expanded separately, and then the
13702 command is run in a separate process, but under the same uid and gid. As in
13703 other command executions from Exim, a shell is not used by default. If you want
13704 a shell, you must explicitly code it.
13707 The standard input for the command exists, but is empty. The standard output
13708 and standard error are set to the same file descriptor.
13709 <indexterm role="concept">
13710 <primary>return code</primary>
13711 <secondary>from <option>run</option> expansion</secondary>
13713 <indexterm role="variable">
13714 <primary><varname>$value</varname></primary>
13716 If the command succeeds (gives a zero return code) <<emphasis>string1</emphasis>> is expanded
13717 and replaces the entire item; during this expansion, the standard output/error
13718 from the command is in the variable <varname>$value</varname>. If the command fails,
13719 <<emphasis>string2</emphasis>>, if present, is expanded and used. Once again, during the
13720 expansion, the standard output/error from the command is in the variable
13721 <varname>$value</varname>.
13724 If <<emphasis>string2</emphasis>> is absent, the result is empty. Alternatively, <<emphasis>string2</emphasis>>
13725 can be the word <quote>fail</quote> (not in braces) to force expansion failure if the
13726 command does not succeed. If both strings are omitted, the result is contents
13727 of the standard output/error on success, and nothing on failure.
13730 <indexterm role="variable">
13731 <primary><varname>$runrc</varname></primary>
13733 The return code from the command is put in the variable <varname>$runrc</varname>, and this
13734 remains set afterwards, so in a filter file you can do things like this:
13736 <literallayout class="monospaced">
13737 if "${run{x y z}{}}$runrc" is 1 then ...
13738 elif $runrc is 2 then ...
13743 If execution of the command fails (for example, the command does not exist),
13744 the return code is 127 – the same code that shells use for non-existent
13748 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
13749 option values are expanded, except for those preconditions whose order of
13750 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
13751 by the expansion of one option, and use it in another.
13754 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
13755 out the use of this expansion item in filter files.
13757 </listitem></varlistentry>
13759 <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>
13762 <indexterm role="concept">
13763 <primary>expansion</primary>
13764 <secondary>string substitution</secondary>
13766 <indexterm role="concept">
13767 <primary><option>sg</option> expansion item</primary>
13769 This item works like Perl’s substitution operator (s) with the global (/g)
13770 option; hence its name. However, unlike the Perl equivalent, Exim does not
13771 modify the subject string; instead it returns the modified string for insertion
13772 into the overall expansion. The item takes three arguments: the subject string,
13773 a regular expression, and a substitution string. For example:
13775 <literallayout class="monospaced">
13776 ${sg{abcdefabcdef}{abc}{xyz}}
13779 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
13780 if any $ or \ characters are required in the regular expression or in the
13781 substitution string, they have to be escaped. For example:
13783 <literallayout class="monospaced">
13784 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
13787 yields <quote>defabc</quote>, and
13789 <literallayout class="monospaced">
13790 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
13793 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
13794 the regular expression from string expansion.
13796 </listitem></varlistentry>
13798 <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>
13801 <indexterm role="concept">
13802 <primary><option>substr</option> expansion item</primary>
13804 <indexterm role="concept">
13805 <primary>substring extraction</primary>
13807 <indexterm role="concept">
13808 <primary>expansion</primary>
13809 <secondary>substring extraction</secondary>
13811 The three strings are expanded; the first two must yield numbers. Call them
13812 <<emphasis>n</emphasis>> and <<emphasis>m</emphasis>>. If you are using fixed values for these numbers, that is,
13813 if <<emphasis>string1</emphasis>> and <<emphasis>string2</emphasis>> do not change when they are expanded, you
13814 can use the simpler operator notation that avoids some of the braces:
13816 <literallayout class="monospaced">
13817 ${substr_<n>_<m>:<string>}
13820 The second number is optional (in both notations).
13821 If it is absent in the simpler format, the preceding underscore must also be
13825 The <option>substr</option> item can be used to extract more general substrings than
13826 <option>length</option>. The first number, <<emphasis>n</emphasis>>, is a starting offset, and <<emphasis>m</emphasis>> is the
13827 length required. For example
13829 <literallayout class="monospaced">
13830 ${substr{3}{2}{$local_part}}
13833 If the starting offset is greater than the string length the result is the
13834 null string; if the length plus starting offset is greater than the string
13835 length, the result is the right-hand part of the string, starting from the
13836 given offset. The first character in the string has offset zero.
13839 The <option>substr</option> expansion item can take negative offset values to count
13840 from the right-hand end of its operand. The last character is offset -1, the
13841 second-last is offset -2, and so on. Thus, for example,
13843 <literallayout class="monospaced">
13844 ${substr{-5}{2}{1234567}}
13847 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
13848 length of the string, the substring starts at the beginning of the string, and
13849 the length is reduced by the amount of overshoot. Thus, for example,
13851 <literallayout class="monospaced">
13852 ${substr{-5}{2}{12}}
13855 yields an empty string, but
13857 <literallayout class="monospaced">
13858 ${substr{-3}{2}{12}}
13861 yields <quote>1</quote>.
13864 When the second number is omitted from <option>substr</option>, the remainder of the string
13865 is taken if the offset is positive. If it is negative, all characters in the
13866 string preceding the offset point are taken. For example, an offset of -1 and
13867 no length, as in these semantically identical examples:
13869 <literallayout class="monospaced">
13871 ${substr{-1}{abcde}}
13874 yields all but the last character of the string, that is, <quote>abcd</quote>.
13876 </listitem></varlistentry>
13878 <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>
13881 <indexterm role="concept">
13882 <primary>expansion</primary>
13883 <secondary>character translation</secondary>
13885 <indexterm role="concept">
13886 <primary><option>tr</option> expansion item</primary>
13888 This item does single-character translation on its subject string. The second
13889 argument is a list of characters to be translated in the subject string. Each
13890 matching character is replaced by the corresponding character from the
13891 replacement list. For example
13893 <literallayout class="monospaced">
13894 ${tr{abcdea}{ac}{13}}
13897 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
13898 last occurrence is used. If the third string is shorter than the second, its
13899 last character is replicated. However, if it is empty, no translation takes
13902 </listitem></varlistentry>
13905 <section id="SECTexpop">
13906 <title>Expansion operators</title>
13908 <indexterm role="concept">
13909 <primary>expansion</primary>
13910 <secondary>operators</secondary>
13912 For expansion items that perform transformations on a single argument string,
13913 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
13914 The substring is first expanded before the operation is applied to it. The
13915 following operations can be performed:
13919 <term><emphasis role="bold">${address:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13922 <indexterm role="concept">
13923 <primary>expansion</primary>
13924 <secondary>RFC 2822 address handling</secondary>
13926 <indexterm role="concept">
13927 <primary><option>address</option> expansion item</primary>
13929 The string is interpreted as an RFC 2822 address, as it might appear in a
13930 header line, and the effective address is extracted from it. If the string does
13931 not parse successfully, the result is empty.
13933 </listitem></varlistentry>
13935 <term><emphasis role="bold">${addresses:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13938 <indexterm role="concept">
13939 <primary>expansion</primary>
13940 <secondary>RFC 2822 address handling</secondary>
13942 <indexterm role="concept">
13943 <primary><option>addresses</option> expansion item</primary>
13945 The string (after expansion) is interpreted as a list of addresses in RFC
13946 2822 format, such as can be found in a <emphasis>To:</emphasis> or <emphasis>Cc:</emphasis> header line. The
13947 operative address (<emphasis>local-part@domain</emphasis>) is extracted from each item, and the
13948 result of the expansion is a colon-separated list, with appropriate
13949 doubling of colons should any happen to be present in the email addresses.
13950 Syntactically invalid RFC2822 address items are omitted from the output.
13953 It is possible to specify a character other than colon for the output
13954 separator by starting the string with > followed by the new separator
13955 character. For example:
13957 <literallayout class="monospaced">
13958 ${addresses:>& Chief <ceo@up.stairs>, sec@base.ment (dogsbody)}
13961 expands to <literal>ceo@up.stairs&sec@base.ment</literal>. Compare the <emphasis role="bold">address</emphasis> (singular)
13962 expansion item, which extracts the working address from a single RFC2822
13963 address. See the <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and <emphasis role="bold">reduce</emphasis> items for ways of
13966 </listitem></varlistentry>
13968 <term><emphasis role="bold">${base62:</emphasis><<emphasis>digits</emphasis>><emphasis role="bold">}</emphasis></term>
13971 <indexterm role="concept">
13972 <primary><option>base62</option> expansion item</primary>
13974 <indexterm role="concept">
13975 <primary>expansion</primary>
13976 <secondary>conversion to base 62</secondary>
13978 The string must consist entirely of decimal digits. The number is converted to
13979 base 62 and output as a string of six characters, including leading zeros. In
13980 the few operating environments where Exim uses base 36 instead of base 62 for
13981 its message identifiers (because those systems do not have case-sensitive file
13982 names), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just to
13983 be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
13985 </listitem></varlistentry>
13987 <term><emphasis role="bold">${base62d:</emphasis><<emphasis>base-62 digits</emphasis>><emphasis role="bold">}</emphasis></term>
13990 <indexterm role="concept">
13991 <primary><option>base62d</option> expansion item</primary>
13993 <indexterm role="concept">
13994 <primary>expansion</primary>
13995 <secondary>conversion to base 62</secondary>
13997 The string must consist entirely of base-62 digits, or, in operating
13998 environments where Exim uses base 36 instead of base 62 for its message
13999 identifiers, base-36 digits. The number is converted to decimal and output as a
14002 </listitem></varlistentry>
14004 <term><emphasis role="bold">${domain:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14007 <indexterm role="concept">
14008 <primary>domain</primary>
14009 <secondary>extraction</secondary>
14011 <indexterm role="concept">
14012 <primary>expansion</primary>
14013 <secondary>domain extraction</secondary>
14015 The string is interpreted as an RFC 2822 address and the domain is extracted
14016 from it. If the string does not parse successfully, the result is empty.
14018 </listitem></varlistentry>
14020 <term><emphasis role="bold">${escape:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14023 <indexterm role="concept">
14024 <primary>expansion</primary>
14025 <secondary>escaping non-printing characters</secondary>
14027 <indexterm role="concept">
14028 <primary><option>escape</option> expansion item</primary>
14030 If the string contains any non-printing characters, they are converted to
14031 escape sequences starting with a backslash. Whether characters with the most
14032 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
14033 is controlled by the <option>print_topbitchars</option> option.
14035 </listitem></varlistentry>
14037 <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>
14040 <indexterm role="concept">
14041 <primary>expansion</primary>
14042 <secondary>expression evaluation</secondary>
14044 <indexterm role="concept">
14045 <primary>expansion</primary>
14046 <secondary>arithmetic expression</secondary>
14048 <indexterm role="concept">
14049 <primary><option>eval</option> expansion item</primary>
14051 These items supports simple arithmetic and bitwise logical operations in
14052 expansion strings. The string (after expansion) must be a conventional
14053 arithmetic expression, but it is limited to basic arithmetic operators, bitwise
14054 logical operators, and parentheses. All operations are carried out using
14055 integer arithmetic. The operator priorities are as follows (the same as in the
14056 C programming language):
14058 <informaltable frame="none">
14059 <tgroup cols="2" colsep="0" rowsep="0">
14060 <colspec colwidth="70pt" align="left"/>
14061 <colspec colwidth="300pt" align="left"/>
14064 <entry> <emphasis>highest:</emphasis></entry>
14065 <entry>not (~), negate (-)</entry>
14068 <entry> </entry>
14069 <entry>multiply (*), divide (/), remainder (%)</entry>
14072 <entry> </entry>
14073 <entry>plus (+), minus (-)</entry>
14076 <entry> </entry>
14077 <entry>shift-left (<<), shift-right (>>)</entry>
14080 <entry> </entry>
14081 <entry>and (&)</entry>
14084 <entry> </entry>
14085 <entry>xor (^)</entry>
14088 <entry> <emphasis>lowest:</emphasis></entry>
14089 <entry>or (|)</entry>
14095 Binary operators with the same priority are evaluated from left to right. White
14096 space is permitted before or after operators.
14099 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
14100 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
14101 decimal, even if they start with a leading zero; hexadecimal numbers are not
14102 permitted. This can be useful when processing numbers extracted from dates or
14103 times, which often do have leading zeros.
14106 A number may be followed by <quote>K</quote> or <quote>M</quote> to multiply it by 1024 or 1024*1024,
14107 respectively. Negative numbers are supported. The result of the computation is
14108 a decimal representation of the answer (without <quote>K</quote> or <quote>M</quote>). For example:
14111 <literal>${eval:1+1} </literal> yields 2
14112 <literal>${eval:1+2*3} </literal> yields 7
14113 <literal>${eval:(1+2)*3} </literal> yields 9
14114 <literal>${eval:2+42%5} </literal> yields 4
14115 <literal>${eval:0xc&5} </literal> yields 4
14116 <literal>${eval:0xc|5} </literal> yields 13
14117 <literal>${eval:0xc^5} </literal> yields 9
14118 <literal>${eval:0xc>>1} </literal> yields 6
14119 <literal>${eval:0xc<<1} </literal> yields 24
14120 <literal>${eval:~255&0x1234} </literal> yields 4608
14121 <literal>${eval:-(~255&0x1234)} </literal> yields -4608
14124 As a more realistic example, in an ACL you might have
14126 <literallayout class="monospaced">
14127 deny message = Too many bad recipients
14130 {>{$rcpt_count}{10}} \
14133 {$recipients_count} \
14134 {${eval:$rcpt_count/2}} \
14139 The condition is true if there have been more than 10 RCPT commands and
14140 fewer than half of them have resulted in a valid recipient.
14142 </listitem></varlistentry>
14144 <term><emphasis role="bold">${expand:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14147 <indexterm role="concept">
14148 <primary>expansion</primary>
14149 <secondary>re-expansion of substring</secondary>
14151 The <option>expand</option> operator causes a string to be expanded for a second time. For
14154 <literallayout class="monospaced">
14155 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
14158 first looks up a string in a file while expanding the operand for <option>expand</option>,
14159 and then re-expands what it has found.
14161 </listitem></varlistentry>
14163 <term><emphasis role="bold">${from_utf8:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14166 <indexterm role="concept">
14167 <primary>Unicode</primary>
14169 <indexterm role="concept">
14170 <primary>UTF-8</primary>
14171 <secondary>conversion from</secondary>
14173 <indexterm role="concept">
14174 <primary>expansion</primary>
14175 <secondary>UTF-8 conversion</secondary>
14177 <indexterm role="concept">
14178 <primary><option>from_utf8</option> expansion item</primary>
14180 The world is slowly moving towards Unicode, although there are no standards for
14181 email yet. However, other applications (including some databases) are starting
14182 to store data in Unicode, using UTF-8 encoding. This operator converts from a
14183 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
14184 converted to underscores. The input must be a valid UTF-8 string. If it is not,
14185 the result is an undefined sequence of bytes.
14188 Unicode code points with values less than 256 are compatible with ASCII and
14189 ISO-8859-1 (also known as Latin-1).
14190 For example, character 169 is the copyright symbol in both cases, though the
14191 way it is encoded is different. In UTF-8, more than one byte is needed for
14192 characters with code values greater than 127, whereas ISO-8859-1 is a
14193 single-byte encoding (but thereby limited to 256 characters). This makes
14194 translation from UTF-8 to ISO-8859-1 straightforward.
14196 </listitem></varlistentry>
14198 <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>
14201 <indexterm role="concept">
14202 <primary>hash function</primary>
14203 <secondary>textual</secondary>
14205 <indexterm role="concept">
14206 <primary>expansion</primary>
14207 <secondary>textual hash</secondary>
14209 The <option>hash</option> operator is a simpler interface to the hashing function that can
14210 be used when the two parameters are fixed numbers (as opposed to strings that
14211 change when expanded). The effect is the same as
14213 <literallayout class="monospaced">
14214 ${hash{<n>}{<m>}{<string>}}
14217 See the description of the general <option>hash</option> item above for details. The
14218 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
14220 </listitem></varlistentry>
14222 <term><emphasis role="bold">${hex2b64:</emphasis><<emphasis>hexstring</emphasis>><emphasis role="bold">}</emphasis></term>
14225 <indexterm role="concept">
14226 <primary>base64 encoding</primary>
14227 <secondary>conversion from hex</secondary>
14229 <indexterm role="concept">
14230 <primary>expansion</primary>
14231 <secondary>hex to base64</secondary>
14233 <indexterm role="concept">
14234 <primary><option>hex2b64</option> expansion item</primary>
14236 This operator converts a hex string into one that is base64 encoded. This can
14237 be useful for processing the output of the MD5 and SHA-1 hashing functions.
14239 </listitem></varlistentry>
14241 <term><emphasis role="bold">${lc:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14244 <indexterm role="concept">
14245 <primary>case forcing in strings</primary>
14247 <indexterm role="concept">
14248 <primary>string</primary>
14249 <secondary>case forcing</secondary>
14251 <indexterm role="concept">
14252 <primary>lower casing</primary>
14254 <indexterm role="concept">
14255 <primary>expansion</primary>
14256 <secondary>case forcing</secondary>
14258 <indexterm role="concept">
14259 <primary><option>lc</option> expansion item</primary>
14261 This forces the letters in the string into lower-case, for example:
14263 <literallayout class="monospaced">
14266 </listitem></varlistentry>
14268 <term><emphasis role="bold">${length_</emphasis><<emphasis>number</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14271 <indexterm role="concept">
14272 <primary>expansion</primary>
14273 <secondary>string truncation</secondary>
14275 <indexterm role="concept">
14276 <primary><option>length</option> expansion item</primary>
14278 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
14279 can be used when the parameter is a fixed number (as opposed to a string that
14280 changes when expanded). The effect is the same as
14282 <literallayout class="monospaced">
14283 ${length{<number>}{<string>}}
14286 See the description of the general <option>length</option> item above for details. Note that
14287 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
14288 when <option>length</option> is used as an operator.
14290 </listitem></varlistentry>
14292 <term><emphasis role="bold">${local_part:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14295 <indexterm role="concept">
14296 <primary>expansion</primary>
14297 <secondary>local part extraction</secondary>
14299 <indexterm role="concept">
14300 <primary><option>local_part</option> expansion item</primary>
14302 The string is interpreted as an RFC 2822 address and the local part is
14303 extracted from it. If the string does not parse successfully, the result is
14306 </listitem></varlistentry>
14308 <term><emphasis role="bold">${mask:</emphasis><<emphasis>IP address</emphasis>><emphasis role="bold">/</emphasis><<emphasis>bit count</emphasis>><emphasis role="bold">}</emphasis></term>
14311 <indexterm role="concept">
14312 <primary>masked IP address</primary>
14314 <indexterm role="concept">
14315 <primary>IP address</primary>
14316 <secondary>masking</secondary>
14318 <indexterm role="concept">
14319 <primary>CIDR notation</primary>
14321 <indexterm role="concept">
14322 <primary>expansion</primary>
14323 <secondary>IP address masking</secondary>
14325 <indexterm role="concept">
14326 <primary><option>mask</option> expansion item</primary>
14328 If the form of the string to be operated on is not an IP address followed by a
14329 slash and an integer (that is, a network address in CIDR notation), the
14330 expansion fails. Otherwise, this operator converts the IP address to binary,
14331 masks off the least significant bits according to the bit count, and converts
14332 the result back to text, with mask appended. For example,
14334 <literallayout class="monospaced">
14335 ${mask:10.111.131.206/28}
14338 returns the string <quote>10.111.131.192/28</quote>. Since this operation is expected to
14339 be mostly used for looking up masked addresses in files, the result for an IPv6
14340 address uses dots to separate components instead of colons, because colon
14341 terminates a key string in lsearch files. So, for example,
14343 <literallayout class="monospaced">
14344 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
14349 <literallayout class="monospaced">
14350 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
14353 Letters in IPv6 addresses are always output in lower case.
14355 </listitem></varlistentry>
14357 <term><emphasis role="bold">${md5:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14360 <indexterm role="concept">
14361 <primary>MD5 hash</primary>
14363 <indexterm role="concept">
14364 <primary>expansion</primary>
14365 <secondary>MD5 hash</secondary>
14367 <indexterm role="concept">
14368 <primary><option>md5</option> expansion item</primary>
14370 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
14371 as a 32-digit hexadecimal number, in which any letters are in lower case.
14373 </listitem></varlistentry>
14375 <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>
14378 <indexterm role="concept">
14379 <primary>expansion</primary>
14380 <secondary>numeric hash</secondary>
14382 <indexterm role="concept">
14383 <primary>hash function</primary>
14384 <secondary>numeric</secondary>
14386 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
14387 that can be used when the two parameters are fixed numbers (as opposed to
14388 strings that change when expanded). The effect is the same as
14390 <literallayout class="monospaced">
14391 ${nhash{<n>}{<m>}{<string>}}
14394 See the description of the general <option>nhash</option> item above for details.
14396 </listitem></varlistentry>
14398 <term><emphasis role="bold">${quote:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14401 <indexterm role="concept">
14402 <primary>quoting</primary>
14403 <secondary>in string expansions</secondary>
14405 <indexterm role="concept">
14406 <primary>expansion</primary>
14407 <secondary>quoting</secondary>
14409 <indexterm role="concept">
14410 <primary><option>quote</option> expansion item</primary>
14412 The <option>quote</option> operator puts its argument into double quotes if it
14413 is an empty string or
14414 contains anything other than letters, digits, underscores, dots, and hyphens.
14415 Any occurrences of double quotes and backslashes are escaped with a backslash.
14416 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
14417 respectively For example,
14419 <literallayout class="monospaced">
14425 <literallayout class="monospaced">
14429 The place where this is useful is when the argument is a substitution from a
14430 variable or a message header.
14432 </listitem></varlistentry>
14434 <term><emphasis role="bold">${quote_local_part:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14437 <indexterm role="concept">
14438 <primary><option>quote_local_part</option> expansion item</primary>
14440 This operator is like <option>quote</option>, except that it quotes the string only if
14441 required to do so by the rules of RFC 2822 for quoting local parts. For
14442 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
14443 If you are creating a new email address from the contents of <varname>$local_part</varname>
14444 (or any other unknown data), you should always use this operator.
14446 </listitem></varlistentry>
14448 <term><emphasis role="bold">${quote_</emphasis><<emphasis>lookup-type</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14451 <indexterm role="concept">
14452 <primary>quoting</primary>
14453 <secondary>lookup-specific</secondary>
14455 This operator applies lookup-specific quoting rules to the string. Each
14456 query-style lookup type has its own quoting rules which are described with
14457 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
14459 <literallayout class="monospaced">
14460 ${quote_ldap:two * two}
14465 <literallayout class="monospaced">
14469 For single-key lookup types, no quoting is ever necessary and this operator
14470 yields an unchanged string.
14472 </listitem></varlistentry>
14474 <term><emphasis role="bold">${randint:</emphasis><<emphasis>n</emphasis>><emphasis role="bold">}</emphasis></term>
14477 <indexterm role="concept">
14478 <primary>random number</primary>
14480 This operator returns a somewhat random number which is less than the
14481 supplied number and is at least 0. The quality of this randomness depends
14482 on how Exim was built; the values are not suitable for keying material.
14483 If Exim is linked against OpenSSL then RAND_pseudo_bytes() is used.
14484 Otherwise, the implementation may be arc4random(), random() seeded by
14485 srandomdev() or srandom(), or a custom implementation even weaker than
14488 </listitem></varlistentry>
14490 <term><emphasis role="bold">${reverse_ip:</emphasis><<emphasis>ipaddr</emphasis>><emphasis role="bold">}</emphasis></term>
14493 <indexterm role="concept">
14494 <primary>expansion</primary>
14495 <secondary>IP address</secondary>
14497 This operator reverses an IP address; for IPv4 addresses, the result is in
14498 dotted-quad decimal form, while for IPv6 addreses the result is in
14499 dotted-nibble hexadecimal form. In both cases, this is the "natural" form
14500 for DNS. For example,
14502 <literallayout class="monospaced">
14503 ${reverse_ip:192.0.2.4} and ${reverse_ip:2001:0db8:c42:9:1:abcd:192.0.2.3}
14508 <literallayout class="monospaced">
14509 4.2.0.192 and 3.0.2.0.0.0.0.c.d.c.b.a.1.0.0.0.9.0.0.0.2.4.c.0.8.b.d.0.1.0.0.2
14511 </listitem></varlistentry>
14513 <term><emphasis role="bold">${rfc2047:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14516 <indexterm role="concept">
14517 <primary>expansion</primary>
14518 <secondary>RFC 2047</secondary>
14520 <indexterm role="concept">
14521 <primary>RFC 2047</primary>
14522 <secondary>expansion operator</secondary>
14524 <indexterm role="concept">
14525 <primary><option>rfc2047</option> expansion item</primary>
14527 This operator encodes text according to the rules of RFC 2047. This is an
14528 encoding that is used in header lines to encode non-ASCII characters. It is
14529 assumed that the input string is in the encoding specified by the
14530 <option>headers_charset</option> option, which defaults to ISO-8859-1. If the string
14531 contains only characters in the range 33–126, and no instances of the
14534 <literallayout class="monospaced">
14535 ? = ( ) < > @ , ; : \ " . [ ] _
14538 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
14539 string, using as many <quote>encoded words</quote> as necessary to encode all the
14542 </listitem></varlistentry>
14544 <term><emphasis role="bold">${rfc2047d:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14547 <indexterm role="concept">
14548 <primary>expansion</primary>
14549 <secondary>RFC 2047</secondary>
14551 <indexterm role="concept">
14552 <primary>RFC 2047</primary>
14553 <secondary>decoding</secondary>
14555 <indexterm role="concept">
14556 <primary><option>rfc2047d</option> expansion item</primary>
14558 This operator decodes strings that are encoded as per RFC 2047. Binary zero
14559 bytes are replaced by question marks. Characters are converted into the
14560 character set defined by <option>headers_charset</option>. Overlong RFC 2047 <quote>words</quote> are
14561 not recognized unless <option>check_rfc2047_length</option> is set false.
14564 <emphasis role="bold">Note</emphasis>: If you use <option>$header</option>_<emphasis>xxx</emphasis><emphasis role="bold">:</emphasis> (or <option>$h</option>_<emphasis>xxx</emphasis><emphasis role="bold">:</emphasis>) to
14565 access a header line, RFC 2047 decoding is done automatically. You do not need
14566 to use this operator as well.
14568 </listitem></varlistentry>
14570 <term><emphasis role="bold">${rxquote:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14573 <indexterm role="concept">
14574 <primary>quoting</primary>
14575 <secondary>in regular expressions</secondary>
14577 <indexterm role="concept">
14578 <primary>regular expressions</primary>
14579 <secondary>quoting</secondary>
14581 <indexterm role="concept">
14582 <primary><option>rxquote</option> expansion item</primary>
14584 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
14585 characters in its argument. This is useful when substituting the values of
14586 variables or headers inside regular expressions.
14588 </listitem></varlistentry>
14590 <term><emphasis role="bold">${sha1:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14593 <indexterm role="concept">
14594 <primary>SHA-1 hash</primary>
14596 <indexterm role="concept">
14597 <primary>expansion</primary>
14598 <secondary>SHA-1 hashing</secondary>
14600 <indexterm role="concept">
14601 <primary><option>sha2</option> expansion item</primary>
14603 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
14604 it as a 40-digit hexadecimal number, in which any letters are in upper case.
14606 </listitem></varlistentry>
14608 <term><emphasis role="bold">${stat:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14611 <indexterm role="concept">
14612 <primary>expansion</primary>
14613 <secondary>statting a file</secondary>
14615 <indexterm role="concept">
14616 <primary>file</primary>
14617 <secondary>extracting characteristics</secondary>
14619 <indexterm role="concept">
14620 <primary><option>stat</option> expansion item</primary>
14622 The string, after expansion, must be a file path. A call to the <function>stat()</function>
14623 function is made for this path. If <function>stat()</function> fails, an error occurs and the
14624 expansion fails. If it succeeds, the data from the stat replaces the item, as a
14625 series of <<emphasis>name</emphasis>>=<<emphasis>value</emphasis>> pairs, where the values are all numerical,
14626 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
14627 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
14628 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
14629 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
14630 can extract individual fields using the <option>extract</option> expansion item.
14633 The use of the <option>stat</option> expansion in users’ filter files can be locked out by
14634 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
14635 systems for files larger than 2GB.
14637 </listitem></varlistentry>
14639 <term><emphasis role="bold">${str2b64:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14642 <indexterm role="concept">
14643 <primary>expansion</primary>
14644 <secondary>base64 encoding</secondary>
14646 <indexterm role="concept">
14647 <primary>base64 encoding</primary>
14648 <secondary>in string expansion</secondary>
14650 <indexterm role="concept">
14651 <primary><option>str2b64</option> expansion item</primary>
14653 This operator converts a string into one that is base64 encoded.
14655 </listitem></varlistentry>
14657 <term><emphasis role="bold">${strlen:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14660 <indexterm role="concept">
14661 <primary>expansion</primary>
14662 <secondary>string length</secondary>
14664 <indexterm role="concept">
14665 <primary>string</primary>
14666 <secondary>length in expansion</secondary>
14668 <indexterm role="concept">
14669 <primary><option>strlen</option> expansion item</primary>
14671 The item is replace by the length of the expanded string, expressed as a
14672 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
14674 </listitem></varlistentry>
14676 <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>
14679 <indexterm role="concept">
14680 <primary><option>substr</option> expansion item</primary>
14682 <indexterm role="concept">
14683 <primary>substring extraction</primary>
14685 <indexterm role="concept">
14686 <primary>expansion</primary>
14687 <secondary>substring expansion</secondary>
14689 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
14690 can be used when the two parameters are fixed numbers (as opposed to strings
14691 that change when expanded). The effect is the same as
14693 <literallayout class="monospaced">
14694 ${substr{<start>}{<length>}{<string>}}
14697 See the description of the general <option>substr</option> item above for details. The
14698 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
14700 </listitem></varlistentry>
14702 <term><emphasis role="bold">${time_eval:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14705 <indexterm role="concept">
14706 <primary><option>time_eval</option> expansion item</primary>
14708 <indexterm role="concept">
14709 <primary>time interval</primary>
14710 <secondary>decoding</secondary>
14712 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
14715 </listitem></varlistentry>
14717 <term><emphasis role="bold">${time_interval:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14720 <indexterm role="concept">
14721 <primary><option>time_interval</option> expansion item</primary>
14723 <indexterm role="concept">
14724 <primary>time interval</primary>
14725 <secondary>formatting</secondary>
14727 The argument (after sub-expansion) must be a sequence of decimal digits that
14728 represents an interval of time as a number of seconds. It is converted into a
14729 number of larger units and output in Exim’s normal time format, for example,
14730 <literal>1w3d4h2m6s</literal>.
14732 </listitem></varlistentry>
14734 <term><emphasis role="bold">${uc:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14737 <indexterm role="concept">
14738 <primary>case forcing in strings</primary>
14740 <indexterm role="concept">
14741 <primary>string</primary>
14742 <secondary>case forcing</secondary>
14744 <indexterm role="concept">
14745 <primary>upper casing</primary>
14747 <indexterm role="concept">
14748 <primary>expansion</primary>
14749 <secondary>case forcing</secondary>
14751 <indexterm role="concept">
14752 <primary><option>uc</option> expansion item</primary>
14754 This forces the letters in the string into upper-case.
14756 </listitem></varlistentry>
14759 <section id="SECTexpcond">
14760 <title>Expansion conditions</title>
14762 <indexterm role="concept" id="IIDexpcond" class="startofrange">
14763 <primary>expansion</primary>
14764 <secondary>conditions</secondary>
14766 The following conditions are available for testing by the <option>${if</option> construct
14767 while expanding strings:
14771 <term><emphasis role="bold">!</emphasis><<emphasis>condition</emphasis>></term>
14774 <indexterm role="concept">
14775 <primary>expansion</primary>
14776 <secondary>negating a condition</secondary>
14778 <indexterm role="concept">
14779 <primary>negation</primary>
14780 <secondary>in expansion condition</secondary>
14782 Preceding any condition with an exclamation mark negates the result of the
14785 </listitem></varlistentry>
14787 <term><<emphasis>symbolic operator</emphasis>> <emphasis role="bold">{</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14790 <indexterm role="concept">
14791 <primary>numeric comparison</primary>
14793 <indexterm role="concept">
14794 <primary>expansion</primary>
14795 <secondary>numeric comparison</secondary>
14797 There are a number of symbolic operators for doing numeric comparisons. They
14801 <literal>= </literal> equal
14802 <literal>== </literal> equal
14803 <literal>> </literal> greater
14804 <literal>>= </literal> greater or equal
14805 <literal>< </literal> less
14806 <literal><= </literal> less or equal
14811 <literallayout class="monospaced">
14812 ${if >{$message_size}{10M} ...
14815 Note that the general negation operator provides for inequality testing. The
14816 two strings must take the form of optionally signed decimal integers,
14817 optionally followed by one of the letters <quote>K</quote> or <quote>M</quote> (in either upper or
14818 lower case), signifying multiplication by 1024 or 1024*1024, respectively.
14819 As a special case, the numerical value of an empty string is taken as
14822 </listitem></varlistentry>
14824 <term><emphasis role="bold">bool {</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14827 <indexterm role="concept">
14828 <primary>expansion</primary>
14829 <secondary>boolean parsing</secondary>
14831 <indexterm role="concept">
14832 <primary><option>bool</option> expansion condition</primary>
14834 This condition turns a string holding a true or false representation into
14835 a boolean state. It parses <quote>true</quote>, <quote>false</quote>, <quote>yes</quote> and <quote>no</quote>
14836 (case-insensitively); also positive integer numbers map to true if non-zero,
14837 false if zero. Leading and trailing whitespace is ignored.
14838 All other string values will result in expansion failure.
14841 When combined with ACL variables, this expansion condition will let you
14842 make decisions in one place and act on those decisions in another place.
14845 <literallayout class="monospaced">
14846 ${if bool{$acl_m_privileged_sender} ...
14848 </listitem></varlistentry>
14850 <term><emphasis role="bold">bool_lax {</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14853 <indexterm role="concept">
14854 <primary>expansion</primary>
14855 <secondary>boolean parsing</secondary>
14857 <indexterm role="concept">
14858 <primary><option>bool_lax</option> expansion condition</primary>
14860 Like <option>bool</option>, this condition turns a string into a boolean state. But
14861 where <option>bool</option> accepts a strict set of strings, <option>bool_lax</option> uses the same
14862 loose definition that the Router <option>condition</option> option uses. The empty string
14863 and the values <quote>false</quote>, <quote>no</quote> and <quote>0</quote> map to false, all others map to
14864 true. Leading and trailing whitespace is ignored.
14867 Note that where <quote>bool{00}</quote> is false, <quote>bool_lax{00}</quote> is true.
14869 </listitem></varlistentry>
14871 <term><emphasis role="bold">crypteq {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14874 <indexterm role="concept">
14875 <primary>expansion</primary>
14876 <secondary>encrypted comparison</secondary>
14878 <indexterm role="concept">
14879 <primary>encrypted strings, comparing</primary>
14881 <indexterm role="concept">
14882 <primary><option>crypteq</option> expansion condition</primary>
14884 This condition is included in the Exim binary if it is built to support any
14885 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
14886 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
14887 included in the binary.
14890 The <option>crypteq</option> condition has two arguments. The first is encrypted and
14891 compared against the second, which is already encrypted. The second string may
14892 be in the LDAP form for storing encrypted strings, which starts with the
14893 encryption type in curly brackets, followed by the data. If the second string
14894 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
14895 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
14896 Typically this will be a field from a password file. An example of an encrypted
14897 string in LDAP form is:
14899 <literallayout class="monospaced">
14900 {md5}CY9rzUYh03PK3k6DJie09g==
14903 If such a string appears directly in an expansion, the curly brackets have to
14904 be quoted, because they are part of the expansion syntax. For example:
14906 <literallayout class="monospaced">
14907 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
14910 The following encryption types (whose names are matched case-independently) are
14916 <indexterm role="concept">
14917 <primary>MD5 hash</primary>
14919 <indexterm role="concept">
14920 <primary>base64 encoding</primary>
14921 <secondary>in encrypted password</secondary>
14923 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
14924 printable characters to compare with the remainder of the second string. If the
14925 length of the comparison string is 24, Exim assumes that it is base64 encoded
14926 (as in the above example). If the length is 32, Exim assumes that it is a
14927 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
14933 <indexterm role="concept">
14934 <primary>SHA-1 hash</primary>
14936 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
14937 printable characters to compare with the remainder of the second string. If the
14938 length of the comparison string is 28, Exim assumes that it is base64 encoded.
14939 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
14940 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
14945 <indexterm role="concept">
14946 <primary><function>crypt()</function></primary>
14948 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
14949 only the first eight characters of the password. However, in modern operating
14950 systems this is no longer true, and in many cases the entire password is used,
14951 whatever its length.
14956 <indexterm role="concept">
14957 <primary><function>crypt16()</function></primary>
14959 <option>{crypt16}</option> calls the <function>crypt16()</function> function, which was originally created to
14960 use up to 16 characters of the password in some operating systems. Again, in
14961 modern operating systems, more characters may be used.
14966 Exim has its own version of <function>crypt16()</function>, which is just a double call to
14967 <function>crypt()</function>. For operating systems that have their own version, setting
14968 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
14969 operating system version instead of its own. This option is set by default in
14970 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
14971 support <function>crypt16()</function>.
14974 Some years after Exim’s <function>crypt16()</function> was implemented, a user discovered that
14975 it was not using the same algorithm as some operating systems’ versions. It
14976 turns out that as well as <function>crypt16()</function> there is a function called
14977 <function>bigcrypt()</function> in some operating systems. This may or may not use the same
14978 algorithm, and both of them may be different to Exim’s built-in <function>crypt16()</function>.
14981 However, since there is now a move away from the traditional <function>crypt()</function>
14982 functions towards using SHA1 and other algorithms, tidying up this area of
14983 Exim is seen as very low priority.
14986 If you do not put a encryption type (in curly brackets) in a <option>crypteq</option>
14987 comparison, the default is usually either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as
14988 determined by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default
14989 default is <literal>{crypt}</literal>. Whatever the default, you can always use either
14990 function by specifying it explicitly in curly brackets.
14992 </listitem></varlistentry>
14994 <term><emphasis role="bold">def:</emphasis><<emphasis>variable name</emphasis>></term>
14997 <indexterm role="concept">
14998 <primary>expansion</primary>
14999 <secondary>checking for empty variable</secondary>
15001 <indexterm role="concept">
15002 <primary><option>def</option> expansion condition</primary>
15004 The <option>def</option> condition must be followed by the name of one of the expansion
15005 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
15006 variable does not contain the empty string. For example:
15008 <literallayout class="monospaced">
15009 ${if def:sender_ident {from $sender_ident}}
15012 Note that the variable name is given without a leading <option>$</option> character. If the
15013 variable does not exist, the expansion fails.
15015 </listitem></varlistentry>
15017 <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>
15020 <indexterm role="concept">
15021 <primary>expansion</primary>
15022 <secondary>checking header line existence</secondary>
15024 This condition is true if a message is being processed and the named header
15025 exists in the message. For example,
15027 <literallayout class="monospaced">
15028 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
15031 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
15032 the header name must be terminated by a colon if white space does not follow.
15034 </listitem></varlistentry>
15036 <term><emphasis role="bold">eq {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15037 <term><emphasis role="bold">eqi {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15040 <indexterm role="concept">
15041 <primary>string</primary>
15042 <secondary>comparison</secondary>
15044 <indexterm role="concept">
15045 <primary>expansion</primary>
15046 <secondary>string comparison</secondary>
15048 <indexterm role="concept">
15049 <primary><option>eq</option> expansion condition</primary>
15051 <indexterm role="concept">
15052 <primary><option>eqi</option> expansion condition</primary>
15054 The two substrings are first expanded. The condition is true if the two
15055 resulting strings are identical. For <option>eq</option> the comparison includes the case of
15056 letters, whereas for <option>eqi</option> the comparison is case-independent.
15058 </listitem></varlistentry>
15060 <term><emphasis role="bold">exists {</emphasis><<emphasis>file name</emphasis>><emphasis role="bold">}</emphasis></term>
15063 <indexterm role="concept">
15064 <primary>expansion</primary>
15065 <secondary>file existence test</secondary>
15067 <indexterm role="concept">
15068 <primary>file</primary>
15069 <secondary>existence test</secondary>
15071 <indexterm role="concept">
15072 <primary><option>exists</option>, expansion condition</primary>
15074 The substring is first expanded and then interpreted as an absolute path. The
15075 condition is true if the named file (or directory) exists. The existence test
15076 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
15077 users’ filter files may be locked out by the system administrator.
15079 </listitem></varlistentry>
15081 <term><emphasis role="bold">first_delivery</emphasis></term>
15084 <indexterm role="concept">
15085 <primary>delivery</primary>
15086 <secondary>first</secondary>
15088 <indexterm role="concept">
15089 <primary>first delivery</primary>
15091 <indexterm role="concept">
15092 <primary>expansion</primary>
15093 <secondary>first delivery test</secondary>
15095 <indexterm role="concept">
15096 <primary><option>first_delivery</option> expansion condition</primary>
15098 This condition, which has no data, is true during a message’s first delivery
15099 attempt. It is false during any subsequent delivery attempts.
15101 </listitem></varlistentry>
15103 <term><emphasis role="bold">forall{</emphasis><<emphasis>a list</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>a condition</emphasis>><emphasis role="bold">}</emphasis></term>
15104 <term><emphasis role="bold">forany{</emphasis><<emphasis>a list</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>a condition</emphasis>><emphasis role="bold">}</emphasis></term>
15107 <indexterm role="concept">
15108 <primary>list</primary>
15109 <secondary>iterative conditions</secondary>
15111 <indexterm role="concept">
15112 <primary>expansion</primary>
15113 <secondary><emphasis role="bold">forall</emphasis> condition</secondary>
15115 <indexterm role="concept">
15116 <primary>expansion</primary>
15117 <secondary><emphasis role="bold">forany</emphasis> condition</secondary>
15119 <indexterm role="variable">
15120 <primary><varname>$item</varname></primary>
15122 These conditions iterate over a list. The first argument is expanded to form
15123 the list. By default, the list separator is a colon, but it can be changed by
15124 the normal method. The second argument is interpreted as a condition that is to
15125 be applied to each item in the list in turn. During the interpretation of the
15126 condition, the current list item is placed in a variable called <varname>$item</varname>.
15131 For <emphasis role="bold">forany</emphasis>, interpretation stops if the condition is true for any item, and
15132 the result of the whole condition is true. If the condition is false for all
15133 items in the list, the overall condition is false.
15138 For <emphasis role="bold">forall</emphasis>, interpretation stops if the condition is false for any item,
15139 and the result of the whole condition is false. If the condition is true for
15140 all items in the list, the overall condition is true.
15145 Note that negation of <emphasis role="bold">forany</emphasis> means that the condition must be false for all
15146 items for the overall condition to succeed, and negation of <emphasis role="bold">forall</emphasis> means
15147 that the condition must be false for at least one item. In this example, the
15148 list separator is changed to a comma:
15150 <literallayout class="monospaced">
15151 ${if forany{<, $recipients}{match{$item}{^user3@}}{yes}{no}}
15154 The value of <varname>$item</varname> is saved and restored while <emphasis role="bold">forany</emphasis> or <emphasis role="bold">forall</emphasis> is
15155 being processed, to enable these expansion items to be nested.
15157 </listitem></varlistentry>
15159 <term><emphasis role="bold">ge {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15160 <term><emphasis role="bold">gei {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15163 <indexterm role="concept">
15164 <primary>string</primary>
15165 <secondary>comparison</secondary>
15167 <indexterm role="concept">
15168 <primary>expansion</primary>
15169 <secondary>string comparison</secondary>
15171 <indexterm role="concept">
15172 <primary><option>ge</option> expansion condition</primary>
15174 <indexterm role="concept">
15175 <primary><option>gei</option> expansion condition</primary>
15177 The two substrings are first expanded. The condition is true if the first
15178 string is lexically greater than or equal to the second string. For <option>ge</option> the
15179 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
15182 </listitem></varlistentry>
15184 <term><emphasis role="bold">gt {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15185 <term><emphasis role="bold">gti {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15188 <indexterm role="concept">
15189 <primary>string</primary>
15190 <secondary>comparison</secondary>
15192 <indexterm role="concept">
15193 <primary>expansion</primary>
15194 <secondary>string comparison</secondary>
15196 <indexterm role="concept">
15197 <primary><option>gt</option> expansion condition</primary>
15199 <indexterm role="concept">
15200 <primary><option>gti</option> expansion condition</primary>
15202 The two substrings are first expanded. The condition is true if the first
15203 string is lexically greater than the second string. For <option>gt</option> the comparison
15204 includes the case of letters, whereas for <option>gti</option> the comparison is
15207 </listitem></varlistentry>
15209 <term><emphasis role="bold">isip {</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
15210 <term><emphasis role="bold">isip4 {</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
15211 <term><emphasis role="bold">isip6 {</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
15214 <indexterm role="concept">
15215 <primary>IP address</primary>
15216 <secondary>testing string format</secondary>
15218 <indexterm role="concept">
15219 <primary>string</primary>
15220 <secondary>testing for IP address</secondary>
15222 <indexterm role="concept">
15223 <primary><option>isip</option> expansion condition</primary>
15225 <indexterm role="concept">
15226 <primary><option>isip4</option> expansion condition</primary>
15228 <indexterm role="concept">
15229 <primary><option>isip6</option> expansion condition</primary>
15231 The substring is first expanded, and then tested to see if it has the form of
15232 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
15233 <option>isip4</option> and <option>isip6</option> test specifically for IPv4 or IPv6 addresses.
15236 For an IPv4 address, the test is for four dot-separated components, each of
15237 which consists of from one to three digits. For an IPv6 address, up to eight
15238 colon-separated components are permitted, each containing from one to four
15239 hexadecimal digits. There may be fewer than eight components if an empty
15240 component (adjacent colons) is present. Only one empty component is permitted.
15243 <emphasis role="bold">Note</emphasis>: The checks are just on the form of the address; actual numerical
15244 values are not considered. Thus, for example, 999.999.999.999 passes the IPv4
15245 check. The main use of these tests is to distinguish between IP addresses and
15246 host names, or between IPv4 and IPv6 addresses. For example, you could use
15248 <literallayout class="monospaced">
15249 ${if isip4{$sender_host_address}...
15252 to test which IP version an incoming SMTP connection is using.
15254 </listitem></varlistentry>
15256 <term><emphasis role="bold">ldapauth {</emphasis><<emphasis>ldap query</emphasis>><emphasis role="bold">}</emphasis></term>
15259 <indexterm role="concept">
15260 <primary>LDAP</primary>
15261 <secondary>use for authentication</secondary>
15263 <indexterm role="concept">
15264 <primary>expansion</primary>
15265 <secondary>LDAP authentication test</secondary>
15267 <indexterm role="concept">
15268 <primary><option>ldapauth</option> expansion condition</primary>
15270 This condition supports user authentication using LDAP. See section
15271 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
15272 queries. For this use, the query must contain a user name and password. The
15273 query itself is not used, and can be empty. The condition is true if the
15274 password is not empty, and the user name and password are accepted by the LDAP
15275 server. An empty password is rejected without calling LDAP because LDAP binds
15276 with an empty password are considered anonymous regardless of the username, and
15277 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
15278 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
15281 </listitem></varlistentry>
15283 <term><emphasis role="bold">le {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15284 <term><emphasis role="bold">lei {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15287 <indexterm role="concept">
15288 <primary>string</primary>
15289 <secondary>comparison</secondary>
15291 <indexterm role="concept">
15292 <primary>expansion</primary>
15293 <secondary>string comparison</secondary>
15295 <indexterm role="concept">
15296 <primary><option>le</option> expansion condition</primary>
15298 <indexterm role="concept">
15299 <primary><option>lei</option> expansion condition</primary>
15301 The two substrings are first expanded. The condition is true if the first
15302 string is lexically less than or equal to the second string. For <option>le</option> the
15303 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
15306 </listitem></varlistentry>
15308 <term><emphasis role="bold">lt {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15309 <term><emphasis role="bold">lti {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15312 <indexterm role="concept">
15313 <primary>string</primary>
15314 <secondary>comparison</secondary>
15316 <indexterm role="concept">
15317 <primary>expansion</primary>
15318 <secondary>string comparison</secondary>
15320 <indexterm role="concept">
15321 <primary><option>lt</option> expansion condition</primary>
15323 <indexterm role="concept">
15324 <primary><option>lti</option> expansion condition</primary>
15326 The two substrings are first expanded. The condition is true if the first
15327 string is lexically less than the second string. For <option>lt</option> the comparison
15328 includes the case of letters, whereas for <option>lti</option> the comparison is
15331 </listitem></varlistentry>
15333 <term><emphasis role="bold">match {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15336 <indexterm role="concept">
15337 <primary>expansion</primary>
15338 <secondary>regular expression comparison</secondary>
15340 <indexterm role="concept">
15341 <primary>regular expressions</primary>
15342 <secondary>match in expanded string</secondary>
15344 <indexterm role="concept">
15345 <primary><option>match</option> expansion condition</primary>
15347 The two substrings are first expanded. The second is then treated as a regular
15348 expression and applied to the first. Because of the pre-expansion, if the
15349 regular expression contains dollar, or backslash characters, they must be
15350 escaped. Care must also be taken if the regular expression contains braces
15351 (curly brackets). A closing brace must be escaped so that it is not taken as a
15352 premature termination of <<emphasis>string2</emphasis>>. The easiest approach is to use the
15353 <literal>\N</literal> feature to disable expansion of the regular expression.
15356 <literallayout class="monospaced">
15357 ${if match {$local_part}{\N^\d{3}\N} ...
15360 If the whole expansion string is in double quotes, further escaping of
15361 backslashes is also required.
15364 The condition is true if the regular expression match succeeds.
15365 The regular expression is not required to begin with a circumflex
15366 metacharacter, but if there is no circumflex, the expression is not anchored,
15367 and it may match anywhere in the subject, not just at the start. If you want
15368 the pattern to match at the end of the subject, you must include the <literal>$</literal>
15369 metacharacter at an appropriate point.
15372 <indexterm role="concept">
15373 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
15374 <secondary>in <option>if</option> expansion</secondary>
15376 At the start of an <option>if</option> expansion the values of the numeric variable
15377 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
15378 succeeds causes them to be reset to the substrings of that condition and they
15379 will have these values during the expansion of the success string. At the end
15380 of the <option>if</option> expansion, the previous values are restored. After testing a
15381 combination of conditions using <option>or</option>, the subsequent values of the numeric
15382 variables are those of the condition that succeeded.
15384 </listitem></varlistentry>
15386 <term><emphasis role="bold">match_address {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15389 <indexterm role="concept">
15390 <primary><option>match_address</option> expansion condition</primary>
15392 See <emphasis role="bold">match_local_part</emphasis>.
15394 </listitem></varlistentry>
15396 <term><emphasis role="bold">match_domain {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15399 <indexterm role="concept">
15400 <primary><option>match_domain</option> expansion condition</primary>
15402 See <emphasis role="bold">match_local_part</emphasis>.
15404 </listitem></varlistentry>
15406 <term><emphasis role="bold">match_ip {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15409 <indexterm role="concept">
15410 <primary><option>match_ip</option> expansion condition</primary>
15412 This condition matches an IP address to a list of IP address patterns. It must
15413 be followed by two argument strings. The first (after expansion) must be an IP
15414 address or an empty string. The second (after expansion) is a restricted host
15415 list that can match only an IP address, not a host name. For example:
15417 <literallayout class="monospaced">
15418 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
15421 The specific types of host list item that are permitted in the list are:
15426 An IP address, optionally with a CIDR mask.
15431 A single asterisk, which matches any IP address.
15436 An empty item, which matches only if the IP address is empty. This could be
15437 useful for testing for a locally submitted message or one from specific hosts
15438 in a single test such as
15440 <literallayout class="monospaced">
15441 ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
15444 where the first item in the list is the empty string.
15449 The item @[] matches any of the local host’s interface addresses.
15454 Single-key lookups are assumed to be like <quote>net-</quote> style lookups in host lists,
15455 even if <literal>net-</literal> is not specified. There is never any attempt to turn the IP
15456 address into a host name. The most common type of linear search for
15457 <emphasis role="bold">match_ip</emphasis> is likely to be <emphasis role="bold">iplsearch</emphasis>, in which the file can contain CIDR
15458 masks. For example:
15460 <literallayout class="monospaced">
15461 ${if match_ip{$sender_host_address}{iplsearch;/some/file}...
15464 It is of course possible to use other kinds of lookup, and in such a case, you
15465 do need to specify the <literal>net-</literal> prefix if you want to specify a specific
15466 address mask, for example:
15468 <literallayout class="monospaced">
15469 ${if match_ip{$sender_host_address}{net24-dbm;/some/file}...
15472 However, unless you are combining a <option>match_ip</option> condition with others, it is
15473 just as easy to use the fact that a lookup is itself a condition, and write:
15475 <literallayout class="monospaced">
15476 ${lookup{${mask:$sender_host_address/24}}dbm{/a/file}...
15481 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
15483 </listitem></varlistentry>
15485 <term><emphasis role="bold">match_local_part {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15488 <indexterm role="concept">
15489 <primary>domain list</primary>
15490 <secondary>in expansion condition</secondary>
15492 <indexterm role="concept">
15493 <primary>address list</primary>
15494 <secondary>in expansion condition</secondary>
15496 <indexterm role="concept">
15497 <primary>local part</primary>
15498 <secondary>list, in expansion condition</secondary>
15500 <indexterm role="concept">
15501 <primary><option>match_local_part</option> expansion condition</primary>
15503 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
15504 possible to test domain, address, and local part lists within expansions. Each
15505 condition requires two arguments: an item and a list to match. A trivial
15508 <literallayout class="monospaced">
15509 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
15512 In each case, the second argument may contain any of the allowable items for a
15513 list of the appropriate type. Also, because the second argument (after
15514 expansion) is a standard form of list, it is possible to refer to a named list.
15515 Thus, you can use conditions like this:
15517 <literallayout class="monospaced">
15518 ${if match_domain{$domain}{+local_domains}{...
15521 <indexterm role="concept">
15522 <primary><literal>+caseful</literal></primary>
15524 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
15525 item can be used, as in all address lists, to cause subsequent items to
15526 have their local parts matched casefully. Domains are always matched
15530 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
15531 hosts have two identities: a name and an IP address, and it is not clear
15532 how to specify cleanly how such a test would work. However, IP addresses can be
15533 matched using <option>match_ip</option>.
15535 </listitem></varlistentry>
15537 <term><emphasis role="bold">pam {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">:...}</emphasis></term>
15540 <indexterm role="concept">
15541 <primary>PAM authentication</primary>
15543 <indexterm role="concept">
15544 <primary>AUTH</primary>
15545 <secondary>with PAM</secondary>
15547 <indexterm role="concept">
15548 <primary>Solaris</primary>
15549 <secondary>PAM support</secondary>
15551 <indexterm role="concept">
15552 <primary>expansion</primary>
15553 <secondary>PAM authentication test</secondary>
15555 <indexterm role="concept">
15556 <primary><option>pam</option> expansion condition</primary>
15558 <emphasis>Pluggable Authentication Modules</emphasis>
15559 (<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
15560 available in the latest releases of Solaris and in some GNU/Linux
15561 distributions. The Exim support, which is intended for use in conjunction with
15562 the SMTP AUTH command, is available only if Exim is compiled with
15564 <literallayout class="monospaced">
15568 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
15569 in some releases of GNU/Linux <option>-ldl</option> is also needed.
15572 The argument string is first expanded, and the result must be a
15573 colon-separated list of strings. Leading and trailing white space is ignored.
15574 The PAM module is initialized with the service name <quote>exim</quote> and the user name
15575 taken from the first item in the colon-separated data string (<<emphasis>string1</emphasis>>).
15576 The remaining items in the data string are passed over in response to requests
15577 from the authentication function. In the simple case there will only be one
15578 request, for a password, so the data consists of just two strings.
15581 There can be problems if any of the strings are permitted to contain colon
15582 characters. In the usual way, these have to be doubled to avoid being taken as
15583 separators. If the data is being inserted from a variable, the <option>sg</option> expansion
15584 item can be used to double any existing colons. For example, the configuration
15585 of a LOGIN authenticator might contain this setting:
15587 <literallayout class="monospaced">
15588 server_condition = ${if pam{$auth1:${sg{$auth2}{:}{::}}}}
15591 For a PLAIN authenticator you could use:
15593 <literallayout class="monospaced">
15594 server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}}
15597 In some operating systems, PAM authentication can be done only from a process
15598 running as root. Since Exim is running as the Exim user when receiving
15599 messages, this means that PAM cannot be used directly in those systems.
15600 A patched version of the <emphasis>pam_unix</emphasis> module that comes with the
15601 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>.
15602 The patched module allows one special uid/gid combination, in addition to root,
15603 to authenticate. If you build the patched module to allow the Exim user and
15604 group, PAM can then be used from an Exim authenticator.
15606 </listitem></varlistentry>
15608 <term><emphasis role="bold">pwcheck {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15611 <indexterm role="concept">
15612 <primary><emphasis>pwcheck</emphasis> daemon</primary>
15614 <indexterm role="concept">
15615 <primary>Cyrus</primary>
15617 <indexterm role="concept">
15618 <primary>expansion</primary>
15619 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
15621 <indexterm role="concept">
15622 <primary><option>pwcheck</option> expansion condition</primary>
15624 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
15625 This is one way of making it possible for passwords to be checked by a process
15626 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
15627 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
15630 The pwcheck support is not included in Exim by default. You need to specify
15631 the location of the pwcheck daemon’s socket in <filename>Local/Makefile</filename> before
15632 building Exim. For example:
15634 <literallayout class="monospaced">
15635 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
15638 You do not need to install the full Cyrus software suite in order to use
15639 the pwcheck daemon. You can compile and install just the daemon alone
15640 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
15641 access to the <filename>/var/pwcheck</filename> directory.
15644 The <option>pwcheck</option> condition takes one argument, which must be the user name and
15645 password, separated by a colon. For example, in a LOGIN authenticator
15646 configuration, you might have this:
15648 <literallayout class="monospaced">
15649 server_condition = ${if pwcheck{$auth1:$auth2}}
15652 Again, for a PLAIN authenticator configuration, this would be:
15654 <literallayout class="monospaced">
15655 server_condition = ${if pwcheck{$auth2:$auth3}}
15657 </listitem></varlistentry>
15659 <term><emphasis role="bold">queue_running</emphasis></term>
15662 <indexterm role="concept">
15663 <primary>queue runner</primary>
15664 <secondary>detecting when delivering from</secondary>
15666 <indexterm role="concept">
15667 <primary>expansion</primary>
15668 <secondary>queue runner test</secondary>
15670 <indexterm role="concept">
15671 <primary><option>queue_running</option> expansion condition</primary>
15673 This condition, which has no data, is true during delivery attempts that are
15674 initiated by queue runner processes, and false otherwise.
15676 </listitem></varlistentry>
15678 <term><emphasis role="bold">radius {</emphasis><<emphasis>authentication string</emphasis>><emphasis role="bold">}</emphasis></term>
15681 <indexterm role="concept">
15682 <primary>Radius</primary>
15684 <indexterm role="concept">
15685 <primary>expansion</primary>
15686 <secondary>Radius authentication</secondary>
15688 <indexterm role="concept">
15689 <primary><option>radius</option> expansion condition</primary>
15691 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
15692 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
15693 the Radius client configuration file in order to build Exim with Radius
15697 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
15698 library, using the original API. If you are using release 0.4.0 or later of
15699 this library, you need to set
15701 <literallayout class="monospaced">
15702 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
15705 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
15706 <option>libradius</option> library that comes with FreeBSD. To do this, set
15708 <literallayout class="monospaced">
15709 RADIUS_LIB_TYPE=RADLIB
15712 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
15713 You may also have to supply a suitable setting in EXTRALIBS so that the
15714 Radius library can be found when Exim is linked.
15717 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
15718 Radius client library, which calls the Radius server. The condition is true if
15719 the authentication is successful. For example:
15721 <literallayout class="monospaced">
15722 server_condition = ${if radius{<arguments>}}
15724 </listitem></varlistentry>
15726 <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>
15729 <indexterm role="concept">
15730 <primary><emphasis>saslauthd</emphasis> daemon</primary>
15732 <indexterm role="concept">
15733 <primary>Cyrus</primary>
15735 <indexterm role="concept">
15736 <primary>expansion</primary>
15737 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
15739 <indexterm role="concept">
15740 <primary><option>saslauthd</option> expansion condition</primary>
15742 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
15743 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
15744 Using this daemon is one way of making it possible for passwords to be checked
15745 by a process that is not running as root.
15748 The saslauthd support is not included in Exim by default. You need to specify
15749 the location of the saslauthd daemon’s socket in <filename>Local/Makefile</filename> before
15750 building Exim. For example:
15752 <literallayout class="monospaced">
15753 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
15756 You do not need to install the full Cyrus software suite in order to use
15757 the saslauthd daemon. You can compile and install just the daemon alone
15758 from the Cyrus SASL library.
15761 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
15762 two are mandatory. For example:
15764 <literallayout class="monospaced">
15765 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
15768 The service and the realm are optional (which is why the arguments are enclosed
15769 in their own set of braces). For details of the meaning of the service and
15770 realm, and how to run the daemon, consult the Cyrus documentation.
15772 </listitem></varlistentry>
15775 <section id="SECID84">
15776 <title>Combining expansion conditions</title>
15778 <indexterm role="concept">
15779 <primary>expansion</primary>
15780 <secondary>combining conditions</secondary>
15782 Several conditions can be tested at once by combining them using the <option>and</option>
15783 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
15784 conditions on their own, and precede their lists of sub-conditions. Each
15785 sub-condition must be enclosed in braces within the overall braces that contain
15786 the list. No repetition of <option>if</option> is used.
15790 <term><emphasis role="bold">or {{</emphasis><<emphasis>cond1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>cond2</emphasis>><emphasis role="bold">}...}</emphasis></term>
15793 <indexterm role="concept">
15794 <primary><quote>or</quote> expansion condition</primary>
15796 <indexterm role="concept">
15797 <primary>expansion</primary>
15798 <secondary><quote>or</quote> of conditions</secondary>
15800 The sub-conditions are evaluated from left to right. The condition is true if
15801 any one of the sub-conditions is true.
15804 <literallayout class="monospaced">
15805 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
15808 When a true sub-condition is found, the following ones are parsed but not
15809 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
15810 numeric variables afterwards are taken from the first one that succeeds.
15812 </listitem></varlistentry>
15814 <term><emphasis role="bold">and {{</emphasis><<emphasis>cond1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>cond2</emphasis>><emphasis role="bold">}...}</emphasis></term>
15817 <indexterm role="concept">
15818 <primary><quote>and</quote> expansion condition</primary>
15820 <indexterm role="concept">
15821 <primary>expansion</primary>
15822 <secondary><quote>and</quote> of conditions</secondary>
15824 The sub-conditions are evaluated from left to right. The condition is true if
15825 all of the sub-conditions are true. If there are several <quote>match</quote>
15826 sub-conditions, the values of the numeric variables afterwards are taken from
15827 the last one. When a false sub-condition is found, the following ones are
15828 parsed but not evaluated.
15830 </listitem></varlistentry>
15833 <indexterm role="concept" startref="IIDexpcond" class="endofrange"/>
15836 <section id="SECTexpvar">
15837 <title>Expansion variables</title>
15839 <indexterm role="concept">
15840 <primary>expansion</primary>
15841 <secondary>variables, list of</secondary>
15843 This section contains an alphabetical list of all the expansion variables. Some
15844 of them are available only when Exim is compiled with specific options such as
15845 support for TLS or the content scanning extension.
15849 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
15852 <indexterm role="concept">
15853 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
15855 When a <option>match</option> expansion condition succeeds, these variables contain the
15856 captured substrings identified by the regular expression during subsequent
15857 processing of the success string of the containing <option>if</option> expansion item.
15858 However, they do not retain their values afterwards; in fact, their previous
15859 values are restored at the end of processing an <option>if</option> item. The numerical
15860 variables may also be set externally by some other matching process which
15861 precedes the expansion of the string. For example, the commands available in
15862 Exim filter files include an <option>if</option> command with its own regular expression
15863 matching condition.
15865 </listitem></varlistentry>
15867 <term><varname>$acl_c...</varname></term>
15870 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
15871 can be given any name that starts with <varname>$acl_c</varname> and is at least six characters
15872 long, but the sixth character must be either a digit or an underscore. For
15873 example: <varname>$acl_c5</varname>, <varname>$acl_c_mycount</varname>. The values of the <varname>$acl_c...</varname>
15874 variables persist throughout the lifetime of an SMTP connection. They can be
15875 used to pass information between ACLs and between different invocations of the
15876 same ACL. When a message is received, the values of these variables are saved
15877 with the message, and can be accessed by filters, routers, and transports
15878 during subsequent delivery.
15880 </listitem></varlistentry>
15882 <term><varname>$acl_m...</varname></term>
15885 These variables are like the <varname>$acl_c...</varname> variables, except that their values
15886 are reset after a message has been received. Thus, if several messages are
15887 received in one SMTP connection, <varname>$acl_m...</varname> values are not passed on from one
15888 message to the next, as <varname>$acl_c...</varname> values are. The <varname>$acl_m...</varname> variables are
15889 also reset by MAIL, RSET, EHLO, HELO, and after starting a TLS session. When a
15890 message is received, the values of these variables are saved with the message,
15891 and can be accessed by filters, routers, and transports during subsequent
15894 </listitem></varlistentry>
15896 <term><varname>$acl_verify_message</varname></term>
15899 <indexterm role="variable">
15900 <primary><varname>$acl_verify_message</varname></primary>
15902 After an address verification has failed, this variable contains the failure
15903 message. It retains its value for use in subsequent modifiers. The message can
15904 be preserved by coding like this:
15906 <literallayout class="monospaced">
15907 warn !verify = sender
15908 set acl_m0 = $acl_verify_message
15911 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
15912 <option>log_message</option> modifiers, to include information about the verification
15915 </listitem></varlistentry>
15917 <term><varname>$address_data</varname></term>
15920 <indexterm role="variable">
15921 <primary><varname>$address_data</varname></primary>
15923 This variable is set by means of the <option>address_data</option> option in routers. The
15924 value then remains with the address while it is processed by subsequent routers
15925 and eventually a transport. If the transport is handling multiple addresses,
15926 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
15927 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
15931 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
15932 a recipient address, the final value is still in the variable for subsequent
15933 conditions and modifiers of the ACL statement. If routing the address caused it
15934 to be redirected to just one address, the child address is also routed as part
15935 of the verification, and in this case the final value of <varname>$address_data</varname> is
15936 from the child’s routing.
15939 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
15940 sender address, the final value is also preserved, but this time in
15941 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
15945 In both cases (recipient and sender verification), the value does not persist
15946 after the end of the current ACL statement. If you want to preserve
15947 these values for longer, you can save them in ACL variables.
15949 </listitem></varlistentry>
15951 <term><varname>$address_file</varname></term>
15954 <indexterm role="variable">
15955 <primary><varname>$address_file</varname></primary>
15957 When, as a result of aliasing, forwarding, or filtering, a message is directed
15958 to a specific file, this variable holds the name of the file when the transport
15959 is running. At other times, the variable is empty. For example, using the
15960 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
15962 <literallayout class="monospaced">
15963 /home/r2d2/savemail
15966 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
15967 contains the text string <literal>/home/r2d2/savemail</literal>.
15968 <indexterm role="concept">
15969 <primary>Sieve filter</primary>
15970 <secondary>value of <varname>$address_file</varname></secondary>
15972 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
15973 then up to the transport configuration to generate an appropriate absolute path
15974 to the relevant file.
15976 </listitem></varlistentry>
15978 <term><varname>$address_pipe</varname></term>
15981 <indexterm role="variable">
15982 <primary><varname>$address_pipe</varname></primary>
15984 When, as a result of aliasing or forwarding, a message is directed to a pipe,
15985 this variable holds the pipe command when the transport is running.
15987 </listitem></varlistentry>
15989 <term><varname>$auth1</varname> – <varname>$auth3</varname></term>
15992 <indexterm role="variable">
15993 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
15995 These variables are used in SMTP authenticators (see chapters
15996 <xref linkend="CHAPplaintext"/>–<xref linkend="CHAPspa"/>). Elsewhere, they are empty.
15998 </listitem></varlistentry>
16000 <term><varname>$authenticated_id</varname></term>
16003 <indexterm role="concept">
16004 <primary>authentication</primary>
16005 <secondary>id</secondary>
16007 <indexterm role="variable">
16008 <primary><varname>$authenticated_id</varname></primary>
16010 When a server successfully authenticates a client it may be configured to
16011 preserve some of the authentication information in the variable
16012 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
16013 user/password authenticator configuration might preserve the user name for use
16014 in the routers. Note that this is not the same information that is saved in
16015 <varname>$sender_host_authenticated</varname>.
16016 When a message is submitted locally (that is, not over a TCP connection)
16017 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
16018 process. However, a trusted user can override this by means of the <option>-oMai</option>
16019 command line option.
16021 </listitem></varlistentry>
16023 <term><varname>$authenticated_sender</varname></term>
16026 <indexterm role="concept">
16027 <primary>sender</primary>
16028 <secondary>authenticated</secondary>
16030 <indexterm role="concept">
16031 <primary>authentication</primary>
16032 <secondary>sender</secondary>
16034 <indexterm role="concept">
16035 <primary>AUTH</primary>
16036 <secondary>on MAIL command</secondary>
16038 <indexterm role="variable">
16039 <primary><varname>$authenticated_sender</varname></primary>
16041 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
16042 SMTP MAIL command if it believes the sender is sufficiently trusted, as
16043 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
16044 <quote><></quote>, it is set as the authenticated sender of the message, and the value is
16045 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
16046 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
16049 <indexterm role="variable">
16050 <primary><varname>$qualify_domain</varname></primary>
16052 When a message is submitted locally (that is, not over a TCP connection), the
16053 value of <varname>$authenticated_sender</varname> is an address constructed from the login
16054 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
16055 can override this by means of the <option>-oMas</option> command line option.
16057 </listitem></varlistentry>
16059 <term><varname>$authentication_failed</varname></term>
16062 <indexterm role="concept">
16063 <primary>authentication</primary>
16064 <secondary>failure</secondary>
16066 <indexterm role="variable">
16067 <primary><varname>$authentication_failed</varname></primary>
16069 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
16070 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
16071 possible to distinguish between <quote>did not try to authenticate</quote>
16072 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
16073 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
16074 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>). Failure includes any
16075 negative response to an AUTH command, including (for example) an attempt to use
16076 an undefined mechanism.
16078 </listitem></varlistentry>
16080 <term><varname>$body_linecount</varname></term>
16083 <indexterm role="concept">
16084 <primary>message body</primary>
16085 <secondary>line count</secondary>
16087 <indexterm role="concept">
16088 <primary>body of message</primary>
16089 <secondary>line count</secondary>
16091 <indexterm role="variable">
16092 <primary><varname>$body_linecount</varname></primary>
16094 When a message is being received or delivered, this variable contains the
16095 number of lines in the message’s body. See also <varname>$message_linecount</varname>.
16097 </listitem></varlistentry>
16099 <term><varname>$body_zerocount</varname></term>
16102 <indexterm role="concept">
16103 <primary>message body</primary>
16104 <secondary>binary zero count</secondary>
16106 <indexterm role="concept">
16107 <primary>body of message</primary>
16108 <secondary>binary zero count</secondary>
16110 <indexterm role="concept">
16111 <primary>binary zero</primary>
16112 <secondary>in message body</secondary>
16114 <indexterm role="variable">
16115 <primary><varname>$body_zerocount</varname></primary>
16117 When a message is being received or delivered, this variable contains the
16118 number of binary zero bytes in the message’s body.
16120 </listitem></varlistentry>
16122 <term><varname>$bounce_recipient</varname></term>
16125 <indexterm role="variable">
16126 <primary><varname>$bounce_recipient</varname></primary>
16128 This is set to the recipient address of a bounce message while Exim is creating
16129 it. It is useful if a customized bounce message text file is in use (see
16130 chapter <xref linkend="CHAPemsgcust"/>).
16132 </listitem></varlistentry>
16134 <term><varname>$bounce_return_size_limit</varname></term>
16137 <indexterm role="variable">
16138 <primary><varname>$bounce_return_size_limit</varname></primary>
16140 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
16141 up to a multiple of 1000. It is useful when a customized error message text
16142 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
16144 </listitem></varlistentry>
16146 <term><varname>$caller_gid</varname></term>
16149 <indexterm role="concept">
16150 <primary>gid (group id)</primary>
16151 <secondary>caller</secondary>
16153 <indexterm role="variable">
16154 <primary><varname>$caller_gid</varname></primary>
16156 The real group id under which the process that called Exim was running. This is
16157 not the same as the group id of the originator of a message (see
16158 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
16159 incarnation normally contains the Exim gid.
16161 </listitem></varlistentry>
16163 <term><varname>$caller_uid</varname></term>
16166 <indexterm role="concept">
16167 <primary>uid (user id)</primary>
16168 <secondary>caller</secondary>
16170 <indexterm role="variable">
16171 <primary><varname>$caller_uid</varname></primary>
16173 The real user id under which the process that called Exim was running. This is
16174 not the same as the user id of the originator of a message (see
16175 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
16176 incarnation normally contains the Exim uid.
16178 </listitem></varlistentry>
16180 <term><varname>$compile_date</varname></term>
16183 <indexterm role="variable">
16184 <primary><varname>$compile_date</varname></primary>
16186 The date on which the Exim binary was compiled.
16188 </listitem></varlistentry>
16190 <term><varname>$compile_number</varname></term>
16193 <indexterm role="variable">
16194 <primary><varname>$compile_number</varname></primary>
16196 The building process for Exim keeps a count of the number
16197 of times it has been compiled. This serves to distinguish different
16198 compilations of the same version of the program.
16200 </listitem></varlistentry>
16202 <term><varname>$demime_errorlevel</varname></term>
16205 <indexterm role="variable">
16206 <primary><varname>$demime_errorlevel</varname></primary>
16208 This variable is available when Exim is compiled with
16209 the content-scanning extension and the obsolete <option>demime</option> condition. For
16210 details, see section <xref linkend="SECTdemimecond"/>.
16212 </listitem></varlistentry>
16214 <term><varname>$demime_reason</varname></term>
16217 <indexterm role="variable">
16218 <primary><varname>$demime_reason</varname></primary>
16220 This variable is available when Exim is compiled with the
16221 content-scanning extension and the obsolete <option>demime</option> condition. For details,
16222 see section <xref linkend="SECTdemimecond"/>.
16224 </listitem></varlistentry>
16226 <term><varname>$dnslist_domain</varname></term>
16227 <term><varname>$dnslist_matched</varname></term>
16228 <term><varname>$dnslist_text</varname></term>
16229 <term><varname>$dnslist_value</varname></term>
16232 <indexterm role="variable">
16233 <primary><varname>$dnslist_domain</varname></primary>
16235 <indexterm role="variable">
16236 <primary><varname>$dnslist_matched</varname></primary>
16238 <indexterm role="variable">
16239 <primary><varname>$dnslist_text</varname></primary>
16241 <indexterm role="variable">
16242 <primary><varname>$dnslist_value</varname></primary>
16244 <indexterm role="concept">
16245 <primary>black list (DNS)</primary>
16247 When a DNS (black) list lookup succeeds, these variables are set to contain
16248 the following data from the lookup: the list’s domain name, the key that was
16249 looked up, the contents of any associated TXT record, and the value from the
16250 main A record. See section <xref linkend="SECID204"/> for more details.
16252 </listitem></varlistentry>
16254 <term><varname>$domain</varname></term>
16257 <indexterm role="variable">
16258 <primary><varname>$domain</varname></primary>
16260 When an address is being routed, or delivered on its own, this variable
16261 contains the domain. Uppercase letters in the domain are converted into lower
16262 case for <varname>$domain</varname>.
16265 Global address rewriting happens when a message is received, so the value of
16266 <varname>$domain</varname> during routing and delivery is the value after rewriting. <varname>$domain</varname>
16267 is set during user filtering, but not during system filtering, because a
16268 message may have many recipients and the system filter is called just once.
16271 When more than one address is being delivered at once (for example, several
16272 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
16273 have the same domain. Transports can be restricted to handling only one domain
16274 at a time if the value of <varname>$domain</varname> is required at transport time – this is
16275 the default for local transports. For further details of the environment in
16276 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
16279 <indexterm role="option">
16280 <primary><option>delay_warning_condition</option></primary>
16282 At the end of a delivery, if all deferred addresses have the same domain, it is
16283 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
16286 The <varname>$domain</varname> variable is also used in some other circumstances:
16291 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
16292 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
16293 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
16294 normally set during the running of the MAIL ACL. However, if the sender address
16295 is verified with a callout during the MAIL ACL, the sender domain is placed in
16296 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
16297 the <command>smtp</command> transport.
16302 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
16303 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
16304 it can be used in the expansion of the replacement address, for example, to
16305 rewrite domains by file lookup.
16310 With one important exception, whenever a domain list is being scanned,
16311 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
16312 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
16313 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
16314 that, in a RCPT ACL, the sender domain list can be dependent on the
16315 recipient domain (which is what is in <varname>$domain</varname> at this time).
16320 <indexterm role="concept">
16321 <primary>ETRN</primary>
16322 <secondary>value of <varname>$domain</varname></secondary>
16324 <indexterm role="option">
16325 <primary><option>smtp_etrn_command</option></primary>
16327 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
16328 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
16332 </listitem></varlistentry>
16334 <term><varname>$domain_data</varname></term>
16337 <indexterm role="variable">
16338 <primary><varname>$domain_data</varname></primary>
16340 When the <option>domains</option> option on a router matches a domain by
16341 means of a lookup, the data read by the lookup is available during the running
16342 of the router as <varname>$domain_data</varname>. In addition, if the driver routes the
16343 address to a transport, the value is available in that transport. If the
16344 transport is handling multiple addresses, the value from the first address is
16348 <varname>$domain_data</varname> is also set when the <option>domains</option> condition in an ACL matches a
16349 domain by means of a lookup. The data read by the lookup is available during
16350 the rest of the ACL statement. In all other situations, this variable expands
16353 </listitem></varlistentry>
16355 <term><varname>$exim_gid</varname></term>
16358 <indexterm role="variable">
16359 <primary><varname>$exim_gid</varname></primary>
16361 This variable contains the numerical value of the Exim group id.
16363 </listitem></varlistentry>
16365 <term><varname>$exim_path</varname></term>
16368 <indexterm role="variable">
16369 <primary><varname>$exim_path</varname></primary>
16371 This variable contains the path to the Exim binary.
16373 </listitem></varlistentry>
16375 <term><varname>$exim_uid</varname></term>
16378 <indexterm role="variable">
16379 <primary><varname>$exim_uid</varname></primary>
16381 This variable contains the numerical value of the Exim user id.
16383 </listitem></varlistentry>
16385 <term><varname>$found_extension</varname></term>
16388 <indexterm role="variable">
16389 <primary><varname>$found_extension</varname></primary>
16391 This variable is available when Exim is compiled with the
16392 content-scanning extension and the obsolete <option>demime</option> condition. For details,
16393 see section <xref linkend="SECTdemimecond"/>.
16395 </listitem></varlistentry>
16397 <term><varname>$header_</varname><<emphasis>name</emphasis>></term>
16400 This is not strictly an expansion variable. It is expansion syntax for
16401 inserting the message header line with the given name. Note that the name must
16402 be terminated by colon or white space, because it may contain a wide variety of
16403 characters. Note also that braces must <emphasis>not</emphasis> be used.
16405 </listitem></varlistentry>
16407 <term><varname>$home</varname></term>
16410 <indexterm role="variable">
16411 <primary><varname>$home</varname></primary>
16413 When the <option>check_local_user</option> option is set for a router, the user’s home
16414 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
16415 means it is set during the running of users’ filter files. A router may also
16416 explicitly set a home directory for use by a transport; this can be overridden
16417 by a setting on the transport itself.
16420 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
16421 of the environment variable HOME.
16423 </listitem></varlistentry>
16425 <term><varname>$host</varname></term>
16428 <indexterm role="variable">
16429 <primary><varname>$host</varname></primary>
16431 If a router assigns an address to a transport (any transport), and passes a
16432 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
16433 to run is the name of the first host on the list. Note that this applies both
16434 to local and remote transports.
16437 <indexterm role="concept">
16438 <primary>transport</primary>
16439 <secondary>filter</secondary>
16441 <indexterm role="concept">
16442 <primary>filter</primary>
16443 <secondary>transport filter</secondary>
16445 For the <command>smtp</command> transport, if there is more than one host, the value of
16446 <varname>$host</varname> changes as the transport works its way through the list. In
16447 particular, when the <command>smtp</command> transport is expanding its options for encryption
16448 using TLS, or for specifying a transport filter (see chapter
16449 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
16453 When used in the client part of an authenticator configuration (see chapter
16454 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
16455 client is connected.
16457 </listitem></varlistentry>
16459 <term><varname>$host_address</varname></term>
16462 <indexterm role="variable">
16463 <primary><varname>$host_address</varname></primary>
16465 This variable is set to the remote host’s IP address whenever <varname>$host</varname> is set
16466 for a remote connection. It is also set to the IP address that is being checked
16467 when the <option>ignore_target_hosts</option> option is being processed.
16469 </listitem></varlistentry>
16471 <term><varname>$host_data</varname></term>
16474 <indexterm role="variable">
16475 <primary><varname>$host_data</varname></primary>
16477 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
16478 result of the lookup is made available in the <varname>$host_data</varname> variable. This
16479 allows you, for example, to do things like this:
16481 <literallayout class="monospaced">
16482 deny hosts = net-lsearch;/some/file
16483 message = $host_data
16485 </listitem></varlistentry>
16487 <term><varname>$host_lookup_deferred</varname></term>
16490 <indexterm role="concept">
16491 <primary>host name</primary>
16492 <secondary>lookup, failure of</secondary>
16494 <indexterm role="variable">
16495 <primary><varname>$host_lookup_deferred</varname></primary>
16497 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
16498 message comes from a remote host and there is an attempt to look up the host’s
16499 name from its IP address, and the attempt is not successful, one of these
16500 variables is set to <quote>1</quote>.
16505 If the lookup receives a definite negative response (for example, a DNS lookup
16506 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
16511 If there is any kind of problem during the lookup, such that Exim cannot
16512 tell whether or not the host name is defined (for example, a timeout for a DNS
16513 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
16518 Looking up a host’s name from its IP address consists of more than just a
16519 single reverse lookup. Exim checks that a forward lookup of at least one of the
16520 names it receives from a reverse lookup yields the original IP address. If this
16521 is not the case, Exim does not accept the looked up name(s), and
16522 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
16523 IP address (for example, the existence of a PTR record in the DNS) is not
16524 sufficient on its own for the success of a host name lookup. If the reverse
16525 lookup succeeds, but there is a lookup problem such as a timeout when checking
16526 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
16527 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
16529 </listitem></varlistentry>
16531 <term><varname>$host_lookup_failed</varname></term>
16534 <indexterm role="variable">
16535 <primary><varname>$host_lookup_failed</varname></primary>
16537 See <varname>$host_lookup_deferred</varname>.
16539 </listitem></varlistentry>
16541 <term><varname>$inode</varname></term>
16544 <indexterm role="variable">
16545 <primary><varname>$inode</varname></primary>
16547 The only time this variable is set is while expanding the <option>directory_file</option>
16548 option in the <command>appendfile</command> transport. The variable contains the inode number
16549 of the temporary file which is about to be renamed. It can be used to construct
16550 a unique name for the file.
16552 </listitem></varlistentry>
16554 <term><varname>$interface_address</varname></term>
16557 <indexterm role="variable">
16558 <primary><varname>$interface_address</varname></primary>
16560 This is an obsolete name for <varname>$received_ip_address</varname>.
16562 </listitem></varlistentry>
16564 <term><varname>$interface_port</varname></term>
16567 <indexterm role="variable">
16568 <primary><varname>$interface_port</varname></primary>
16570 This is an obsolete name for <varname>$received_port</varname>.
16572 </listitem></varlistentry>
16574 <term><varname>$item</varname></term>
16577 <indexterm role="variable">
16578 <primary><varname>$item</varname></primary>
16580 This variable is used during the expansion of <emphasis role="bold">forall</emphasis> and <emphasis role="bold">forany</emphasis>
16581 conditions (see section <xref linkend="SECTexpcond"/>), and <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and
16582 <emphasis role="bold">reduce</emphasis> items (see section <xref linkend="SECTexpcond"/>). In other circumstances, it is
16585 </listitem></varlistentry>
16587 <term><varname>$ldap_dn</varname></term>
16590 <indexterm role="variable">
16591 <primary><varname>$ldap_dn</varname></primary>
16593 This variable, which is available only when Exim is compiled with LDAP support,
16594 contains the DN from the last entry in the most recently successful LDAP
16597 </listitem></varlistentry>
16599 <term><varname>$load_average</varname></term>
16602 <indexterm role="variable">
16603 <primary><varname>$load_average</varname></primary>
16605 This variable contains the system load average, multiplied by 1000 so that it
16606 is an integer. For example, if the load average is 0.21, the value of the
16607 variable is 210. The value is recomputed every time the variable is referenced.
16609 </listitem></varlistentry>
16611 <term><varname>$local_part</varname></term>
16614 <indexterm role="variable">
16615 <primary><varname>$local_part</varname></primary>
16617 When an address is being routed, or delivered on its own, this
16618 variable contains the local part. When a number of addresses are being
16619 delivered together (for example, multiple RCPT commands in an SMTP
16620 session), <varname>$local_part</varname> is not set.
16623 Global address rewriting happens when a message is received, so the value of
16624 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
16625 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
16626 because a message may have many recipients and the system filter is called just
16630 <indexterm role="variable">
16631 <primary><varname>$local_part_prefix</varname></primary>
16633 <indexterm role="variable">
16634 <primary><varname>$local_part_suffix</varname></primary>
16636 If a local part prefix or suffix has been recognized, it is not included in the
16637 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
16638 any prefix or suffix are in <varname>$local_part_prefix</varname> and
16639 <varname>$local_part_suffix</varname>, respectively.
16642 When a message is being delivered to a file, pipe, or autoreply transport as a
16643 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
16644 the parent address, not to the file name or command (see <varname>$address_file</varname> and
16645 <varname>$address_pipe</varname>).
16648 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
16649 local part of the recipient address.
16652 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
16653 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
16654 it can be used in the expansion of the replacement address, for example.
16657 In all cases, all quoting is removed from the local part. For example, for both
16660 <literallayout class="monospaced">
16661 "abc:xyz"@test.example
16662 abc\:xyz@test.example
16665 the value of <varname>$local_part</varname> is
16667 <literallayout class="monospaced">
16671 If you use <varname>$local_part</varname> to create another address, you should always wrap it
16672 inside a quoting operator. For example, in a <command>redirect</command> router you could
16675 <literallayout class="monospaced">
16676 data = ${quote_local_part:$local_part}@new.domain.example
16679 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
16680 to process local parts in a case-dependent manner in a router, you can set the
16681 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
16683 </listitem></varlistentry>
16685 <term><varname>$local_part_data</varname></term>
16688 <indexterm role="variable">
16689 <primary><varname>$local_part_data</varname></primary>
16691 When the <option>local_parts</option> option on a router matches a local part by means of a
16692 lookup, the data read by the lookup is available during the running of the
16693 router as <varname>$local_part_data</varname>. In addition, if the driver routes the address
16694 to a transport, the value is available in that transport. If the transport is
16695 handling multiple addresses, the value from the first address is used.
16698 <varname>$local_part_data</varname> is also set when the <option>local_parts</option> condition in an ACL
16699 matches a local part by means of a lookup. The data read by the lookup is
16700 available during the rest of the ACL statement. In all other situations, this
16701 variable expands to nothing.
16703 </listitem></varlistentry>
16705 <term><varname>$local_part_prefix</varname></term>
16708 <indexterm role="variable">
16709 <primary><varname>$local_part_prefix</varname></primary>
16711 When an address is being routed or delivered, and a
16712 specific prefix for the local part was recognized, it is available in this
16713 variable, having been removed from <varname>$local_part</varname>.
16715 </listitem></varlistentry>
16717 <term><varname>$local_part_suffix</varname></term>
16720 <indexterm role="variable">
16721 <primary><varname>$local_part_suffix</varname></primary>
16723 When an address is being routed or delivered, and a
16724 specific suffix for the local part was recognized, it is available in this
16725 variable, having been removed from <varname>$local_part</varname>.
16727 </listitem></varlistentry>
16729 <term><varname>$local_scan_data</varname></term>
16732 <indexterm role="variable">
16733 <primary><varname>$local_scan_data</varname></primary>
16735 This variable contains the text returned by the <function>local_scan()</function> function when
16736 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
16738 </listitem></varlistentry>
16740 <term><varname>$local_user_gid</varname></term>
16743 <indexterm role="variable">
16744 <primary><varname>$local_user_gid</varname></primary>
16746 See <varname>$local_user_uid</varname>.
16748 </listitem></varlistentry>
16750 <term><varname>$local_user_uid</varname></term>
16753 <indexterm role="variable">
16754 <primary><varname>$local_user_uid</varname></primary>
16756 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
16757 <option>check_local_user</option> router precondition succeeds. This means that their values
16758 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
16759 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
16760 router-specific expansions. At all other times, the values in these variables
16761 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
16763 </listitem></varlistentry>
16765 <term><varname>$localhost_number</varname></term>
16768 <indexterm role="variable">
16769 <primary><varname>$localhost_number</varname></primary>
16771 This contains the expanded value of the
16772 <option>localhost_number</option> option. The expansion happens after the main options have
16775 </listitem></varlistentry>
16777 <term><varname>$log_inodes</varname></term>
16780 <indexterm role="variable">
16781 <primary><varname>$log_inodes</varname></primary>
16783 The number of free inodes in the disk partition where Exim’s
16784 log files are being written. The value is recalculated whenever the variable is
16785 referenced. If the relevant file system does not have the concept of inodes,
16786 the value of is -1. See also the <option>check_log_inodes</option> option.
16788 </listitem></varlistentry>
16790 <term><varname>$log_space</varname></term>
16793 <indexterm role="variable">
16794 <primary><varname>$log_space</varname></primary>
16796 The amount of free space (as a number of kilobytes) in the disk
16797 partition where Exim’s log files are being written. The value is recalculated
16798 whenever the variable is referenced. If the operating system does not have the
16799 ability to find the amount of free space (only true for experimental systems),
16800 the space value is -1. See also the <option>check_log_space</option> option.
16802 </listitem></varlistentry>
16804 <term><varname>$mailstore_basename</varname></term>
16807 <indexterm role="variable">
16808 <primary><varname>$mailstore_basename</varname></primary>
16810 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
16811 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
16812 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
16813 contains the basename of the files that are being written, that is, the name
16814 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
16817 </listitem></varlistentry>
16819 <term><varname>$malware_name</varname></term>
16822 <indexterm role="variable">
16823 <primary><varname>$malware_name</varname></primary>
16825 This variable is available when Exim is compiled with the
16826 content-scanning extension. It is set to the name of the virus that was found
16827 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
16829 </listitem></varlistentry>
16831 <term><varname>$max_received_linelength</varname></term>
16834 <indexterm role="variable">
16835 <primary><varname>$max_received_linelength</varname></primary>
16837 <indexterm role="concept">
16838 <primary>maximum</primary>
16839 <secondary>line length</secondary>
16841 <indexterm role="concept">
16842 <primary>line length</primary>
16843 <secondary>maximum</secondary>
16845 This variable contains the number of bytes in the longest line that was
16846 received as part of the message, not counting the line termination
16849 </listitem></varlistentry>
16851 <term><varname>$message_age</varname></term>
16854 <indexterm role="concept">
16855 <primary>message</primary>
16856 <secondary>age of</secondary>
16858 <indexterm role="variable">
16859 <primary><varname>$message_age</varname></primary>
16861 This variable is set at the start of a delivery attempt to contain the number
16862 of seconds since the message was received. It does not change during a single
16865 </listitem></varlistentry>
16867 <term><varname>$message_body</varname></term>
16870 <indexterm role="concept">
16871 <primary>body of message</primary>
16872 <secondary>expansion variable</secondary>
16874 <indexterm role="concept">
16875 <primary>message body</primary>
16876 <secondary>in expansion</secondary>
16878 <indexterm role="concept">
16879 <primary>binary zero</primary>
16880 <secondary>in message body</secondary>
16882 <indexterm role="variable">
16883 <primary><varname>$message_body</varname></primary>
16885 <indexterm role="option">
16886 <primary><option>message_body_visible</option></primary>
16888 This variable contains the initial portion of a message’s body while it is
16889 being delivered, and is intended mainly for use in filter files. The maximum
16890 number of characters of the body that are put into the variable is set by the
16891 <option>message_body_visible</option> configuration option; the default is 500.
16894 <indexterm role="option">
16895 <primary><option>message_body_newlines</option></primary>
16897 By default, newlines are converted into spaces in <varname>$message_body</varname>, to make it
16898 easier to search for phrases that might be split over a line break. However,
16899 this can be disabled by setting <option>message_body_newlines</option> to be true. Binary
16900 zeros are always converted into spaces.
16902 </listitem></varlistentry>
16904 <term><varname>$message_body_end</varname></term>
16907 <indexterm role="concept">
16908 <primary>body of message</primary>
16909 <secondary>expansion variable</secondary>
16911 <indexterm role="concept">
16912 <primary>message body</primary>
16913 <secondary>in expansion</secondary>
16915 <indexterm role="variable">
16916 <primary><varname>$message_body_end</varname></primary>
16918 This variable contains the final portion of a message’s
16919 body while it is being delivered. The format and maximum size are as for
16920 <varname>$message_body</varname>.
16922 </listitem></varlistentry>
16924 <term><varname>$message_body_size</varname></term>
16927 <indexterm role="concept">
16928 <primary>body of message</primary>
16929 <secondary>size</secondary>
16931 <indexterm role="concept">
16932 <primary>message body</primary>
16933 <secondary>size</secondary>
16935 <indexterm role="variable">
16936 <primary><varname>$message_body_size</varname></primary>
16938 When a message is being delivered, this variable contains the size of the body
16939 in bytes. The count starts from the character after the blank line that
16940 separates the body from the header. Newlines are included in the count. See
16941 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
16943 </listitem></varlistentry>
16945 <term><varname>$message_exim_id</varname></term>
16948 <indexterm role="variable">
16949 <primary><varname>$message_exim_id</varname></primary>
16951 When a message is being received or delivered, this variable contains the
16952 unique message id that is generated and used by Exim to identify the message.
16953 An id is not created for a message until after its header has been successfully
16954 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
16955 line; it is the local id that Exim assigns to the message, for example:
16956 <literal>1BXTIK-0001yO-VA</literal>.
16958 </listitem></varlistentry>
16960 <term><varname>$message_headers</varname></term>
16963 <indexterm role="variable">
16964 <primary><varname>$message_headers</varname></primary>
16966 This variable contains a concatenation of all the header lines when a message
16967 is being processed, except for lines added by routers or transports. The header
16968 lines are separated by newline characters. Their contents are decoded in the
16969 same way as a header line that is inserted by <option>bheader</option>.
16971 </listitem></varlistentry>
16973 <term><varname>$message_headers_raw</varname></term>
16976 <indexterm role="variable">
16977 <primary><varname>$message_headers_raw</varname></primary>
16979 This variable is like <varname>$message_headers</varname> except that no processing of the
16980 contents of header lines is done.
16982 </listitem></varlistentry>
16984 <term><varname>$message_id</varname></term>
16987 This is an old name for <varname>$message_exim_id</varname>, which is now deprecated.
16989 </listitem></varlistentry>
16991 <term><varname>$message_linecount</varname></term>
16994 <indexterm role="variable">
16995 <primary><varname>$message_linecount</varname></primary>
16997 This variable contains the total number of lines in the header and body of the
16998 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
16999 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
17000 number of lines received. Before delivery happens (that is, before filters,
17001 routers, and transports run) the count is increased to include the
17002 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
17003 lines that are added by ACLs. The blank line that separates the message header
17004 from the body is not counted. Here is an example of the use of this variable in
17007 <literallayout class="monospaced">
17008 deny message = Too many lines in message header
17010 ${if <{250}{${eval:$message_linecount - $body_linecount}}}
17013 In the MAIL and RCPT ACLs, the value is zero because at that stage the
17014 message has not yet been received.
17016 </listitem></varlistentry>
17018 <term><varname>$message_size</varname></term>
17021 <indexterm role="concept">
17022 <primary>size</primary>
17023 <secondary>of message</secondary>
17025 <indexterm role="concept">
17026 <primary>message</primary>
17027 <secondary>size</secondary>
17029 <indexterm role="variable">
17030 <primary><varname>$message_size</varname></primary>
17032 When a message is being processed, this variable contains its size in bytes. In
17033 most cases, the size includes those headers that were received with the
17034 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
17035 deliveries as they are written. However, there is one special case: during the
17036 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
17037 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
17038 precise size of the file that has been written. See also
17039 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
17042 <indexterm role="concept">
17043 <primary>RCPT</primary>
17044 <secondary>value of <varname>$message_size</varname></secondary>
17046 While running a per message ACL (mail/rcpt/predata), <varname>$message_size</varname>
17047 contains the size supplied on the MAIL command, or -1 if no size was given. The
17048 value may not, of course, be truthful.
17050 </listitem></varlistentry>
17052 <term><varname>$mime_</varname><emphasis>xxx</emphasis></term>
17055 A number of variables whose names start with <varname>$mime</varname> are
17056 available when Exim is compiled with the content-scanning extension. For
17057 details, see section <xref linkend="SECTscanmimepart"/>.
17059 </listitem></varlistentry>
17061 <term><varname>$n0</varname> – <varname>$n9</varname></term>
17064 These variables are counters that can be incremented by means
17065 of the <option>add</option> command in filter files.
17067 </listitem></varlistentry>
17069 <term><varname>$original_domain</varname></term>
17072 <indexterm role="variable">
17073 <primary><varname>$domain</varname></primary>
17075 <indexterm role="variable">
17076 <primary><varname>$original_domain</varname></primary>
17078 When a top-level address is being processed for delivery, this contains the
17079 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
17080 generated by an alias, forward, or filter file) is being processed, this
17081 variable contains the domain of the original address (lower cased). This
17082 differs from <varname>$parent_domain</varname> only when there is more than one level of
17083 aliasing or forwarding. When more than one address is being delivered in a
17084 single transport run, <varname>$original_domain</varname> is not set.
17087 If a new address is created by means of a <option>deliver</option> command in a system
17088 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
17089 part <emphasis>system-filter</emphasis> and the default qualify domain.
17091 </listitem></varlistentry>
17093 <term><varname>$original_local_part</varname></term>
17096 <indexterm role="variable">
17097 <primary><varname>$local_part</varname></primary>
17099 <indexterm role="variable">
17100 <primary><varname>$original_local_part</varname></primary>
17102 When a top-level address is being processed for delivery, this contains the
17103 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
17104 local part, because <varname>$original_local_part</varname> always contains the full local
17105 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
17106 filter file) is being processed, this variable contains the full local part of
17107 the original address.
17110 If the router that did the redirection processed the local part
17111 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
17112 This variable differs from <varname>$parent_local_part</varname> only when there is more than
17113 one level of aliasing or forwarding. When more than one address is being
17114 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
17117 If a new address is created by means of a <option>deliver</option> command in a system
17118 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
17119 part <emphasis>system-filter</emphasis> and the default qualify domain.
17121 </listitem></varlistentry>
17123 <term><varname>$originator_gid</varname></term>
17126 <indexterm role="concept">
17127 <primary>gid (group id)</primary>
17128 <secondary>of originating user</secondary>
17130 <indexterm role="concept">
17131 <primary>sender</primary>
17132 <secondary>gid</secondary>
17134 <indexterm role="variable">
17135 <primary><varname>$caller_gid</varname></primary>
17137 <indexterm role="variable">
17138 <primary><varname>$originator_gid</varname></primary>
17140 This variable contains the value of <varname>$caller_gid</varname> that was set when the
17141 message was received. For messages received via the command line, this is the
17142 gid of the sending user. For messages received by SMTP over TCP/IP, this is
17143 normally the gid of the Exim user.
17145 </listitem></varlistentry>
17147 <term><varname>$originator_uid</varname></term>
17150 <indexterm role="concept">
17151 <primary>uid (user id)</primary>
17152 <secondary>of originating user</secondary>
17154 <indexterm role="concept">
17155 <primary>sender</primary>
17156 <secondary>uid</secondary>
17158 <indexterm role="variable">
17159 <primary><varname>$caller_uid</varname></primary>
17161 <indexterm role="variable">
17162 <primary><varname>$originaltor_uid</varname></primary>
17164 The value of <varname>$caller_uid</varname> that was set when the message was received. For
17165 messages received via the command line, this is the uid of the sending user.
17166 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
17169 </listitem></varlistentry>
17171 <term><varname>$parent_domain</varname></term>
17174 <indexterm role="variable">
17175 <primary><varname>$parent_domain</varname></primary>
17177 This variable is similar to <varname>$original_domain</varname> (see
17178 above), except that it refers to the immediately preceding parent address.
17180 </listitem></varlistentry>
17182 <term><varname>$parent_local_part</varname></term>
17185 <indexterm role="variable">
17186 <primary><varname>$parent_local_part</varname></primary>
17188 This variable is similar to <varname>$original_local_part</varname>
17189 (see above), except that it refers to the immediately preceding parent address.
17191 </listitem></varlistentry>
17193 <term><varname>$pid</varname></term>
17196 <indexterm role="concept">
17197 <primary>pid (process id)</primary>
17198 <secondary>of current process</secondary>
17200 <indexterm role="variable">
17201 <primary><varname>$pid</varname></primary>
17203 This variable contains the current process id.
17205 </listitem></varlistentry>
17207 <term><varname>$pipe_addresses</varname></term>
17210 <indexterm role="concept">
17211 <primary>filter</primary>
17212 <secondary>transport filter</secondary>
17214 <indexterm role="concept">
17215 <primary>transport</primary>
17216 <secondary>filter</secondary>
17218 <indexterm role="variable">
17219 <primary><varname>$pipe_addresses</varname></primary>
17221 This is not an expansion variable, but is mentioned here because the string
17222 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
17223 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
17224 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
17225 It cannot be used in general expansion strings, and provokes an <quote>unknown
17226 variable</quote> error if encountered.
17228 </listitem></varlistentry>
17230 <term><varname>$primary_hostname</varname></term>
17233 <indexterm role="variable">
17234 <primary><varname>$primary_hostname</varname></primary>
17236 This variable contains the value set by <option>primary_hostname</option> in the
17237 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
17238 a single-component name, Exim calls <function>gethostbyname()</function> (or
17239 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
17240 qualified host name. See also <varname>$smtp_active_hostname</varname>.
17242 </listitem></varlistentry>
17244 <term><varname>$prvscheck_address</varname></term>
17247 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
17248 which is described in sections <xref linkend="SECTexpansionitems"/> and
17249 <xref linkend="SECTverifyPRVS"/>.
17251 </listitem></varlistentry>
17253 <term><varname>$prvscheck_keynum</varname></term>
17256 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
17257 which is described in sections <xref linkend="SECTexpansionitems"/> and
17258 <xref linkend="SECTverifyPRVS"/>.
17260 </listitem></varlistentry>
17262 <term><varname>$prvscheck_result</varname></term>
17265 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
17266 which is described in sections <xref linkend="SECTexpansionitems"/> and
17267 <xref linkend="SECTverifyPRVS"/>.
17269 </listitem></varlistentry>
17271 <term><varname>$qualify_domain</varname></term>
17274 <indexterm role="variable">
17275 <primary><varname>$qualify_domain</varname></primary>
17277 The value set for the <option>qualify_domain</option> option in the configuration file.
17279 </listitem></varlistentry>
17281 <term><varname>$qualify_recipient</varname></term>
17284 <indexterm role="variable">
17285 <primary><varname>$qualify_recipient</varname></primary>
17287 The value set for the <option>qualify_recipient</option> option in the configuration file,
17288 or if not set, the value of <varname>$qualify_domain</varname>.
17290 </listitem></varlistentry>
17292 <term><varname>$rcpt_count</varname></term>
17295 <indexterm role="variable">
17296 <primary><varname>$rcpt_count</varname></primary>
17298 When a message is being received by SMTP, this variable contains the number of
17299 RCPT commands received for the current message. If this variable is used in a
17300 RCPT ACL, its value includes the current command.
17302 </listitem></varlistentry>
17304 <term><varname>$rcpt_defer_count</varname></term>
17307 <indexterm role="variable">
17308 <primary><varname>$rcpt_defer_count</varname></primary>
17310 <indexterm role="concept">
17311 <primary>4<emphasis>xx</emphasis> responses</primary>
17312 <secondary>count of</secondary>
17314 When a message is being received by SMTP, this variable contains the number of
17315 RCPT commands in the current message that have previously been rejected with a
17316 temporary (4<emphasis>xx</emphasis>) response.
17318 </listitem></varlistentry>
17320 <term><varname>$rcpt_fail_count</varname></term>
17323 <indexterm role="variable">
17324 <primary><varname>$rcpt_fail_count</varname></primary>
17326 When a message is being received by SMTP, this variable contains the number of
17327 RCPT commands in the current message that have previously been rejected with a
17328 permanent (5<emphasis>xx</emphasis>) response.
17330 </listitem></varlistentry>
17332 <term><varname>$received_count</varname></term>
17335 <indexterm role="variable">
17336 <primary><varname>$received_count</varname></primary>
17338 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
17339 including the one added by Exim (so its value is always greater than zero). It
17340 is available in the DATA ACL, the non-SMTP ACL, and while routing and
17343 </listitem></varlistentry>
17345 <term><varname>$received_for</varname></term>
17348 <indexterm role="variable">
17349 <primary><varname>$received_for</varname></primary>
17351 If there is only a single recipient address in an incoming message, this
17352 variable contains that address when the <emphasis>Received:</emphasis> header line is being
17353 built. The value is copied after recipient rewriting has happened, but before
17354 the <function>local_scan()</function> function is run.
17356 </listitem></varlistentry>
17358 <term><varname>$received_ip_address</varname></term>
17361 <indexterm role="variable">
17362 <primary><varname>$received_ip_address</varname></primary>
17364 As soon as an Exim server starts processing an incoming TCP/IP connection, this
17365 variable is set to the address of the local IP interface, and <varname>$received_port</varname>
17366 is set to the local port number. (The remote IP address and port are in
17367 <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.) When testing with <option>-bh</option>,
17368 the port value is -1 unless it has been set using the <option>-oMi</option> command line
17372 As well as being useful in ACLs (including the <quote>connect</quote> ACL), these variable
17373 could be used, for example, to make the file name for a TLS certificate depend
17374 on which interface and/or port is being used for the incoming connection. The
17375 values of <varname>$received_ip_address</varname> and <varname>$received_port</varname> are saved with any
17376 messages that are received, thus making these variables available at delivery
17380 <emphasis role="bold">Note:</emphasis> There are no equivalent variables for outgoing connections, because
17381 the values are unknown (unless they are explicitly set by options of the
17382 <command>smtp</command> transport).
17384 </listitem></varlistentry>
17386 <term><varname>$received_port</varname></term>
17389 <indexterm role="variable">
17390 <primary><varname>$received_port</varname></primary>
17392 See <varname>$received_ip_address</varname>.
17394 </listitem></varlistentry>
17396 <term><varname>$received_protocol</varname></term>
17399 <indexterm role="variable">
17400 <primary><varname>$received_protocol</varname></primary>
17402 When a message is being processed, this variable contains the name of the
17403 protocol by which it was received. Most of the names used by Exim are defined
17404 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
17405 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
17406 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
17407 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
17408 connection and the client was successfully authenticated.
17411 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
17412 automatically set up on connection without the use of STARTTLS (see
17413 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
17414 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
17415 where the client initially uses EHLO, sets up an encrypted connection using
17416 STARTTLS, and then uses HELO afterwards.
17419 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
17420 messages that are injected locally by trusted callers. This is commonly used to
17421 identify messages that are being re-injected after some kind of scanning.
17423 </listitem></varlistentry>
17425 <term><varname>$received_time</varname></term>
17428 <indexterm role="variable">
17429 <primary><varname>$received_time</varname></primary>
17431 This variable contains the date and time when the current message was received,
17432 as a number of seconds since the start of the Unix epoch.
17434 </listitem></varlistentry>
17436 <term><varname>$recipient_data</varname></term>
17439 <indexterm role="variable">
17440 <primary><varname>$recipient_data</varname></primary>
17442 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
17443 condition. It contains the data from the lookup, and the value remains set
17444 until the next <option>recipients</option> test. Thus, you can do things like this:
17447 <literal>require recipients = cdb*@;/some/file</literal>
17448 <literal>deny </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
17451 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
17452 method in the address list, using the semicolon syntax as in the example above.
17453 The variable is not set for a lookup that is used as part of the string
17454 expansion that all such lists undergo before being interpreted.
17456 </listitem></varlistentry>
17458 <term><varname>$recipient_verify_failure</varname></term>
17461 <indexterm role="variable">
17462 <primary><varname>$recipient_verify_failure</varname></primary>
17464 In an ACL, when a recipient verification fails, this variable contains
17465 information about the failure. It is set to one of the following words:
17470 <quote>qualify</quote>: The address was unqualified (no domain), and the message
17471 was neither local nor came from an exempted host.
17476 <quote>route</quote>: Routing failed.
17481 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
17482 or before the MAIL command (that is, on initial connection, HELO, or
17488 <quote>recipient</quote>: The RCPT command in a callout was rejected.
17493 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
17498 The main use of this variable is expected to be to distinguish between
17499 rejections of MAIL and rejections of RCPT.
17501 </listitem></varlistentry>
17503 <term><varname>$recipients</varname></term>
17506 <indexterm role="variable">
17507 <primary><varname>$recipients</varname></primary>
17509 This variable contains a list of envelope recipients for a message. A comma and
17510 a space separate the addresses in the replacement text. However, the variable
17511 is not generally available, to prevent exposure of Bcc recipients in
17512 unprivileged users’ filter files. You can use <varname>$recipients</varname> only in these
17515 <orderedlist numeration="arabic">
17518 In a system filter file.
17523 In the ACLs associated with the DATA command and with non-SMTP messages, that
17524 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
17525 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
17526 <option>acl_not_smtp_mime</option>.
17531 From within a <function>local_scan()</function> function.
17535 </listitem></varlistentry>
17537 <term><varname>$recipients_count</varname></term>
17540 <indexterm role="variable">
17541 <primary><varname>$recipients_count</varname></primary>
17543 When a message is being processed, this variable contains the number of
17544 envelope recipients that came with the message. Duplicates are not excluded
17545 from the count. While a message is being received over SMTP, the number
17546 increases for each accepted recipient. It can be referenced in an ACL.
17548 </listitem></varlistentry>
17550 <term><varname>$regex_match_string</varname></term>
17553 <indexterm role="variable">
17554 <primary><varname>$regex_match_string</varname></primary>
17556 This variable is set to contain the matching regular expression after a
17557 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
17559 </listitem></varlistentry>
17561 <term><varname>$reply_address</varname></term>
17564 <indexterm role="variable">
17565 <primary><varname>$reply_address</varname></primary>
17567 When a message is being processed, this variable contains the contents of the
17568 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
17569 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
17570 white space, the value is not processed in any way. In particular, no RFC 2047
17571 decoding or character code translation takes place.
17573 </listitem></varlistentry>
17575 <term><varname>$return_path</varname></term>
17578 <indexterm role="variable">
17579 <primary><varname>$return_path</varname></primary>
17581 When a message is being delivered, this variable contains the return path –
17582 the sender field that will be sent as part of the envelope. It is not enclosed
17583 in <> characters. At the start of routing an address, <varname>$return_path</varname> has the
17584 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
17585 mailing list has been expanded by a router which specifies a different address
17586 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
17587 address, whereas <varname>$sender_address</varname> always contains the original sender address
17588 that was received with the message. In other words, <varname>$sender_address</varname> contains
17589 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
17592 </listitem></varlistentry>
17594 <term><varname>$return_size_limit</varname></term>
17597 <indexterm role="variable">
17598 <primary><varname>$return_size_limit</varname></primary>
17600 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
17602 </listitem></varlistentry>
17604 <term><varname>$runrc</varname></term>
17607 <indexterm role="concept">
17608 <primary>return code</primary>
17609 <secondary>from <option>run</option> expansion</secondary>
17611 <indexterm role="variable">
17612 <primary><varname>$runrc</varname></primary>
17614 This variable contains the return code from a command that is run by the
17615 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
17616 assume the order in which option values are expanded, except for those
17617 preconditions whose order of testing is documented. Therefore, you cannot
17618 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
17621 </listitem></varlistentry>
17623 <term><varname>$self_hostname</varname></term>
17626 <indexterm role="option">
17627 <primary><option>self</option></primary>
17628 <secondary>value of host name</secondary>
17630 <indexterm role="variable">
17631 <primary><varname>$self_hostname</varname></primary>
17633 When an address is routed to a supposedly remote host that turns out to be the
17634 local host, what happens is controlled by the <option>self</option> generic router option.
17635 One of its values causes the address to be passed to another router. When this
17636 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
17637 original router encountered. In other circumstances its contents are null.
17639 </listitem></varlistentry>
17641 <term><varname>$sender_address</varname></term>
17644 <indexterm role="variable">
17645 <primary><varname>$sender_address</varname></primary>
17647 When a message is being processed, this variable contains the sender’s address
17648 that was received in the message’s envelope. The case of letters in the address
17649 is retained, in both the local part and the domain. For bounce messages, the
17650 value of this variable is the empty string. See also <varname>$return_path</varname>.
17652 </listitem></varlistentry>
17654 <term><varname>$sender_address_data</varname></term>
17657 <indexterm role="variable">
17658 <primary><varname>$address_data</varname></primary>
17660 <indexterm role="variable">
17661 <primary><varname>$sender_address_data</varname></primary>
17663 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
17664 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
17665 distinguish it from data from a recipient address. The value does not persist
17666 after the end of the current ACL statement. If you want to preserve it for
17667 longer, you can save it in an ACL variable.
17669 </listitem></varlistentry>
17671 <term><varname>$sender_address_domain</varname></term>
17674 <indexterm role="variable">
17675 <primary><varname>$sender_address_domain</varname></primary>
17677 The domain portion of <varname>$sender_address</varname>.
17679 </listitem></varlistentry>
17681 <term><varname>$sender_address_local_part</varname></term>
17684 <indexterm role="variable">
17685 <primary><varname>$sender_address_local_part</varname></primary>
17687 The local part portion of <varname>$sender_address</varname>.
17689 </listitem></varlistentry>
17691 <term><varname>$sender_data</varname></term>
17694 <indexterm role="variable">
17695 <primary><varname>$sender_data</varname></primary>
17697 This variable is set after a lookup success in an ACL <option>senders</option> condition or
17698 in a router <option>senders</option> option. It contains the data from the lookup, and the
17699 value remains set until the next <option>senders</option> test. Thus, you can do things like
17703 <literal>require senders = cdb*@;/some/file</literal>
17704 <literal>deny </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
17707 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
17708 method in the address list, using the semicolon syntax as in the example above.
17709 The variable is not set for a lookup that is used as part of the string
17710 expansion that all such lists undergo before being interpreted.
17712 </listitem></varlistentry>
17714 <term><varname>$sender_fullhost</varname></term>
17717 <indexterm role="variable">
17718 <primary><varname>$sender_fullhost</varname></primary>
17720 When a message is received from a remote host, this variable contains the host
17721 name and IP address in a single string. It ends with the IP address in square
17722 brackets, followed by a colon and a port number if the logging of ports is
17723 enabled. The format of the rest of the string depends on whether the host
17724 issued a HELO or EHLO SMTP command, and whether the host name was verified by
17725 looking up its IP address. (Looking up the IP address can be forced by the
17726 <option>host_lookup</option> option, independent of verification.) A plain host name at the
17727 start of the string is a verified host name; if this is not present,
17728 verification either failed or was not requested. A host name in parentheses is
17729 the argument of a HELO or EHLO command. This is omitted if it is identical to
17730 the verified host name or to the host’s IP address in square brackets.
17732 </listitem></varlistentry>
17734 <term><varname>$sender_helo_name</varname></term>
17737 <indexterm role="variable">
17738 <primary><varname>$sender_helo_name</varname></primary>
17740 When a message is received from a remote host that has issued a HELO or EHLO
17741 command, the argument of that command is placed in this variable. It is also
17742 set if HELO or EHLO is used when a message is received using SMTP locally via
17743 the <option>-bs</option> or <option>-bS</option> options.
17745 </listitem></varlistentry>
17747 <term><varname>$sender_host_address</varname></term>
17750 <indexterm role="variable">
17751 <primary><varname>$sender_host_address</varname></primary>
17753 When a message is received from a remote host, this variable contains that
17754 host’s IP address. For locally submitted messages, it is empty.
17756 </listitem></varlistentry>
17758 <term><varname>$sender_host_authenticated</varname></term>
17761 <indexterm role="variable">
17762 <primary><varname>$sender_host_authenticated</varname></primary>
17764 This variable contains the name (not the public name) of the authenticator
17765 driver that successfully authenticated the client from which the message was
17766 received. It is empty if there was no successful authentication. See also
17767 <varname>$authenticated_id</varname>.
17769 </listitem></varlistentry>
17771 <term><varname>$sender_host_name</varname></term>
17774 <indexterm role="variable">
17775 <primary><varname>$sender_host_name</varname></primary>
17777 When a message is received from a remote host, this variable contains the
17778 host’s name as obtained by looking up its IP address. For messages received by
17779 other means, this variable is empty.
17782 <indexterm role="variable">
17783 <primary><varname>$host_lookup_failed</varname></primary>
17785 If the host name has not previously been looked up, a reference to
17786 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
17787 A looked up name is accepted only if it leads back to the original IP address
17788 via a forward lookup. If either the reverse or the forward lookup fails to find
17789 any data, or if the forward lookup does not yield the original IP address,
17790 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
17793 <indexterm role="variable">
17794 <primary><varname>$host_lookup_deferred</varname></primary>
17796 However, if either of the lookups cannot be completed (for example, there is a
17797 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
17798 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
17801 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
17802 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
17803 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
17804 is set to <quote>1</quote>.
17807 Exim does not automatically look up every calling host’s name. If you want
17808 maximum efficiency, you should arrange your configuration so that it avoids
17809 these lookups altogether. The lookup happens only if one or more of the
17810 following are true:
17815 A string containing <varname>$sender_host_name</varname> is expanded.
17820 The calling host matches the list in <option>host_lookup</option>. In the default
17821 configuration, this option is set to *, so it must be changed if lookups are
17822 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
17827 Exim needs the host name in order to test an item in a host list. The items
17828 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
17829 <xref linkend="SECThoslispatnamsk"/>.
17834 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
17835 In this case, the host name is required to compare with the name quoted in any
17836 EHLO or HELO commands that the client issues.
17841 The remote host issues a EHLO or HELO command that quotes one of the
17842 domains in <option>helo_lookup_domains</option>. The default value of this option is
17844 <literallayout class="monospaced">
17845 helo_lookup_domains = @ : @[]
17848 which causes a lookup if a remote host (incorrectly) gives the server’s name or
17849 IP address in an EHLO or HELO command.
17853 </listitem></varlistentry>
17855 <term><varname>$sender_host_port</varname></term>
17858 <indexterm role="variable">
17859 <primary><varname>$sender_host_port</varname></primary>
17861 When a message is received from a remote host, this variable contains the port
17862 number that was used on the remote host.
17864 </listitem></varlistentry>
17866 <term><varname>$sender_ident</varname></term>
17869 <indexterm role="variable">
17870 <primary><varname>$sender_ident</varname></primary>
17872 When a message is received from a remote host, this variable contains the
17873 identification received in response to an RFC 1413 request. When a message has
17874 been received locally, this variable contains the login name of the user that
17877 </listitem></varlistentry>
17879 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
17882 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
17883 <option>ratelimit</option> ACL condition. Details are given in section
17884 <xref linkend="SECTratelimiting"/>.
17886 </listitem></varlistentry>
17888 <term><varname>$sender_rcvhost</varname></term>
17891 <indexterm role="concept">
17892 <primary>DNS</primary>
17893 <secondary>reverse lookup</secondary>
17895 <indexterm role="concept">
17896 <primary>reverse DNS lookup</primary>
17898 <indexterm role="variable">
17899 <primary><varname>$sender_rcvhost</varname></primary>
17901 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
17902 either the verified host name (as obtained from a reverse DNS lookup) or, if
17903 there is no verified host name, the IP address in square brackets. After that
17904 there may be text in parentheses. When the first item is a verified host name,
17905 the first thing in the parentheses is the IP address in square brackets,
17906 followed by a colon and a port number if port logging is enabled. When the
17907 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
17911 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
17912 was used and its argument was not identical to the real host name or IP
17913 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
17914 all three items are present in the parentheses, a newline and tab are inserted
17915 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
17917 </listitem></varlistentry>
17919 <term><varname>$sender_verify_failure</varname></term>
17922 <indexterm role="variable">
17923 <primary><varname>$sender_verify_failure</varname></primary>
17925 In an ACL, when a sender verification fails, this variable contains information
17926 about the failure. The details are the same as for
17927 <varname>$recipient_verify_failure</varname>.
17929 </listitem></varlistentry>
17931 <term><varname>$sending_ip_address</varname></term>
17934 <indexterm role="variable">
17935 <primary><varname>$sending_ip_address</varname></primary>
17937 This variable is set whenever an outgoing SMTP connection to another host has
17938 been set up. It contains the IP address of the local interface that is being
17939 used. This is useful if a host that has more than one IP address wants to take
17940 on different personalities depending on which one is being used. For incoming
17941 connections, see <varname>$received_ip_address</varname>.
17943 </listitem></varlistentry>
17945 <term><varname>$sending_port</varname></term>
17948 <indexterm role="variable">
17949 <primary><varname>$sending_port</varname></primary>
17951 This variable is set whenever an outgoing SMTP connection to another host has
17952 been set up. It contains the local port that is being used. For incoming
17953 connections, see <varname>$received_port</varname>.
17955 </listitem></varlistentry>
17957 <term><varname>$smtp_active_hostname</varname></term>
17960 <indexterm role="variable">
17961 <primary><varname>$smtp_active_hostname</varname></primary>
17963 During an incoming SMTP session, this variable contains the value of the active
17964 host name, as specified by the <option>smtp_active_hostname</option> option. The value of
17965 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
17966 value can be consulted during routing and delivery.
17968 </listitem></varlistentry>
17970 <term><varname>$smtp_command</varname></term>
17973 <indexterm role="variable">
17974 <primary><varname>$smtp_command</varname></primary>
17976 During the processing of an incoming SMTP command, this variable contains the
17977 entire command. This makes it possible to distinguish between HELO and EHLO in
17978 the HELO ACL, and also to distinguish between commands such as these:
17980 <literallayout class="monospaced">
17982 MAIL FROM: <>
17985 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
17986 command, the address in <varname>$smtp_command</varname> is the original address before any
17987 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
17988 the address after SMTP-time rewriting.
17990 </listitem></varlistentry>
17992 <term><varname>$smtp_command_argument</varname></term>
17995 <indexterm role="concept">
17996 <primary>SMTP</primary>
17997 <secondary>command, argument for</secondary>
17999 <indexterm role="variable">
18000 <primary><varname>$smtp_command_argument</varname></primary>
18002 While an ACL is running to check an SMTP command, this variable contains the
18003 argument, that is, the text that follows the command name, with leading white
18004 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
18005 somewhat redundant, but is retained for backwards compatibility.
18007 </listitem></varlistentry>
18009 <term><varname>$smtp_count_at_connection_start</varname></term>
18012 <indexterm role="variable">
18013 <primary><varname>$smtp_count_at_connection_start</varname></primary>
18015 This variable is set greater than zero only in processes spawned by the Exim
18016 daemon for handling incoming SMTP connections. The name is deliberately long,
18017 in order to emphasize what the contents are. When the daemon accepts a new
18018 connection, it increments this variable. A copy of the variable is passed to
18019 the child process that handles the connection, but its value is fixed, and
18020 never changes. It is only an approximation of how many incoming connections
18021 there actually are, because many other connections may come and go while a
18022 single connection is being processed. When a child process terminates, the
18023 daemon decrements its copy of the variable.
18025 </listitem></varlistentry>
18027 <term><varname>$sn0</varname> – <varname>$sn9</varname></term>
18030 These variables are copies of the values of the <varname>$n0</varname> – <varname>$n9</varname> accumulators
18031 that were current at the end of the system filter file. This allows a system
18032 filter file to set values that can be tested in users’ filter files. For
18033 example, a system filter could set a value indicating how likely it is that a
18034 message is junk mail.
18036 </listitem></varlistentry>
18038 <term><varname>$spam_</varname><emphasis>xxx</emphasis></term>
18041 A number of variables whose names start with <varname>$spam</varname> are available when Exim
18042 is compiled with the content-scanning extension. For details, see section
18043 <xref linkend="SECTscanspamass"/>.
18045 </listitem></varlistentry>
18047 <term><varname>$spool_directory</varname></term>
18050 <indexterm role="variable">
18051 <primary><varname>$spool_directory</varname></primary>
18053 The name of Exim’s spool directory.
18055 </listitem></varlistentry>
18057 <term><varname>$spool_inodes</varname></term>
18060 <indexterm role="variable">
18061 <primary><varname>$spool_inodes</varname></primary>
18063 The number of free inodes in the disk partition where Exim’s spool files are
18064 being written. The value is recalculated whenever the variable is referenced.
18065 If the relevant file system does not have the concept of inodes, the value of
18066 is -1. See also the <option>check_spool_inodes</option> option.
18068 </listitem></varlistentry>
18070 <term><varname>$spool_space</varname></term>
18073 <indexterm role="variable">
18074 <primary><varname>$spool_space</varname></primary>
18076 The amount of free space (as a number of kilobytes) in the disk partition where
18077 Exim’s spool files are being written. The value is recalculated whenever the
18078 variable is referenced. If the operating system does not have the ability to
18079 find the amount of free space (only true for experimental systems), the space
18080 value is -1. For example, to check in an ACL that there is at least 50
18081 megabytes free on the spool, you could write:
18083 <literallayout class="monospaced">
18084 condition = ${if > {$spool_space}{50000}}
18087 See also the <option>check_spool_space</option> option.
18089 </listitem></varlistentry>
18091 <term><varname>$thisaddress</varname></term>
18094 <indexterm role="variable">
18095 <primary><varname>$thisaddress</varname></primary>
18097 This variable is set only during the processing of the <option>foranyaddress</option>
18098 command in a filter file. Its use is explained in the description of that
18099 command, which can be found in the separate document entitled <emphasis>Exim’s
18100 interfaces to mail filtering</emphasis>.
18102 </listitem></varlistentry>
18104 <term><varname>$tls_certificate_verified</varname></term>
18107 <indexterm role="variable">
18108 <primary><varname>$tls_certificate_verified</varname></primary>
18110 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
18111 message was received, and <quote>0</quote> otherwise.
18113 </listitem></varlistentry>
18115 <term><varname>$tls_cipher</varname></term>
18118 <indexterm role="variable">
18119 <primary><varname>$tls_cipher</varname></primary>
18121 When a message is received from a remote host over an encrypted SMTP
18122 connection, this variable is set to the cipher suite that was negotiated, for
18123 example DES-CBC3-SHA. In other circumstances, in particular, for message
18124 received over unencrypted connections, the variable is empty. Testing
18125 <varname>$tls_cipher</varname> for emptiness is one way of distinguishing between encrypted and
18126 non-encrypted connections during ACL processing.
18129 The <varname>$tls_cipher</varname> variable retains its value during message delivery, except
18130 when an outward SMTP delivery takes place via the <command>smtp</command> transport. In this
18131 case, <varname>$tls_cipher</varname> is cleared before any outgoing SMTP connection is made,
18132 and then set to the outgoing cipher suite if one is negotiated. See chapter
18133 <xref linkend="CHAPTLS"/> for details of TLS support and chapter <xref linkend="CHAPsmtptrans"/> for
18134 details of the <command>smtp</command> transport.
18136 </listitem></varlistentry>
18138 <term><varname>$tls_peerdn</varname></term>
18141 <indexterm role="variable">
18142 <primary><varname>$tls_peerdn</varname></primary>
18144 When a message is received from a remote host over an encrypted SMTP
18145 connection, and Exim is configured to request a certificate from the client,
18146 the value of the Distinguished Name of the certificate is made available in the
18147 <varname>$tls_peerdn</varname> during subsequent processing. Like <varname>$tls_cipher</varname>, the
18148 value is retained during message delivery, except during outbound SMTP
18151 </listitem></varlistentry>
18153 <term><varname>$tod_bsdinbox</varname></term>
18156 <indexterm role="variable">
18157 <primary><varname>$tod_bsdinbox</varname></primary>
18159 The time of day and the date, in the format required for BSD-style mailbox
18160 files, for example: Thu Oct 17 17:14:09 1995.
18162 </listitem></varlistentry>
18164 <term><varname>$tod_epoch</varname></term>
18167 <indexterm role="variable">
18168 <primary><varname>$tod_epoch</varname></primary>
18170 The time and date as a number of seconds since the start of the Unix epoch.
18172 </listitem></varlistentry>
18174 <term><varname>$tod_full</varname></term>
18177 <indexterm role="variable">
18178 <primary><varname>$tod_full</varname></primary>
18180 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
18181 +0100. The timezone is always given as a numerical offset from UTC, with
18182 positive values used for timezones that are ahead (east) of UTC, and negative
18183 values for those that are behind (west).
18185 </listitem></varlistentry>
18187 <term><varname>$tod_log</varname></term>
18190 <indexterm role="variable">
18191 <primary><varname>$tod_log</varname></primary>
18193 The time and date in the format used for writing Exim’s log files, for example:
18194 1995-10-12 15:32:29, but without a timezone.
18196 </listitem></varlistentry>
18198 <term><varname>$tod_logfile</varname></term>
18201 <indexterm role="variable">
18202 <primary><varname>$tod_logfile</varname></primary>
18204 This variable contains the date in the format yyyymmdd. This is the format that
18205 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
18208 </listitem></varlistentry>
18210 <term><varname>$tod_zone</varname></term>
18213 <indexterm role="variable">
18214 <primary><varname>$tod_zone</varname></primary>
18216 This variable contains the numerical value of the local timezone, for example:
18219 </listitem></varlistentry>
18221 <term><varname>$tod_zulu</varname></term>
18224 <indexterm role="variable">
18225 <primary><varname>$tod_zulu</varname></primary>
18227 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
18228 by ISO 8601, for example: 20030221154023Z.
18230 </listitem></varlistentry>
18232 <term><varname>$value</varname></term>
18235 <indexterm role="variable">
18236 <primary><varname>$value</varname></primary>
18238 This variable contains the result of an expansion lookup, extraction operation,
18239 or external command, as described above. It is also used during a
18240 <emphasis role="bold">reduce</emphasis> expansion.
18242 </listitem></varlistentry>
18244 <term><varname>$version_number</varname></term>
18247 <indexterm role="variable">
18248 <primary><varname>$version_number</varname></primary>
18250 The version number of Exim.
18252 </listitem></varlistentry>
18254 <term><varname>$warn_message_delay</varname></term>
18257 <indexterm role="variable">
18258 <primary><varname>$warn_message_delay</varname></primary>
18260 This variable is set only during the creation of a message warning about a
18261 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
18263 </listitem></varlistentry>
18265 <term><varname>$warn_message_recipients</varname></term>
18268 <indexterm role="variable">
18269 <primary><varname>$warn_message_recipients</varname></primary>
18271 This variable is set only during the creation of a message warning about a
18272 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
18274 </listitem></varlistentry>
18277 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
18282 <chapter id="CHAPperl">
18283 <title>Embedded Perl</title>
18285 <indexterm role="concept" id="IIDperl" class="startofrange">
18286 <primary>Perl</primary>
18287 <secondary>calling from Exim</secondary>
18289 Exim can be built to include an embedded Perl interpreter. When this is done,
18290 Perl subroutines can be called as part of the string expansion process. To make
18291 use of the Perl support, you need version 5.004 or later of Perl installed on
18292 your system. To include the embedded interpreter in the Exim binary, include
18295 <literallayout class="monospaced">
18299 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
18301 <section id="SECID85">
18302 <title>Setting up so Perl can be used</title>
18304 <indexterm role="option">
18305 <primary><option>perl_startup</option></primary>
18307 Access to Perl subroutines is via a global configuration option called
18308 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
18309 no <option>perl_startup</option> option in the Exim configuration file then no Perl
18310 interpreter is started and there is almost no overhead for Exim (since none of
18311 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
18312 option then the associated value is taken to be Perl code which is executed in
18313 a newly created Perl interpreter.
18316 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
18317 need backslashes before any characters to escape special meanings. The option
18318 should usually be something like
18320 <literallayout class="monospaced">
18321 perl_startup = do '/etc/exim.pl'
18324 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
18325 use from Exim. Exim can be configured either to start up a Perl interpreter as
18326 soon as it is entered, or to wait until the first time it is needed. Starting
18327 the interpreter at the beginning ensures that it is done while Exim still has
18328 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
18329 fact used in a particular run. Also, note that this does not mean that Exim is
18330 necessarily running as root when Perl is called at a later time. By default,
18331 the interpreter is started only when it is needed, but this can be changed in
18337 <indexterm role="option">
18338 <primary><option>perl_at_start</option></primary>
18340 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
18341 a startup when Exim is entered.
18346 The command line option <option>-ps</option> also requests a startup when Exim is entered,
18347 overriding the setting of <option>perl_at_start</option>.
18352 There is also a command line option <option>-pd</option> (for delay) which suppresses the
18353 initial startup, even if <option>perl_at_start</option> is set.
18356 <section id="SECID86">
18357 <title>Calling Perl subroutines</title>
18359 When the configuration file includes a <option>perl_startup</option> option you can make use
18360 of the string expansion item to call the Perl subroutines that are defined
18361 by the <option>perl_startup</option> code. The operator is used in any of the following
18364 <literallayout class="monospaced">
18366 ${perl{foo}{argument}}
18367 ${perl{foo}{argument1}{argument2} ... }
18370 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
18371 arguments may be passed. Passing more than this results in an expansion failure
18372 with an error message of the form
18374 <literallayout class="monospaced">
18375 Too many arguments passed to Perl subroutine "foo" (max is 8)
18378 The return value of the Perl subroutine is evaluated in a scalar context before
18379 it is passed back to Exim to be inserted into the expanded string. If the
18380 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
18381 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
18382 by obeying Perl’s <option>die</option> function, the expansion fails with the error message
18383 that was passed to <option>die</option>.
18386 <section id="SECID87">
18387 <title>Calling Exim functions from Perl</title>
18389 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
18390 is available to call back into Exim’s string expansion function. For example,
18393 <literallayout class="monospaced">
18394 my $lp = Exim::expand_string('$local_part');
18397 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
18398 Note those are single quotes and not double quotes to protect against
18399 <varname>$local_part</varname> being interpolated as a Perl variable.
18402 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
18403 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
18404 expansion string, the Perl call from the original expansion string fails with
18405 an appropriate error message, in the same way as if <option>die</option> were used.
18408 <indexterm role="concept">
18409 <primary>debugging</primary>
18410 <secondary>from embedded Perl</secondary>
18412 <indexterm role="concept">
18413 <primary>log</primary>
18414 <secondary>writing from embedded Perl</secondary>
18416 Two other Exim functions are available for use from within Perl code.
18417 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim’s
18418 debugging is enabled. If you want a newline at the end, you must supply it.
18419 <emphasis>Exim::log_write()</emphasis> writes a string to Exim’s main log, adding a leading
18420 timestamp. In this case, you should not supply a terminating newline.
18423 <section id="SECID88">
18424 <title>Use of standard output and error by Perl</title>
18426 <indexterm role="concept">
18427 <primary>Perl</primary>
18428 <secondary>standard output and error</secondary>
18430 You should not write to the standard error or output streams from within your
18431 Perl code, as it is not defined how these are set up. In versions of Exim
18432 before 4.50, it is possible for the standard output or error to refer to the
18433 SMTP connection during message reception via the daemon. Writing to this stream
18434 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
18435 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
18436 avoided, but the output is lost.
18439 <indexterm role="concept">
18440 <primary>Perl</primary>
18441 <secondary>use of <option>warn</option></secondary>
18443 The Perl <option>warn</option> statement writes to the standard error stream by default.
18444 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
18445 you have no control. When Exim starts up the Perl interpreter, it arranges for
18446 output from the <option>warn</option> statement to be written to the Exim main log. You can
18447 change this by including appropriate Perl magic somewhere in your Perl code.
18448 For example, to discard <option>warn</option> output completely, you need this:
18450 <literallayout class="monospaced">
18451 $SIG{__WARN__} = sub { };
18454 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
18455 example, the code for the subroutine is empty, so it does nothing, but you can
18456 include any Perl code that you like. The text of the <option>warn</option> message is passed
18457 as the first subroutine argument.
18458 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
18463 <chapter id="CHAPinterfaces">
18464 <title>Starting the daemon and the use of network interfaces</title>
18465 <titleabbrev>Starting the daemon</titleabbrev>
18467 <indexterm role="concept">
18468 <primary>daemon</primary>
18469 <secondary>starting</secondary>
18471 <indexterm role="concept">
18472 <primary>interface</primary>
18473 <secondary>listening</secondary>
18475 <indexterm role="concept">
18476 <primary>network interface</primary>
18478 <indexterm role="concept">
18479 <primary>interface</primary>
18480 <secondary>network</secondary>
18482 <indexterm role="concept">
18483 <primary>IP address</primary>
18484 <secondary>for listening</secondary>
18486 <indexterm role="concept">
18487 <primary>daemon</primary>
18488 <secondary>listening IP addresses</secondary>
18490 <indexterm role="concept">
18491 <primary>TCP/IP</primary>
18492 <secondary>setting listening interfaces</secondary>
18494 <indexterm role="concept">
18495 <primary>TCP/IP</primary>
18496 <secondary>setting listening ports</secondary>
18498 A host that is connected to a TCP/IP network may have one or more physical
18499 hardware network interfaces. Each of these interfaces may be configured as one
18500 or more <quote>logical</quote> interfaces, which are the entities that a program actually
18501 works with. Each of these logical interfaces is associated with an IP address.
18502 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
18503 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
18504 knowledge about the host’s interfaces for use in three different circumstances:
18506 <orderedlist numeration="arabic">
18509 When a listening daemon is started, Exim needs to know which interfaces
18510 and ports to listen on.
18515 When Exim is routing an address, it needs to know which IP addresses
18516 are associated with local interfaces. This is required for the correct
18517 processing of MX lists by removing the local host and others with the
18518 same or higher priority values. Also, Exim needs to detect cases
18519 when an address is routed to an IP address that in fact belongs to the
18520 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
18521 option of the smtp transport is set (as appropriate), this is treated
18522 as an error situation.
18527 When Exim connects to a remote host, it may need to know which interface to use
18528 for the outgoing connection.
18533 Exim’s default behaviour is likely to be appropriate in the vast majority
18534 of cases. If your host has only one interface, and you want all its IP
18535 addresses to be treated in the same way, and you are using only the
18536 standard SMTP port, you should not need to take any special action. The
18537 rest of this chapter does not apply to you.
18540 In a more complicated situation you may want to listen only on certain
18541 interfaces, or on different ports, and for this reason there are a number of
18542 options that can be used to influence Exim’s behaviour. The rest of this
18543 chapter describes how they operate.
18546 When a message is received over TCP/IP, the interface and port that were
18547 actually used are set in <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
18549 <section id="SECID89">
18550 <title>Starting a listening daemon</title>
18552 When a listening daemon is started (by means of the <option>-bd</option> command line
18553 option), the interfaces and ports on which it listens are controlled by the
18559 <option>daemon_smtp_ports</option> contains a list of default ports. (For backward
18560 compatibility, this option can also be specified in the singular.)
18565 <option>local_interfaces</option> contains list of interface IP addresses on which to
18566 listen. Each item may optionally also specify a port.
18571 The default list separator in both cases is a colon, but this can be changed as
18572 described in section <xref linkend="SECTlistconstruct"/>. When IPv6 addresses are involved,
18573 it is usually best to change the separator to avoid having to double all the
18574 colons. For example:
18576 <literallayout class="monospaced">
18577 local_interfaces = <; 127.0.0.1 ; \
18580 3ffe:ffff:836f::fe86:a061
18583 There are two different formats for specifying a port along with an IP address
18584 in <option>local_interfaces</option>:
18586 <orderedlist numeration="arabic">
18589 The port is added onto the address with a dot separator. For example, to listen
18590 on port 1234 on two different IP addresses:
18592 <literallayout class="monospaced">
18593 local_interfaces = <; 192.168.23.65.1234 ; \
18594 3ffe:ffff:836f::fe86:a061.1234
18599 The IP address is enclosed in square brackets, and the port is added
18600 with a colon separator, for example:
18602 <literallayout class="monospaced">
18603 local_interfaces = <; [192.168.23.65]:1234 ; \
18604 [3ffe:ffff:836f::fe86:a061]:1234
18609 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
18610 default setting contains just one port:
18612 <literallayout class="monospaced">
18613 daemon_smtp_ports = smtp
18616 If more than one port is listed, each interface that does not have its own port
18617 specified listens on all of them. Ports that are listed in
18618 <option>daemon_smtp_ports</option> can be identified either by name (defined in
18619 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
18620 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
18623 <section id="SECID90">
18624 <title>Special IP listening addresses</title>
18626 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
18627 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
18628 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
18629 instead of setting up separate listening sockets for each interface. The
18630 default value of <option>local_interfaces</option> is
18632 <literallayout class="monospaced">
18633 local_interfaces = 0.0.0.0
18636 when Exim is built without IPv6 support; otherwise it is:
18638 <literallayout class="monospaced">
18639 local_interfaces = <; ::0 ; 0.0.0.0
18642 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
18645 <section id="SECID91">
18646 <title>Overriding local_interfaces and daemon_smtp_ports</title>
18648 The <option>-oX</option> command line option can be used to override the values of
18649 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
18650 instance. Another way of doing this would be to use macros and the <option>-D</option>
18651 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
18652 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
18656 The value of <option>-oX</option> is a list of items. The default colon separator can be
18657 changed in the usual way if required. If there are any items that do not
18658 contain dots or colons (that is, are not IP addresses), the value of
18659 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
18660 items that do contain dots or colons, the value of <option>local_interfaces</option> is
18661 replaced by those items. Thus, for example,
18663 <literallayout class="monospaced">
18667 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
18670 <literallayout class="monospaced">
18671 -oX 192.168.34.5.1125
18674 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
18675 (However, since <option>local_interfaces</option> now contains no items without ports, the
18676 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
18679 <section id="SECTsupobssmt">
18680 <title>Support for the obsolete SSMTP (or SMTPS) protocol</title>
18682 <indexterm role="concept">
18683 <primary>ssmtp protocol</primary>
18685 <indexterm role="concept">
18686 <primary>smtps protocol</primary>
18688 <indexterm role="concept">
18689 <primary>SMTP</primary>
18690 <secondary>ssmtp protocol</secondary>
18692 <indexterm role="concept">
18693 <primary>SMTP</primary>
18694 <secondary>smtps protocol</secondary>
18696 Exim supports the obsolete SSMTP protocol (also known as SMTPS) that was used
18697 before the STARTTLS command was standardized for SMTP. Some legacy clients
18698 still use this protocol. If the <option>tls_on_connect_ports</option> option is set to a
18699 list of port numbers, connections to those ports must use SSMTP. The most
18700 common use of this option is expected to be
18702 <literallayout class="monospaced">
18703 tls_on_connect_ports = 465
18706 because 465 is the usual port number used by the legacy clients. There is also
18707 a command line option <option>-tls-on-connect</option>, which forces all ports to behave in
18708 this way when a daemon is started.
18711 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
18712 daemon to listen on those ports. You must still specify them in
18713 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
18714 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
18715 connections via the daemon.)
18718 <section id="SECID92">
18719 <title>IPv6 address scopes</title>
18721 <indexterm role="concept">
18722 <primary>IPv6</primary>
18723 <secondary>address scopes</secondary>
18725 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
18726 can, in principle, have the same link-local IPv6 address on different
18727 interfaces. Thus, additional information is needed, over and above the IP
18728 address, to distinguish individual interfaces. A convention of using a
18729 percent sign followed by something (often the interface name) has been
18730 adopted in some cases, leading to addresses like this:
18732 <literallayout class="monospaced">
18733 fe80::202:b3ff:fe03:45c1%eth0
18736 To accommodate this usage, a percent sign followed by an arbitrary string is
18737 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
18738 to convert a textual IPv6 address for actual use. This function recognizes the
18739 percent convention in operating systems that support it, and it processes the
18740 address appropriately. Unfortunately, some older libraries have problems with
18741 <function>getaddrinfo()</function>. If
18743 <literallayout class="monospaced">
18744 IPV6_USE_INET_PTON=yes
18747 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
18748 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
18749 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
18750 function.) Of course, this means that the additional functionality of
18751 <function>getaddrinfo()</function> – recognizing scoped addresses – is lost.
18754 <section id="SECID93">
18755 <title>Disabling IPv6</title>
18757 <indexterm role="concept">
18758 <primary>IPv6</primary>
18759 <secondary>disabling</secondary>
18761 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
18762 run on a host whose kernel does not support IPv6. The binary will fall back to
18763 using IPv4, but it may waste resources looking up AAAA records, and trying to
18764 connect to IPv6 addresses, causing delays to mail delivery. If you set the
18765 <indexterm role="option">
18766 <primary><option>disable_ipv6</option></primary>
18768 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
18769 activities take place. AAAA records are never looked up, and any IPv6 addresses
18770 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
18771 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
18772 to handle IPv6 literal addresses.
18775 On the other hand, when IPv6 is in use, there may be times when you want to
18776 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
18777 option to globally suppress the lookup of AAAA records for specified domains,
18778 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
18779 IPv6 addresses in an individual router.
18782 <section id="SECID94">
18783 <title>Examples of starting a listening daemon</title>
18785 The default case in an IPv6 environment is
18787 <literallayout class="monospaced">
18788 daemon_smtp_ports = smtp
18789 local_interfaces = <; ::0 ; 0.0.0.0
18792 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
18793 Either one or two sockets may be used, depending on the characteristics of
18794 the TCP/IP stack. (This is complicated and messy; for more information,
18795 read the comments in the <filename>daemon.c</filename> source file.)
18798 To specify listening on ports 25 and 26 on all interfaces:
18800 <literallayout class="monospaced">
18801 daemon_smtp_ports = 25 : 26
18804 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
18806 <literallayout class="monospaced">
18807 local_interfaces = <; ::0.25 ; ::0.26 \
18808 0.0.0.0.25 ; 0.0.0.0.26
18811 To listen on the default port on all IPv4 interfaces, and on port 26 on the
18812 IPv4 loopback address only:
18814 <literallayout class="monospaced">
18815 local_interfaces = 0.0.0.0 : 127.0.0.1.26
18818 To specify listening on the default port on specific interfaces only:
18820 <literallayout class="monospaced">
18821 local_interfaces = 192.168.34.67 : 192.168.34.67
18824 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
18827 <section id="SECTreclocipadd">
18828 <title>Recognizing the local host</title>
18830 The <option>local_interfaces</option> option is also used when Exim needs to determine
18831 whether or not an IP address refers to the local host. That is, the IP
18832 addresses of all the interfaces on which a daemon is listening are always
18836 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
18837 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
18838 available interfaces from the operating system, and extracts the relevant
18839 (that is, IPv4 or IPv6) addresses to use for checking.
18842 Some systems set up large numbers of virtual interfaces in order to provide
18843 many virtual web servers. In this situation, you may want to listen for
18844 email on only a few of the available interfaces, but nevertheless treat all
18845 interfaces as local when routing. You can do this by setting
18846 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
18847 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
18848 used for listening. Consider this example:
18850 <literallayout class="monospaced">
18851 local_interfaces = <; 127.0.0.1 ; ::1 ; \
18853 3ffe:2101:12:1:a00:20ff:fe86:a061
18855 extra_local_interfaces = <; ::0 ; 0.0.0.0
18858 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
18859 address, but all available interface addresses are treated as local when
18863 In some environments the local host name may be in an MX list, but with an IP
18864 address that is not assigned to any local interface. In other cases it may be
18865 desirable to treat other host names as if they referred to the local host. Both
18866 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
18867 This contains host names rather than IP addresses. When a host is referenced
18868 during routing, either via an MX record or directly, it is treated as the local
18869 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
18870 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
18873 <section id="SECID95">
18874 <title>Delivering to a remote host</title>
18876 Delivery to a remote host is handled by the smtp transport. By default, it
18877 allows the system’s TCP/IP functions to choose which interface to use (if
18878 there is more than one) when connecting to a remote host. However, the
18879 <option>interface</option> option can be set to specify which interface is used. See the
18880 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
18886 <chapter id="CHAPmainconfig">
18887 <title>Main configuration</title>
18889 <indexterm role="concept" id="IIDconfima" class="startofrange">
18890 <primary>configuration file</primary>
18891 <secondary>main section</secondary>
18893 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
18894 <primary>main configuration</primary>
18896 The first part of the run time configuration file contains three types of item:
18901 Macro definitions: These lines start with an upper case letter. See section
18902 <xref linkend="SECTmacrodefs"/> for details of macro processing.
18907 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
18908 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
18909 section <xref linkend="SECTnamedlists"/>.
18914 Main configuration settings: Each setting occupies one line of the file
18915 (with possible continuations). If any setting is preceded by the word
18916 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
18917 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
18923 This chapter specifies all the main configuration options, along with their
18924 types and default values. For ease of finding a particular option, they appear
18925 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
18926 are now so many options, they are first listed briefly in functional groups, as
18927 an aid to finding the name of the option you are looking for. Some options are
18928 listed in more than one group.
18930 <section id="SECID96">
18931 <title>Miscellaneous</title>
18932 <informaltable frame="none">
18933 <tgroup cols="2" colsep="0" rowsep="0">
18934 <colspec colwidth="196pt" align="left"/>
18935 <colspec colwidth="254pt" align="left"/>
18938 <entry><option>bi_command</option></entry>
18939 <entry>to run for <option>-bi</option> command line option</entry>
18942 <entry><option>disable_ipv6</option></entry>
18943 <entry>do no IPv6 processing</entry>
18946 <entry><option>keep_malformed</option></entry>
18947 <entry>for broken files – should not happen</entry>
18950 <entry><option>localhost_number</option></entry>
18951 <entry>for unique message ids in clusters</entry>
18954 <entry><option>message_body_newlines</option></entry>
18955 <entry>retain newlines in <varname>$message_body</varname></entry>
18958 <entry><option>message_body_visible</option></entry>
18959 <entry>how much to show in <varname>$message_body</varname></entry>
18962 <entry><option>mua_wrapper</option></entry>
18963 <entry>run in <quote>MUA wrapper</quote> mode</entry>
18966 <entry><option>print_topbitchars</option></entry>
18967 <entry>top-bit characters are printing</entry>
18970 <entry><option>timezone</option></entry>
18971 <entry>force time zone</entry>
18977 <section id="SECID97">
18978 <title>Exim parameters</title>
18979 <informaltable frame="none">
18980 <tgroup cols="2" colsep="0" rowsep="0">
18981 <colspec colwidth="196pt" align="left"/>
18982 <colspec colwidth="254pt" align="left"/>
18985 <entry><option>exim_group</option></entry>
18986 <entry>override compiled-in value</entry>
18989 <entry><option>exim_path</option></entry>
18990 <entry>override compiled-in value</entry>
18993 <entry><option>exim_user</option></entry>
18994 <entry>override compiled-in value</entry>
18997 <entry><option>primary_hostname</option></entry>
18998 <entry>default from <function>uname()</function></entry>
19001 <entry><option>split_spool_directory</option></entry>
19002 <entry>use multiple directories</entry>
19005 <entry><option>spool_directory</option></entry>
19006 <entry>override compiled-in value</entry>
19012 <section id="SECID98">
19013 <title>Privilege controls</title>
19014 <informaltable frame="none">
19015 <tgroup cols="2" colsep="0" rowsep="0">
19016 <colspec colwidth="196pt" align="left"/>
19017 <colspec colwidth="254pt" align="left"/>
19020 <entry><option>admin_groups</option></entry>
19021 <entry>groups that are Exim admin users</entry>
19024 <entry><option>deliver_drop_privilege</option></entry>
19025 <entry>drop root for delivery processes</entry>
19028 <entry><option>local_from_check</option></entry>
19029 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
19032 <entry><option>local_from_prefix</option></entry>
19033 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
19036 <entry><option>local_from_suffix</option></entry>
19037 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
19040 <entry><option>local_sender_retain</option></entry>
19041 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
19044 <entry><option>never_users</option></entry>
19045 <entry>do not run deliveries as these</entry>
19048 <entry><option>prod_requires_admin</option></entry>
19049 <entry>forced delivery requires admin user</entry>
19052 <entry><option>queue_list_requires_admin</option></entry>
19053 <entry>queue listing requires admin user</entry>
19056 <entry><option>trusted_groups</option></entry>
19057 <entry>groups that are trusted</entry>
19060 <entry><option>trusted_users</option></entry>
19061 <entry>users that are trusted</entry>
19067 <section id="SECID99">
19068 <title>Logging</title>
19069 <informaltable frame="none">
19070 <tgroup cols="2" colsep="0" rowsep="0">
19071 <colspec colwidth="196pt" align="left"/>
19072 <colspec colwidth="254pt" align="left"/>
19075 <entry><option>hosts_connection_nolog</option></entry>
19076 <entry>exemption from connect logging</entry>
19079 <entry><option>log_file_path</option></entry>
19080 <entry>override compiled-in value</entry>
19083 <entry><option>log_selector</option></entry>
19084 <entry>set/unset optional logging</entry>
19087 <entry><option>log_timezone</option></entry>
19088 <entry>add timezone to log lines</entry>
19091 <entry><option>message_logs</option></entry>
19092 <entry>create per-message logs</entry>
19095 <entry><option>preserve_message_logs</option></entry>
19096 <entry>after message completion</entry>
19099 <entry><option>process_log_path</option></entry>
19100 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
19103 <entry><option>syslog_duplication</option></entry>
19104 <entry>controls duplicate log lines on syslog</entry>
19107 <entry><option>syslog_facility</option></entry>
19108 <entry>set syslog <quote>facility</quote> field</entry>
19111 <entry><option>syslog_processname</option></entry>
19112 <entry>set syslog <quote>ident</quote> field</entry>
19115 <entry><option>syslog_timestamp</option></entry>
19116 <entry>timestamp syslog lines</entry>
19119 <entry><option>write_rejectlog</option></entry>
19120 <entry>control use of message log</entry>
19126 <section id="SECID100">
19127 <title>Frozen messages</title>
19128 <informaltable frame="none">
19129 <tgroup cols="2" colsep="0" rowsep="0">
19130 <colspec colwidth="196pt" align="left"/>
19131 <colspec colwidth="254pt" align="left"/>
19134 <entry><option>auto_thaw</option></entry>
19135 <entry>sets time for retrying frozen messages</entry>
19138 <entry><option>freeze_tell</option></entry>
19139 <entry>send message when freezing</entry>
19142 <entry><option>move_frozen_messages</option></entry>
19143 <entry>to another directory</entry>
19146 <entry><option>timeout_frozen_after</option></entry>
19147 <entry>keep frozen messages only so long</entry>
19153 <section id="SECID101">
19154 <title>Data lookups</title>
19155 <informaltable frame="none">
19156 <tgroup cols="2" colsep="0" rowsep="0">
19157 <colspec colwidth="196pt" align="left"/>
19158 <colspec colwidth="254pt" align="left"/>
19161 <entry><option>ibase_servers</option></entry>
19162 <entry>InterBase servers</entry>
19165 <entry><option>ldap_default_servers</option></entry>
19166 <entry>used if no server in query</entry>
19169 <entry><option>ldap_version</option></entry>
19170 <entry>set protocol version</entry>
19173 <entry><option>lookup_open_max</option></entry>
19174 <entry>lookup files held open</entry>
19177 <entry><option>mysql_servers</option></entry>
19178 <entry>default MySQL servers</entry>
19181 <entry><option>oracle_servers</option></entry>
19182 <entry>Oracle servers</entry>
19185 <entry><option>pgsql_servers</option></entry>
19186 <entry>default PostgreSQL servers</entry>
19189 <entry><option>sqlite_lock_timeout</option></entry>
19190 <entry>as it says</entry>
19196 <section id="SECID102">
19197 <title>Message ids</title>
19198 <informaltable frame="none">
19199 <tgroup cols="2" colsep="0" rowsep="0">
19200 <colspec colwidth="196pt" align="left"/>
19201 <colspec colwidth="254pt" align="left"/>
19204 <entry><option>message_id_header_domain</option></entry>
19205 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
19208 <entry><option>message_id_header_text</option></entry>
19209 <entry>ditto</entry>
19215 <section id="SECID103">
19216 <title>Embedded Perl Startup</title>
19217 <informaltable frame="none">
19218 <tgroup cols="2" colsep="0" rowsep="0">
19219 <colspec colwidth="196pt" align="left"/>
19220 <colspec colwidth="254pt" align="left"/>
19223 <entry><option>perl_at_start</option></entry>
19224 <entry>always start the interpreter</entry>
19227 <entry><option>perl_startup</option></entry>
19228 <entry>code to obey when starting Perl</entry>
19234 <section id="SECID104">
19235 <title>Daemon</title>
19236 <informaltable frame="none">
19237 <tgroup cols="2" colsep="0" rowsep="0">
19238 <colspec colwidth="196pt" align="left"/>
19239 <colspec colwidth="254pt" align="left"/>
19242 <entry><option>daemon_smtp_ports</option></entry>
19243 <entry>default ports</entry>
19246 <entry><option>daemon_startup_retries</option></entry>
19247 <entry>number of times to retry</entry>
19250 <entry><option>daemon_startup_sleep</option></entry>
19251 <entry>time to sleep between tries</entry>
19254 <entry><option>extra_local_interfaces</option></entry>
19255 <entry>not necessarily listened on</entry>
19258 <entry><option>local_interfaces</option></entry>
19259 <entry>on which to listen, with optional ports</entry>
19262 <entry><option>pid_file_path</option></entry>
19263 <entry>override compiled-in value</entry>
19266 <entry><option>queue_run_max</option></entry>
19267 <entry>maximum simultaneous queue runners</entry>
19273 <section id="SECID105">
19274 <title>Resource control</title>
19275 <informaltable frame="none">
19276 <tgroup cols="2" colsep="0" rowsep="0">
19277 <colspec colwidth="196pt" align="left"/>
19278 <colspec colwidth="254pt" align="left"/>
19281 <entry><option>check_log_inodes</option></entry>
19282 <entry>before accepting a message</entry>
19285 <entry><option>check_log_space</option></entry>
19286 <entry>before accepting a message</entry>
19289 <entry><option>check_spool_inodes</option></entry>
19290 <entry>before accepting a message</entry>
19293 <entry><option>check_spool_space</option></entry>
19294 <entry>before accepting a message</entry>
19297 <entry><option>deliver_queue_load_max</option></entry>
19298 <entry>no queue deliveries if load high</entry>
19301 <entry><option>queue_only_load</option></entry>
19302 <entry>queue incoming if load high</entry>
19305 <entry><option>queue_only_load_latch</option></entry>
19306 <entry>don’t re-evaluate load for each message</entry>
19309 <entry><option>queue_run_max</option></entry>
19310 <entry>maximum simultaneous queue runners</entry>
19313 <entry><option>remote_max_parallel</option></entry>
19314 <entry>parallel SMTP delivery per message</entry>
19317 <entry><option>smtp_accept_max</option></entry>
19318 <entry>simultaneous incoming connections</entry>
19321 <entry><option>smtp_accept_max_nonmail</option></entry>
19322 <entry>non-mail commands</entry>
19325 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
19326 <entry>hosts to which the limit applies</entry>
19329 <entry><option>smtp_accept_max_per_connection</option></entry>
19330 <entry>messages per connection</entry>
19333 <entry><option>smtp_accept_max_per_host</option></entry>
19334 <entry>connections from one host</entry>
19337 <entry><option>smtp_accept_queue</option></entry>
19338 <entry>queue mail if more connections</entry>
19341 <entry><option>smtp_accept_queue_per_connection</option></entry>
19342 <entry>queue if more messages per connection</entry>
19345 <entry><option>smtp_accept_reserve</option></entry>
19346 <entry>only reserve hosts if more connections</entry>
19349 <entry><option>smtp_check_spool_space</option></entry>
19350 <entry>from SIZE on MAIL command</entry>
19353 <entry><option>smtp_connect_backlog</option></entry>
19354 <entry>passed to TCP/IP stack</entry>
19357 <entry><option>smtp_load_reserve</option></entry>
19358 <entry>SMTP from reserved hosts if load high</entry>
19361 <entry><option>smtp_reserve_hosts</option></entry>
19362 <entry>these are the reserve hosts</entry>
19368 <section id="SECID106">
19369 <title>Policy controls</title>
19370 <informaltable frame="none">
19371 <tgroup cols="2" colsep="0" rowsep="0">
19372 <colspec colwidth="196pt" align="left"/>
19373 <colspec colwidth="254pt" align="left"/>
19376 <entry><option>acl_not_smtp</option></entry>
19377 <entry>ACL for non-SMTP messages</entry>
19380 <entry><option>acl_not_smtp_mime</option></entry>
19381 <entry>ACL for non-SMTP MIME parts</entry>
19384 <entry><option>acl_not_smtp_start</option></entry>
19385 <entry>ACL for start of non-SMTP message</entry>
19388 <entry><option>acl_smtp_auth</option></entry>
19389 <entry>ACL for AUTH</entry>
19392 <entry><option>acl_smtp_connect</option></entry>
19393 <entry>ACL for connection</entry>
19396 <entry><option>acl_smtp_data</option></entry>
19397 <entry>ACL for DATA</entry>
19400 <entry><option>acl_smtp_dkim</option></entry>
19401 <entry>ACL for DKIM verification</entry>
19404 <entry><option>acl_smtp_etrn</option></entry>
19405 <entry>ACL for ETRN</entry>
19408 <entry><option>acl_smtp_expn</option></entry>
19409 <entry>ACL for EXPN</entry>
19412 <entry><option>acl_smtp_helo</option></entry>
19413 <entry>ACL for EHLO or HELO</entry>
19416 <entry><option>acl_smtp_mail</option></entry>
19417 <entry>ACL for MAIL</entry>
19420 <entry><option>acl_smtp_mailauth</option></entry>
19421 <entry>ACL for AUTH on MAIL command</entry>
19424 <entry><option>acl_smtp_mime</option></entry>
19425 <entry>ACL for MIME parts</entry>
19428 <entry><option>acl_smtp_predata</option></entry>
19429 <entry>ACL for start of data</entry>
19432 <entry><option>acl_smtp_quit</option></entry>
19433 <entry>ACL for QUIT</entry>
19436 <entry><option>acl_smtp_rcpt</option></entry>
19437 <entry>ACL for RCPT</entry>
19440 <entry><option>acl_smtp_starttls</option></entry>
19441 <entry>ACL for STARTTLS</entry>
19444 <entry><option>acl_smtp_vrfy</option></entry>
19445 <entry>ACL for VRFY</entry>
19448 <entry><option>av_scanner</option></entry>
19449 <entry>specify virus scanner</entry>
19452 <entry><option>check_rfc2047_length</option></entry>
19453 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
19456 <entry><option>dns_csa_search_limit</option></entry>
19457 <entry>control CSA parent search depth</entry>
19460 <entry><option>dns_csa_use_reverse</option></entry>
19461 <entry>en/disable CSA IP reverse search</entry>
19464 <entry><option>header_maxsize</option></entry>
19465 <entry>total size of message header</entry>
19468 <entry><option>header_line_maxsize</option></entry>
19469 <entry>individual header line limit</entry>
19472 <entry><option>helo_accept_junk_hosts</option></entry>
19473 <entry>allow syntactic junk from these hosts</entry>
19476 <entry><option>helo_allow_chars</option></entry>
19477 <entry>allow illegal chars in HELO names</entry>
19480 <entry><option>helo_lookup_domains</option></entry>
19481 <entry>lookup hostname for these HELO names</entry>
19484 <entry><option>helo_try_verify_hosts</option></entry>
19485 <entry>HELO soft-checked for these hosts</entry>
19488 <entry><option>helo_verify_hosts</option></entry>
19489 <entry>HELO hard-checked for these hosts</entry>
19492 <entry><option>host_lookup</option></entry>
19493 <entry>host name looked up for these hosts</entry>
19496 <entry><option>host_lookup_order</option></entry>
19497 <entry>order of DNS and local name lookups</entry>
19500 <entry><option>host_reject_connection</option></entry>
19501 <entry>reject connection from these hosts</entry>
19504 <entry><option>hosts_treat_as_local</option></entry>
19505 <entry>useful in some cluster configurations</entry>
19508 <entry><option>local_scan_timeout</option></entry>
19509 <entry>timeout for <function>local_scan()</function></entry>
19512 <entry><option>message_size_limit</option></entry>
19513 <entry>for all messages</entry>
19516 <entry><option>percent_hack_domains</option></entry>
19517 <entry>recognize %-hack for these domains</entry>
19520 <entry><option>spamd_address</option></entry>
19521 <entry>set interface to SpamAssassin</entry>
19524 <entry><option>strict_acl_vars</option></entry>
19525 <entry>object to unset ACL variables</entry>
19531 <section id="SECID107">
19532 <title>Callout cache</title>
19533 <informaltable frame="none">
19534 <tgroup cols="2" colsep="0" rowsep="0">
19535 <colspec colwidth="196pt" align="left"/>
19536 <colspec colwidth="254pt" align="left"/>
19539 <entry><option>callout_domain_negative_expire</option></entry>
19540 <entry>timeout for negative domain cache item</entry>
19543 <entry><option>callout_domain_positive_expire</option></entry>
19544 <entry>timeout for positive domain cache item</entry>
19547 <entry><option>callout_negative_expire</option></entry>
19548 <entry>timeout for negative address cache item</entry>
19551 <entry><option>callout_positive_expire</option></entry>
19552 <entry>timeout for positive address cache item</entry>
19555 <entry><option>callout_random_local_part</option></entry>
19556 <entry>string to use for <quote>random</quote> testing</entry>
19562 <section id="SECID108">
19564 <informaltable frame="none">
19565 <tgroup cols="2" colsep="0" rowsep="0">
19566 <colspec colwidth="196pt" align="left"/>
19567 <colspec colwidth="254pt" align="left"/>
19570 <entry><option>gnutls_require_kx</option></entry>
19571 <entry>control GnuTLS key exchanges</entry>
19574 <entry><option>gnutls_require_mac</option></entry>
19575 <entry>control GnuTLS MAC algorithms</entry>
19578 <entry><option>gnutls_require_protocols</option></entry>
19579 <entry>control GnuTLS protocols</entry>
19582 <entry><option>gnutls_compat_mode</option></entry>
19583 <entry>use GnuTLS compatibility mode</entry>
19586 <entry><option>openssl_options</option></entry>
19587 <entry>adjust OpenSSL compatibility options</entry>
19590 <entry><option>tls_advertise_hosts</option></entry>
19591 <entry>advertise TLS to these hosts</entry>
19594 <entry><option>tls_certificate</option></entry>
19595 <entry>location of server certificate</entry>
19598 <entry><option>tls_crl</option></entry>
19599 <entry>certificate revocation list</entry>
19602 <entry><option>tls_dhparam</option></entry>
19603 <entry>DH parameters for server</entry>
19606 <entry><option>tls_on_connect_ports</option></entry>
19607 <entry>specify SSMTP (SMTPS) ports</entry>
19610 <entry><option>tls_privatekey</option></entry>
19611 <entry>location of server private key</entry>
19614 <entry><option>tls_remember_esmtp</option></entry>
19615 <entry>don’t reset after starting TLS</entry>
19618 <entry><option>tls_require_ciphers</option></entry>
19619 <entry>specify acceptable ciphers</entry>
19622 <entry><option>tls_try_verify_hosts</option></entry>
19623 <entry>try to verify client certificate</entry>
19626 <entry><option>tls_verify_certificates</option></entry>
19627 <entry>expected client certificates</entry>
19630 <entry><option>tls_verify_hosts</option></entry>
19631 <entry>insist on client certificate verify</entry>
19637 <section id="SECID109">
19638 <title>Local user handling</title>
19639 <informaltable frame="none">
19640 <tgroup cols="2" colsep="0" rowsep="0">
19641 <colspec colwidth="196pt" align="left"/>
19642 <colspec colwidth="254pt" align="left"/>
19645 <entry><option>finduser_retries</option></entry>
19646 <entry>useful in NIS environments</entry>
19649 <entry><option>gecos_name</option></entry>
19650 <entry>used when creating <emphasis>Sender:</emphasis></entry>
19653 <entry><option>gecos_pattern</option></entry>
19654 <entry>ditto</entry>
19657 <entry><option>max_username_length</option></entry>
19658 <entry>for systems that truncate</entry>
19661 <entry><option>unknown_login</option></entry>
19662 <entry>used when no login name found</entry>
19665 <entry><option>unknown_username</option></entry>
19666 <entry>ditto</entry>
19669 <entry><option>uucp_from_pattern</option></entry>
19670 <entry>for recognizing <quote>From </quote> lines</entry>
19673 <entry><option>uucp_from_sender</option></entry>
19674 <entry>ditto</entry>
19680 <section id="SECID110">
19681 <title>All incoming messages (SMTP and non-SMTP)</title>
19682 <informaltable frame="none">
19683 <tgroup cols="2" colsep="0" rowsep="0">
19684 <colspec colwidth="196pt" align="left"/>
19685 <colspec colwidth="254pt" align="left"/>
19688 <entry><option>header_maxsize</option></entry>
19689 <entry>total size of message header</entry>
19692 <entry><option>header_line_maxsize</option></entry>
19693 <entry>individual header line limit</entry>
19696 <entry><option>message_size_limit</option></entry>
19697 <entry>applies to all messages</entry>
19700 <entry><option>percent_hack_domains</option></entry>
19701 <entry>recognize %-hack for these domains</entry>
19704 <entry><option>received_header_text</option></entry>
19705 <entry>expanded to make <emphasis>Received:</emphasis></entry>
19708 <entry><option>received_headers_max</option></entry>
19709 <entry>for mail loop detection</entry>
19712 <entry><option>recipients_max</option></entry>
19713 <entry>limit per message</entry>
19716 <entry><option>recipients_max_reject</option></entry>
19717 <entry>permanently reject excess recipients</entry>
19723 <section id="SECID111">
19724 <title>Non-SMTP incoming messages</title>
19725 <informaltable frame="none">
19726 <tgroup cols="2" colsep="0" rowsep="0">
19727 <colspec colwidth="196pt" align="left"/>
19728 <colspec colwidth="254pt" align="left"/>
19731 <entry><option>receive_timeout</option></entry>
19732 <entry>for non-SMTP messages</entry>
19738 <section id="SECID112">
19739 <title>Incoming SMTP messages</title>
19741 See also the <emphasis>Policy controls</emphasis> section above.
19743 <informaltable frame="none">
19744 <tgroup cols="2" colsep="0" rowsep="0">
19745 <colspec colwidth="196pt" align="left"/>
19746 <colspec colwidth="254pt" align="left"/>
19749 <entry><option>host_lookup</option></entry>
19750 <entry>host name looked up for these hosts</entry>
19753 <entry><option>host_lookup_order</option></entry>
19754 <entry>order of DNS and local name lookups</entry>
19757 <entry><option>recipient_unqualified_hosts</option></entry>
19758 <entry>may send unqualified recipients</entry>
19761 <entry><option>rfc1413_hosts</option></entry>
19762 <entry>make ident calls to these hosts</entry>
19765 <entry><option>rfc1413_query_timeout</option></entry>
19766 <entry>zero disables ident calls</entry>
19769 <entry><option>sender_unqualified_hosts</option></entry>
19770 <entry>may send unqualified senders</entry>
19773 <entry><option>smtp_accept_keepalive</option></entry>
19774 <entry>some TCP/IP magic</entry>
19777 <entry><option>smtp_accept_max</option></entry>
19778 <entry>simultaneous incoming connections</entry>
19781 <entry><option>smtp_accept_max_nonmail</option></entry>
19782 <entry>non-mail commands</entry>
19785 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
19786 <entry>hosts to which the limit applies</entry>
19789 <entry><option>smtp_accept_max_per_connection</option></entry>
19790 <entry>messages per connection</entry>
19793 <entry><option>smtp_accept_max_per_host</option></entry>
19794 <entry>connections from one host</entry>
19797 <entry><option>smtp_accept_queue</option></entry>
19798 <entry>queue mail if more connections</entry>
19801 <entry><option>smtp_accept_queue_per_connection</option></entry>
19802 <entry>queue if more messages per connection</entry>
19805 <entry><option>smtp_accept_reserve</option></entry>
19806 <entry>only reserve hosts if more connections</entry>
19809 <entry><option>smtp_active_hostname</option></entry>
19810 <entry>host name to use in messages</entry>
19813 <entry><option>smtp_banner</option></entry>
19814 <entry>text for welcome banner</entry>
19817 <entry><option>smtp_check_spool_space</option></entry>
19818 <entry>from SIZE on MAIL command</entry>
19821 <entry><option>smtp_connect_backlog</option></entry>
19822 <entry>passed to TCP/IP stack</entry>
19825 <entry><option>smtp_enforce_sync</option></entry>
19826 <entry>of SMTP command/responses</entry>
19829 <entry><option>smtp_etrn_command</option></entry>
19830 <entry>what to run for ETRN</entry>
19833 <entry><option>smtp_etrn_serialize</option></entry>
19834 <entry>only one at once</entry>
19837 <entry><option>smtp_load_reserve</option></entry>
19838 <entry>only reserve hosts if this load</entry>
19841 <entry><option>smtp_max_unknown_commands</option></entry>
19842 <entry>before dropping connection</entry>
19845 <entry><option>smtp_ratelimit_hosts</option></entry>
19846 <entry>apply ratelimiting to these hosts</entry>
19849 <entry><option>smtp_ratelimit_mail</option></entry>
19850 <entry>ratelimit for MAIL commands</entry>
19853 <entry><option>smtp_ratelimit_rcpt</option></entry>
19854 <entry>ratelimit for RCPT commands</entry>
19857 <entry><option>smtp_receive_timeout</option></entry>
19858 <entry>per command or data line</entry>
19861 <entry><option>smtp_reserve_hosts</option></entry>
19862 <entry>these are the reserve hosts</entry>
19865 <entry><option>smtp_return_error_details</option></entry>
19866 <entry>give detail on rejections</entry>
19872 <section id="SECID113">
19873 <title>SMTP extensions</title>
19874 <informaltable frame="none">
19875 <tgroup cols="2" colsep="0" rowsep="0">
19876 <colspec colwidth="196pt" align="left"/>
19877 <colspec colwidth="254pt" align="left"/>
19880 <entry><option>accept_8bitmime</option></entry>
19881 <entry>advertise 8BITMIME</entry>
19884 <entry><option>auth_advertise_hosts</option></entry>
19885 <entry>advertise AUTH to these hosts</entry>
19888 <entry><option>ignore_fromline_hosts</option></entry>
19889 <entry>allow <quote>From </quote> from these hosts</entry>
19892 <entry><option>ignore_fromline_local</option></entry>
19893 <entry>allow <quote>From </quote> from local SMTP</entry>
19896 <entry><option>pipelining_advertise_hosts</option></entry>
19897 <entry>advertise pipelining to these hosts</entry>
19900 <entry><option>tls_advertise_hosts</option></entry>
19901 <entry>advertise TLS to these hosts</entry>
19907 <section id="SECID114">
19908 <title>Processing messages</title>
19909 <informaltable frame="none">
19910 <tgroup cols="2" colsep="0" rowsep="0">
19911 <colspec colwidth="196pt" align="left"/>
19912 <colspec colwidth="254pt" align="left"/>
19915 <entry><option>allow_domain_literals</option></entry>
19916 <entry>recognize domain literal syntax</entry>
19919 <entry><option>allow_mx_to_ip</option></entry>
19920 <entry>allow MX to point to IP address</entry>
19923 <entry><option>allow_utf8_domains</option></entry>
19924 <entry>in addresses</entry>
19927 <entry><option>check_rfc2047_length</option></entry>
19928 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
19931 <entry><option>delivery_date_remove</option></entry>
19932 <entry>from incoming messages</entry>
19935 <entry><option>envelope_to_remove</option></entry>
19936 <entry>from incoming messages</entry>
19939 <entry><option>extract_addresses_remove_arguments</option></entry>
19940 <entry>affects <option>-t</option> processing</entry>
19943 <entry><option>headers_charset</option></entry>
19944 <entry>default for translations</entry>
19947 <entry><option>qualify_domain</option></entry>
19948 <entry>default for senders</entry>
19951 <entry><option>qualify_recipient</option></entry>
19952 <entry>default for recipients</entry>
19955 <entry><option>return_path_remove</option></entry>
19956 <entry>from incoming messages</entry>
19959 <entry><option>strip_excess_angle_brackets</option></entry>
19960 <entry>in addresses</entry>
19963 <entry><option>strip_trailing_dot</option></entry>
19964 <entry>at end of addresses</entry>
19967 <entry><option>untrusted_set_sender</option></entry>
19968 <entry>untrusted can set envelope sender</entry>
19974 <section id="SECID115">
19975 <title>System filter</title>
19976 <informaltable frame="none">
19977 <tgroup cols="2" colsep="0" rowsep="0">
19978 <colspec colwidth="196pt" align="left"/>
19979 <colspec colwidth="254pt" align="left"/>
19982 <entry><option>system_filter</option></entry>
19983 <entry>locate system filter</entry>
19986 <entry><option>system_filter_directory_transport</option></entry>
19987 <entry>transport for delivery to a directory</entry>
19990 <entry><option>system_filter_file_transport</option></entry>
19991 <entry>transport for delivery to a file</entry>
19994 <entry><option>system_filter_group</option></entry>
19995 <entry>group for filter running</entry>
19998 <entry><option>system_filter_pipe_transport</option></entry>
19999 <entry>transport for delivery to a pipe</entry>
20002 <entry><option>system_filter_reply_transport</option></entry>
20003 <entry>transport for autoreply delivery</entry>
20006 <entry><option>system_filter_user</option></entry>
20007 <entry>user for filter running</entry>
20013 <section id="SECID116">
20014 <title>Routing and delivery</title>
20015 <informaltable frame="none">
20016 <tgroup cols="2" colsep="0" rowsep="0">
20017 <colspec colwidth="196pt" align="left"/>
20018 <colspec colwidth="254pt" align="left"/>
20021 <entry><option>disable_ipv6</option></entry>
20022 <entry>do no IPv6 processing</entry>
20025 <entry><option>dns_again_means_nonexist</option></entry>
20026 <entry>for broken domains</entry>
20029 <entry><option>dns_check_names_pattern</option></entry>
20030 <entry>pre-DNS syntax check</entry>
20033 <entry><option>dns_ipv4_lookup</option></entry>
20034 <entry>only v4 lookup for these domains</entry>
20037 <entry><option>dns_retrans</option></entry>
20038 <entry>parameter for resolver</entry>
20041 <entry><option>dns_retry</option></entry>
20042 <entry>parameter for resolver</entry>
20045 <entry><option>hold_domains</option></entry>
20046 <entry>hold delivery for these domains</entry>
20049 <entry><option>local_interfaces</option></entry>
20050 <entry>for routing checks</entry>
20053 <entry><option>queue_domains</option></entry>
20054 <entry>no immediate delivery for these</entry>
20057 <entry><option>queue_only</option></entry>
20058 <entry>no immediate delivery at all</entry>
20061 <entry><option>queue_only_file</option></entry>
20062 <entry>no immediate delivery if file exists</entry>
20065 <entry><option>queue_only_load</option></entry>
20066 <entry>no immediate delivery if load is high</entry>
20069 <entry><option>queue_only_load_latch</option></entry>
20070 <entry>don’t re-evaluate load for each message</entry>
20073 <entry><option>queue_only_override</option></entry>
20074 <entry>allow command line to override</entry>
20077 <entry><option>queue_run_in_order</option></entry>
20078 <entry>order of arrival</entry>
20081 <entry><option>queue_run_max</option></entry>
20082 <entry>of simultaneous queue runners</entry>
20085 <entry><option>queue_smtp_domains</option></entry>
20086 <entry>no immediate SMTP delivery for these</entry>
20089 <entry><option>remote_max_parallel</option></entry>
20090 <entry>parallel SMTP delivery per message</entry>
20093 <entry><option>remote_sort_domains</option></entry>
20094 <entry>order of remote deliveries</entry>
20097 <entry><option>retry_data_expire</option></entry>
20098 <entry>timeout for retry data</entry>
20101 <entry><option>retry_interval_max</option></entry>
20102 <entry>safety net for retry rules</entry>
20108 <section id="SECID117">
20109 <title>Bounce and warning messages</title>
20110 <informaltable frame="none">
20111 <tgroup cols="2" colsep="0" rowsep="0">
20112 <colspec colwidth="196pt" align="left"/>
20113 <colspec colwidth="254pt" align="left"/>
20116 <entry><option>bounce_message_file</option></entry>
20117 <entry>content of bounce</entry>
20120 <entry><option>bounce_message_text</option></entry>
20121 <entry>content of bounce</entry>
20124 <entry><option>bounce_return_body</option></entry>
20125 <entry>include body if returning message</entry>
20128 <entry><option>bounce_return_message</option></entry>
20129 <entry>include original message in bounce</entry>
20132 <entry><option>bounce_return_size_limit</option></entry>
20133 <entry>limit on returned message</entry>
20136 <entry><option>bounce_sender_authentication</option></entry>
20137 <entry>send authenticated sender with bounce</entry>
20140 <entry><option>dsn_from</option></entry>
20141 <entry>set <emphasis>From:</emphasis> contents in bounces</entry>
20144 <entry><option>errors_copy</option></entry>
20145 <entry>copy bounce messages</entry>
20148 <entry><option>errors_reply_to</option></entry>
20149 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
20152 <entry><option>delay_warning</option></entry>
20153 <entry>time schedule</entry>
20156 <entry><option>delay_warning_condition</option></entry>
20157 <entry>condition for warning messages</entry>
20160 <entry><option>ignore_bounce_errors_after</option></entry>
20161 <entry>discard undeliverable bounces</entry>
20164 <entry><option>smtp_return_error_details</option></entry>
20165 <entry>give detail on rejections</entry>
20168 <entry><option>warn_message_file</option></entry>
20169 <entry>content of warning message</entry>
20175 <section id="SECTalomo">
20176 <title>Alphabetical list of main options</title>
20178 Those options that undergo string expansion before use are marked with
20182 <indexterm role="option">
20183 <primary><option>accept_8bitmime</option></primary>
20186 <informaltable frame="all">
20187 <tgroup cols="4" colsep="0" rowsep="0">
20188 <colspec colwidth="8*" align="left"/>
20189 <colspec colwidth="6*" align="center"/>
20190 <colspec colwidth="6*" align="center"/>
20191 <colspec colwidth="6*" align="right"/>
20194 <entry><option>accept_8bitmime</option></entry>
20195 <entry>Use: <emphasis>main</emphasis></entry>
20196 <entry>Type: <emphasis>boolean</emphasis></entry>
20197 <entry>Default: <emphasis>false</emphasis></entry>
20203 <indexterm role="concept">
20204 <primary>8BITMIME</primary>
20206 <indexterm role="concept">
20207 <primary>8-bit characters</primary>
20209 This option causes Exim to send 8BITMIME in its response to an SMTP
20210 EHLO command, and to accept the BODY= parameter on MAIL commands.
20211 However, though Exim is 8-bit clean, it is not a protocol converter, and it
20212 takes no steps to do anything special with messages received by this route.
20213 Consequently, this option is turned off by default.
20216 <indexterm role="option">
20217 <primary><option>acl_not_smtp</option></primary>
20220 <informaltable frame="all">
20221 <tgroup cols="4" colsep="0" rowsep="0">
20222 <colspec colwidth="8*" align="left"/>
20223 <colspec colwidth="6*" align="center"/>
20224 <colspec colwidth="6*" align="center"/>
20225 <colspec colwidth="6*" align="right"/>
20228 <entry><option>acl_not_smtp</option></entry>
20229 <entry>Use: <emphasis>main</emphasis></entry>
20230 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20231 <entry>Default: <emphasis>unset</emphasis></entry>
20237 <indexterm role="concept">
20238 <primary>access control lists (ACLs)</primary>
20239 <secondary>for non-SMTP messages</secondary>
20241 <indexterm role="concept">
20242 <primary>non-SMTP messages</primary>
20243 <secondary>ACLs for</secondary>
20245 This option defines the ACL that is run when a non-SMTP message has been
20246 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
20250 <indexterm role="option">
20251 <primary><option>acl_not_smtp_mime</option></primary>
20254 <informaltable frame="all">
20255 <tgroup cols="4" colsep="0" rowsep="0">
20256 <colspec colwidth="8*" align="left"/>
20257 <colspec colwidth="6*" align="center"/>
20258 <colspec colwidth="6*" align="center"/>
20259 <colspec colwidth="6*" align="right"/>
20262 <entry><option>acl_not_smtp_mime</option></entry>
20263 <entry>Use: <emphasis>main</emphasis></entry>
20264 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20265 <entry>Default: <emphasis>unset</emphasis></entry>
20271 This option defines the ACL that is run for individual MIME parts of non-SMTP
20272 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
20276 <indexterm role="option">
20277 <primary><option>acl_not_smtp_start</option></primary>
20280 <informaltable frame="all">
20281 <tgroup cols="4" colsep="0" rowsep="0">
20282 <colspec colwidth="8*" align="left"/>
20283 <colspec colwidth="6*" align="center"/>
20284 <colspec colwidth="6*" align="center"/>
20285 <colspec colwidth="6*" align="right"/>
20288 <entry><option>acl_not_smtp_start</option></entry>
20289 <entry>Use: <emphasis>main</emphasis></entry>
20290 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20291 <entry>Default: <emphasis>unset</emphasis></entry>
20297 <indexterm role="concept">
20298 <primary>access control lists (ACLs)</primary>
20299 <secondary>at start of non-SMTP message</secondary>
20301 <indexterm role="concept">
20302 <primary>non-SMTP messages</primary>
20303 <secondary>ACLs for</secondary>
20305 This option defines the ACL that is run before Exim starts reading a
20306 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
20309 <indexterm role="option">
20310 <primary><option>acl_smtp_auth</option></primary>
20313 <informaltable frame="all">
20314 <tgroup cols="4" colsep="0" rowsep="0">
20315 <colspec colwidth="8*" align="left"/>
20316 <colspec colwidth="6*" align="center"/>
20317 <colspec colwidth="6*" align="center"/>
20318 <colspec colwidth="6*" align="right"/>
20321 <entry><option>acl_smtp_auth</option></entry>
20322 <entry>Use: <emphasis>main</emphasis></entry>
20323 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20324 <entry>Default: <emphasis>unset</emphasis></entry>
20330 <indexterm role="concept">
20331 <primary>access control lists (ACLs)</primary>
20332 <secondary>setting up for SMTP commands</secondary>
20334 <indexterm role="concept">
20335 <primary>AUTH</primary>
20336 <secondary>ACL for</secondary>
20338 This option defines the ACL that is run when an SMTP AUTH command is
20339 received. See chapter <xref linkend="CHAPACL"/> for further details.
20342 <indexterm role="option">
20343 <primary><option>acl_smtp_connect</option></primary>
20346 <informaltable frame="all">
20347 <tgroup cols="4" colsep="0" rowsep="0">
20348 <colspec colwidth="8*" align="left"/>
20349 <colspec colwidth="6*" align="center"/>
20350 <colspec colwidth="6*" align="center"/>
20351 <colspec colwidth="6*" align="right"/>
20354 <entry><option>acl_smtp_connect</option></entry>
20355 <entry>Use: <emphasis>main</emphasis></entry>
20356 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20357 <entry>Default: <emphasis>unset</emphasis></entry>
20363 <indexterm role="concept">
20364 <primary>access control lists (ACLs)</primary>
20365 <secondary>on SMTP connection</secondary>
20367 This option defines the ACL that is run when an SMTP connection is received.
20368 See chapter <xref linkend="CHAPACL"/> for further details.
20371 <indexterm role="option">
20372 <primary><option>acl_smtp_data</option></primary>
20375 <informaltable frame="all">
20376 <tgroup cols="4" colsep="0" rowsep="0">
20377 <colspec colwidth="8*" align="left"/>
20378 <colspec colwidth="6*" align="center"/>
20379 <colspec colwidth="6*" align="center"/>
20380 <colspec colwidth="6*" align="right"/>
20383 <entry><option>acl_smtp_data</option></entry>
20384 <entry>Use: <emphasis>main</emphasis></entry>
20385 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20386 <entry>Default: <emphasis>unset</emphasis></entry>
20392 <indexterm role="concept">
20393 <primary>DATA</primary>
20394 <secondary>ACL for</secondary>
20396 This option defines the ACL that is run after an SMTP DATA command has been
20397 processed and the message itself has been received, but before the final
20398 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
20401 <indexterm role="option">
20402 <primary><option>acl_smtp_etrn</option></primary>
20405 <informaltable frame="all">
20406 <tgroup cols="4" colsep="0" rowsep="0">
20407 <colspec colwidth="8*" align="left"/>
20408 <colspec colwidth="6*" align="center"/>
20409 <colspec colwidth="6*" align="center"/>
20410 <colspec colwidth="6*" align="right"/>
20413 <entry><option>acl_smtp_etrn</option></entry>
20414 <entry>Use: <emphasis>main</emphasis></entry>
20415 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20416 <entry>Default: <emphasis>unset</emphasis></entry>
20422 <indexterm role="concept">
20423 <primary>ETRN</primary>
20424 <secondary>ACL for</secondary>
20426 This option defines the ACL that is run when an SMTP ETRN command is
20427 received. See chapter <xref linkend="CHAPACL"/> for further details.
20430 <indexterm role="option">
20431 <primary><option>acl_smtp_expn</option></primary>
20434 <informaltable frame="all">
20435 <tgroup cols="4" colsep="0" rowsep="0">
20436 <colspec colwidth="8*" align="left"/>
20437 <colspec colwidth="6*" align="center"/>
20438 <colspec colwidth="6*" align="center"/>
20439 <colspec colwidth="6*" align="right"/>
20442 <entry><option>acl_smtp_expn</option></entry>
20443 <entry>Use: <emphasis>main</emphasis></entry>
20444 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20445 <entry>Default: <emphasis>unset</emphasis></entry>
20451 <indexterm role="concept">
20452 <primary>EXPN</primary>
20453 <secondary>ACL for</secondary>
20455 This option defines the ACL that is run when an SMTP EXPN command is
20456 received. See chapter <xref linkend="CHAPACL"/> for further details.
20459 <indexterm role="option">
20460 <primary><option>acl_smtp_helo</option></primary>
20463 <informaltable frame="all">
20464 <tgroup cols="4" colsep="0" rowsep="0">
20465 <colspec colwidth="8*" align="left"/>
20466 <colspec colwidth="6*" align="center"/>
20467 <colspec colwidth="6*" align="center"/>
20468 <colspec colwidth="6*" align="right"/>
20471 <entry><option>acl_smtp_helo</option></entry>
20472 <entry>Use: <emphasis>main</emphasis></entry>
20473 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20474 <entry>Default: <emphasis>unset</emphasis></entry>
20480 <indexterm role="concept">
20481 <primary>EHLO</primary>
20482 <secondary>ACL for</secondary>
20484 <indexterm role="concept">
20485 <primary>HELO</primary>
20486 <secondary>ACL for</secondary>
20488 This option defines the ACL that is run when an SMTP EHLO or HELO
20489 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
20492 <indexterm role="option">
20493 <primary><option>acl_smtp_mail</option></primary>
20496 <informaltable frame="all">
20497 <tgroup cols="4" colsep="0" rowsep="0">
20498 <colspec colwidth="8*" align="left"/>
20499 <colspec colwidth="6*" align="center"/>
20500 <colspec colwidth="6*" align="center"/>
20501 <colspec colwidth="6*" align="right"/>
20504 <entry><option>acl_smtp_mail</option></entry>
20505 <entry>Use: <emphasis>main</emphasis></entry>
20506 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20507 <entry>Default: <emphasis>unset</emphasis></entry>
20513 <indexterm role="concept">
20514 <primary>MAIL</primary>
20515 <secondary>ACL for</secondary>
20517 This option defines the ACL that is run when an SMTP MAIL command is
20518 received. See chapter <xref linkend="CHAPACL"/> for further details.
20521 <indexterm role="option">
20522 <primary><option>acl_smtp_mailauth</option></primary>
20525 <informaltable frame="all">
20526 <tgroup cols="4" colsep="0" rowsep="0">
20527 <colspec colwidth="8*" align="left"/>
20528 <colspec colwidth="6*" align="center"/>
20529 <colspec colwidth="6*" align="center"/>
20530 <colspec colwidth="6*" align="right"/>
20533 <entry><option>acl_smtp_mailauth</option></entry>
20534 <entry>Use: <emphasis>main</emphasis></entry>
20535 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20536 <entry>Default: <emphasis>unset</emphasis></entry>
20542 <indexterm role="concept">
20543 <primary>AUTH</primary>
20544 <secondary>on MAIL command</secondary>
20546 This option defines the ACL that is run when there is an AUTH parameter on
20547 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
20548 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
20551 <indexterm role="option">
20552 <primary><option>acl_smtp_mime</option></primary>
20555 <informaltable frame="all">
20556 <tgroup cols="4" colsep="0" rowsep="0">
20557 <colspec colwidth="8*" align="left"/>
20558 <colspec colwidth="6*" align="center"/>
20559 <colspec colwidth="6*" align="center"/>
20560 <colspec colwidth="6*" align="right"/>
20563 <entry><option>acl_smtp_mime</option></entry>
20564 <entry>Use: <emphasis>main</emphasis></entry>
20565 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20566 <entry>Default: <emphasis>unset</emphasis></entry>
20572 <indexterm role="concept">
20573 <primary>MIME content scanning</primary>
20574 <secondary>ACL for</secondary>
20576 This option is available when Exim is built with the content-scanning
20577 extension. It defines the ACL that is run for each MIME part in a message. See
20578 section <xref linkend="SECTscanmimepart"/> for details.
20581 <indexterm role="option">
20582 <primary><option>acl_smtp_predata</option></primary>
20585 <informaltable frame="all">
20586 <tgroup cols="4" colsep="0" rowsep="0">
20587 <colspec colwidth="8*" align="left"/>
20588 <colspec colwidth="6*" align="center"/>
20589 <colspec colwidth="6*" align="center"/>
20590 <colspec colwidth="6*" align="right"/>
20593 <entry><option>acl_smtp_predata</option></entry>
20594 <entry>Use: <emphasis>main</emphasis></entry>
20595 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20596 <entry>Default: <emphasis>unset</emphasis></entry>
20602 This option defines the ACL that is run when an SMTP DATA command is
20603 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
20607 <indexterm role="option">
20608 <primary><option>acl_smtp_quit</option></primary>
20611 <informaltable frame="all">
20612 <tgroup cols="4" colsep="0" rowsep="0">
20613 <colspec colwidth="8*" align="left"/>
20614 <colspec colwidth="6*" align="center"/>
20615 <colspec colwidth="6*" align="center"/>
20616 <colspec colwidth="6*" align="right"/>
20619 <entry><option>acl_smtp_quit</option></entry>
20620 <entry>Use: <emphasis>main</emphasis></entry>
20621 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20622 <entry>Default: <emphasis>unset</emphasis></entry>
20628 <indexterm role="concept">
20629 <primary>QUIT, ACL for</primary>
20631 This option defines the ACL that is run when an SMTP QUIT command is
20632 received. See chapter <xref linkend="CHAPACL"/> for further details.
20635 <indexterm role="option">
20636 <primary><option>acl_smtp_rcpt</option></primary>
20639 <informaltable frame="all">
20640 <tgroup cols="4" colsep="0" rowsep="0">
20641 <colspec colwidth="8*" align="left"/>
20642 <colspec colwidth="6*" align="center"/>
20643 <colspec colwidth="6*" align="center"/>
20644 <colspec colwidth="6*" align="right"/>
20647 <entry><option>acl_smtp_rcpt</option></entry>
20648 <entry>Use: <emphasis>main</emphasis></entry>
20649 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20650 <entry>Default: <emphasis>unset</emphasis></entry>
20656 <indexterm role="concept">
20657 <primary>RCPT</primary>
20658 <secondary>ACL for</secondary>
20660 This option defines the ACL that is run when an SMTP RCPT command is
20661 received. See chapter <xref linkend="CHAPACL"/> for further details.
20664 <indexterm role="option">
20665 <primary><option>acl_smtp_starttls</option></primary>
20668 <informaltable frame="all">
20669 <tgroup cols="4" colsep="0" rowsep="0">
20670 <colspec colwidth="8*" align="left"/>
20671 <colspec colwidth="6*" align="center"/>
20672 <colspec colwidth="6*" align="center"/>
20673 <colspec colwidth="6*" align="right"/>
20676 <entry><option>acl_smtp_starttls</option></entry>
20677 <entry>Use: <emphasis>main</emphasis></entry>
20678 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20679 <entry>Default: <emphasis>unset</emphasis></entry>
20685 <indexterm role="concept">
20686 <primary>STARTTLS, ACL for</primary>
20688 This option defines the ACL that is run when an SMTP STARTTLS command is
20689 received. See chapter <xref linkend="CHAPACL"/> for further details.
20692 <indexterm role="option">
20693 <primary><option>acl_smtp_vrfy</option></primary>
20696 <informaltable frame="all">
20697 <tgroup cols="4" colsep="0" rowsep="0">
20698 <colspec colwidth="8*" align="left"/>
20699 <colspec colwidth="6*" align="center"/>
20700 <colspec colwidth="6*" align="center"/>
20701 <colspec colwidth="6*" align="right"/>
20704 <entry><option>acl_smtp_vrfy</option></entry>
20705 <entry>Use: <emphasis>main</emphasis></entry>
20706 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20707 <entry>Default: <emphasis>unset</emphasis></entry>
20713 <indexterm role="concept">
20714 <primary>VRFY</primary>
20715 <secondary>ACL for</secondary>
20717 This option defines the ACL that is run when an SMTP VRFY command is
20718 received. See chapter <xref linkend="CHAPACL"/> for further details.
20721 <indexterm role="option">
20722 <primary><option>admin_groups</option></primary>
20725 <informaltable frame="all">
20726 <tgroup cols="4" colsep="0" rowsep="0">
20727 <colspec colwidth="8*" align="left"/>
20728 <colspec colwidth="6*" align="center"/>
20729 <colspec colwidth="6*" align="center"/>
20730 <colspec colwidth="6*" align="right"/>
20733 <entry><option>admin_groups</option></entry>
20734 <entry>Use: <emphasis>main</emphasis></entry>
20735 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
20736 <entry>Default: <emphasis>unset</emphasis></entry>
20742 <indexterm role="concept">
20743 <primary>admin user</primary>
20745 This option is expanded just once, at the start of Exim’s processing. If the
20746 current group or any of the supplementary groups of an Exim caller is in this
20747 colon-separated list, the caller has admin privileges. If all your system
20748 programmers are in a specific group, for example, you can give them all Exim
20749 admin privileges by putting that group in <option>admin_groups</option>. However, this does
20750 not permit them to read Exim’s spool files (whose group owner is the Exim gid).
20751 To permit this, you have to add individuals to the Exim group.
20754 <indexterm role="option">
20755 <primary><option>allow_domain_literals</option></primary>
20758 <informaltable frame="all">
20759 <tgroup cols="4" colsep="0" rowsep="0">
20760 <colspec colwidth="8*" align="left"/>
20761 <colspec colwidth="6*" align="center"/>
20762 <colspec colwidth="6*" align="center"/>
20763 <colspec colwidth="6*" align="right"/>
20766 <entry><option>allow_domain_literals</option></entry>
20767 <entry>Use: <emphasis>main</emphasis></entry>
20768 <entry>Type: <emphasis>boolean</emphasis></entry>
20769 <entry>Default: <emphasis>false</emphasis></entry>
20775 <indexterm role="concept">
20776 <primary>domain literal</primary>
20778 If this option is set, the RFC 2822 domain literal format is permitted in
20779 email addresses. The option is not set by default, because the domain literal
20780 format is not normally required these days, and few people know about it. It
20781 has, however, been exploited by mail abusers.
20784 Unfortunately, it seems that some DNS black list maintainers are using this
20785 format to report black listing to postmasters. If you want to accept messages
20786 addressed to your hosts by IP address, you need to set
20787 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
20788 domains (defined in the named domain list <option>local_domains</option> in the default
20789 configuration). This <quote>magic string</quote> matches the domain literal form of all
20790 the local host’s IP addresses.
20793 <indexterm role="option">
20794 <primary><option>allow_mx_to_ip</option></primary>
20797 <informaltable frame="all">
20798 <tgroup cols="4" colsep="0" rowsep="0">
20799 <colspec colwidth="8*" align="left"/>
20800 <colspec colwidth="6*" align="center"/>
20801 <colspec colwidth="6*" align="center"/>
20802 <colspec colwidth="6*" align="right"/>
20805 <entry><option>allow_mx_to_ip</option></entry>
20806 <entry>Use: <emphasis>main</emphasis></entry>
20807 <entry>Type: <emphasis>boolean</emphasis></entry>
20808 <entry>Default: <emphasis>false</emphasis></entry>
20814 <indexterm role="concept">
20815 <primary>MX record</primary>
20816 <secondary>pointing to IP address</secondary>
20818 It appears that more and more DNS zone administrators are breaking the rules
20819 and putting domain names that look like IP addresses on the right hand side of
20820 MX records. Exim follows the rules and rejects this, giving an error message
20821 that explains the mis-configuration. However, some other MTAs support this
20822 practice, so to avoid <quote>Why can’t Exim do this?</quote> complaints,
20823 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
20824 recommended, except when you have no other choice.
20827 <indexterm role="option">
20828 <primary><option>allow_utf8_domains</option></primary>
20831 <informaltable frame="all">
20832 <tgroup cols="4" colsep="0" rowsep="0">
20833 <colspec colwidth="8*" align="left"/>
20834 <colspec colwidth="6*" align="center"/>
20835 <colspec colwidth="6*" align="center"/>
20836 <colspec colwidth="6*" align="right"/>
20839 <entry><option>allow_utf8_domains</option></entry>
20840 <entry>Use: <emphasis>main</emphasis></entry>
20841 <entry>Type: <emphasis>boolean</emphasis></entry>
20842 <entry>Default: <emphasis>false</emphasis></entry>
20848 <indexterm role="concept">
20849 <primary>domain</primary>
20850 <secondary>UTF-8 characters in</secondary>
20852 <indexterm role="concept">
20853 <primary>UTF-8</primary>
20854 <secondary>in domain name</secondary>
20856 Lots of discussion is going on about internationalized domain names. One
20857 camp is strongly in favour of just using UTF-8 characters, and it seems
20858 that at least two other MTAs permit this. This option allows Exim users to
20859 experiment if they wish.
20862 If it is set true, Exim’s domain parsing function allows valid
20863 UTF-8 multicharacters to appear in domain name components, in addition to
20864 letters, digits, and hyphens. However, just setting this option is not
20865 enough; if you want to look up these domain names in the DNS, you must also
20866 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
20867 suitable setting is:
20869 <literallayout class="monospaced">
20870 dns_check_names_pattern = (?i)^(?>(?(1)\.|())[a-z0-9\xc0-\xff]\
20871 (?>[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
20874 Alternatively, you can just disable this feature by setting
20876 <literallayout class="monospaced">
20877 dns_check_names_pattern =
20880 That is, set the option to an empty string so that no check is done.
20883 <indexterm role="option">
20884 <primary><option>auth_advertise_hosts</option></primary>
20887 <informaltable frame="all">
20888 <tgroup cols="4" colsep="0" rowsep="0">
20889 <colspec colwidth="8*" align="left"/>
20890 <colspec colwidth="6*" align="center"/>
20891 <colspec colwidth="6*" align="center"/>
20892 <colspec colwidth="6*" align="right"/>
20895 <entry><option>auth_advertise_hosts</option></entry>
20896 <entry>Use: <emphasis>main</emphasis></entry>
20897 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
20898 <entry>Default: <emphasis>*</emphasis></entry>
20904 <indexterm role="concept">
20905 <primary>authentication</primary>
20906 <secondary>advertising</secondary>
20908 <indexterm role="concept">
20909 <primary>AUTH</primary>
20910 <secondary>advertising</secondary>
20912 If any server authentication mechanisms are configured, Exim advertises them in
20913 response to an EHLO command only if the calling host matches this list.
20914 Otherwise, Exim does not advertise AUTH.
20915 Exim does not accept AUTH commands from clients to which it has not
20916 advertised the availability of AUTH. The advertising of individual
20917 authentication mechanisms can be controlled by the use of the
20918 <option>server_advertise_condition</option> generic authenticator option on the individual
20919 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
20922 Certain mail clients (for example, Netscape) require the user to provide a name
20923 and password for authentication if AUTH is advertised, even though it may
20924 not be needed (the host may accept messages from hosts on its local LAN without
20925 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
20926 to make these clients more friendly by excluding them from the set of hosts to
20927 which Exim advertises AUTH.
20930 <indexterm role="concept">
20931 <primary>AUTH</primary>
20932 <secondary>advertising when encrypted</secondary>
20934 If you want to advertise the availability of AUTH only when the connection
20935 is encrypted using TLS, you can make use of the fact that the value of this
20936 option is expanded, with a setting like this:
20938 <literallayout class="monospaced">
20939 auth_advertise_hosts = ${if eq{$tls_cipher}{}{}{*}}
20942 <indexterm role="variable">
20943 <primary><varname>$tls_cipher</varname></primary>
20945 If <varname>$tls_cipher</varname> is empty, the session is not encrypted, and the result of
20946 the expansion is empty, thus matching no hosts. Otherwise, the result of the
20947 expansion is *, which matches all hosts.
20950 <indexterm role="option">
20951 <primary><option>auto_thaw</option></primary>
20954 <informaltable frame="all">
20955 <tgroup cols="4" colsep="0" rowsep="0">
20956 <colspec colwidth="8*" align="left"/>
20957 <colspec colwidth="6*" align="center"/>
20958 <colspec colwidth="6*" align="center"/>
20959 <colspec colwidth="6*" align="right"/>
20962 <entry><option>auto_thaw</option></entry>
20963 <entry>Use: <emphasis>main</emphasis></entry>
20964 <entry>Type: <emphasis>time</emphasis></entry>
20965 <entry>Default: <emphasis>0s</emphasis></entry>
20971 <indexterm role="concept">
20972 <primary>thawing messages</primary>
20974 <indexterm role="concept">
20975 <primary>unfreezing messages</primary>
20977 If this option is set to a time greater than zero, a queue runner will try a
20978 new delivery attempt on any frozen message, other than a bounce message, if
20979 this much time has passed since it was frozen. This may result in the message
20980 being re-frozen if nothing has changed since the last attempt. It is a way of
20981 saying <quote>keep on trying, even though there are big problems</quote>.
20984 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
20985 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
20986 thought to be very useful any more, and its use should probably be avoided.
20989 <indexterm role="option">
20990 <primary><option>av_scanner</option></primary>
20993 <informaltable frame="all">
20994 <tgroup cols="4" colsep="0" rowsep="0">
20995 <colspec colwidth="8*" align="left"/>
20996 <colspec colwidth="6*" align="center"/>
20997 <colspec colwidth="6*" align="center"/>
20998 <colspec colwidth="6*" align="right"/>
21001 <entry><option>av_scanner</option></entry>
21002 <entry>Use: <emphasis>main</emphasis></entry>
21003 <entry>Type: <emphasis>string</emphasis></entry>
21004 <entry>Default: <emphasis>see below</emphasis></entry>
21010 This option is available if Exim is built with the content-scanning extension.
21011 It specifies which anti-virus scanner to use. The default value is:
21013 <literallayout class="monospaced">
21014 sophie:/var/run/sophie
21017 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
21018 before use. See section <xref linkend="SECTscanvirus"/> for further details.
21021 <indexterm role="option">
21022 <primary><option>bi_command</option></primary>
21025 <informaltable frame="all">
21026 <tgroup cols="4" colsep="0" rowsep="0">
21027 <colspec colwidth="8*" align="left"/>
21028 <colspec colwidth="6*" align="center"/>
21029 <colspec colwidth="6*" align="center"/>
21030 <colspec colwidth="6*" align="right"/>
21033 <entry><option>bi_command</option></entry>
21034 <entry>Use: <emphasis>main</emphasis></entry>
21035 <entry>Type: <emphasis>string</emphasis></entry>
21036 <entry>Default: <emphasis>unset</emphasis></entry>
21042 <indexterm role="option">
21043 <primary><option>-bi</option></primary>
21045 This option supplies the name of a command that is run when Exim is called with
21046 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
21047 just the command name, it is not a complete command line. If an argument is
21048 required, it must come from the <option>-oA</option> command line option.
21051 <indexterm role="option">
21052 <primary><option>bounce_message_file</option></primary>
21055 <informaltable frame="all">
21056 <tgroup cols="4" colsep="0" rowsep="0">
21057 <colspec colwidth="8*" align="left"/>
21058 <colspec colwidth="6*" align="center"/>
21059 <colspec colwidth="6*" align="center"/>
21060 <colspec colwidth="6*" align="right"/>
21063 <entry><option>bounce_message_file</option></entry>
21064 <entry>Use: <emphasis>main</emphasis></entry>
21065 <entry>Type: <emphasis>string</emphasis></entry>
21066 <entry>Default: <emphasis>unset</emphasis></entry>
21072 <indexterm role="concept">
21073 <primary>bounce message</primary>
21074 <secondary>customizing</secondary>
21076 <indexterm role="concept">
21077 <primary>customizing</primary>
21078 <secondary>bounce message</secondary>
21080 This option defines a template file containing paragraphs of text to be used
21081 for constructing bounce messages. Details of the file’s contents are given in
21082 chapter <xref linkend="CHAPemsgcust"/>. See also <option>warn_message_file</option>.
21085 <indexterm role="option">
21086 <primary><option>bounce_message_text</option></primary>
21089 <informaltable frame="all">
21090 <tgroup cols="4" colsep="0" rowsep="0">
21091 <colspec colwidth="8*" align="left"/>
21092 <colspec colwidth="6*" align="center"/>
21093 <colspec colwidth="6*" align="center"/>
21094 <colspec colwidth="6*" align="right"/>
21097 <entry><option>bounce_message_text</option></entry>
21098 <entry>Use: <emphasis>main</emphasis></entry>
21099 <entry>Type: <emphasis>string</emphasis></entry>
21100 <entry>Default: <emphasis>unset</emphasis></entry>
21106 When this option is set, its contents are included in the default bounce
21107 message immediately after <quote>This message was created automatically by mail
21108 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
21111 <indexterm role="option">
21112 <primary><option>bounce_return_body</option></primary>
21115 <informaltable frame="all">
21116 <tgroup cols="4" colsep="0" rowsep="0">
21117 <colspec colwidth="8*" align="left"/>
21118 <colspec colwidth="6*" align="center"/>
21119 <colspec colwidth="6*" align="center"/>
21120 <colspec colwidth="6*" align="right"/>
21123 <entry><option>bounce_return_body</option></entry>
21124 <entry>Use: <emphasis>main</emphasis></entry>
21125 <entry>Type: <emphasis>boolean</emphasis></entry>
21126 <entry>Default: <emphasis>true</emphasis></entry>
21132 <indexterm role="concept">
21133 <primary>bounce message</primary>
21134 <secondary>including body</secondary>
21136 This option controls whether the body of an incoming message is included in a
21137 bounce message when <option>bounce_return_message</option> is true. The default setting
21138 causes the entire message, both header and body, to be returned (subject to the
21139 value of <option>bounce_return_size_limit</option>). If this option is false, only the
21140 message header is included. In the case of a non-SMTP message containing an
21141 error that is detected during reception, only those header lines preceding the
21142 point at which the error was detected are returned.
21143 <indexterm role="concept">
21144 <primary>bounce message</primary>
21145 <secondary>including original</secondary>
21149 <indexterm role="option">
21150 <primary><option>bounce_return_message</option></primary>
21153 <informaltable frame="all">
21154 <tgroup cols="4" colsep="0" rowsep="0">
21155 <colspec colwidth="8*" align="left"/>
21156 <colspec colwidth="6*" align="center"/>
21157 <colspec colwidth="6*" align="center"/>
21158 <colspec colwidth="6*" align="right"/>
21161 <entry><option>bounce_return_message</option></entry>
21162 <entry>Use: <emphasis>main</emphasis></entry>
21163 <entry>Type: <emphasis>boolean</emphasis></entry>
21164 <entry>Default: <emphasis>true</emphasis></entry>
21170 If this option is set false, none of the original message is included in
21171 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
21172 <option>bounce_return_body</option>.
21175 <indexterm role="option">
21176 <primary><option>bounce_return_size_limit</option></primary>
21179 <informaltable frame="all">
21180 <tgroup cols="4" colsep="0" rowsep="0">
21181 <colspec colwidth="8*" align="left"/>
21182 <colspec colwidth="6*" align="center"/>
21183 <colspec colwidth="6*" align="center"/>
21184 <colspec colwidth="6*" align="right"/>
21187 <entry><option>bounce_return_size_limit</option></entry>
21188 <entry>Use: <emphasis>main</emphasis></entry>
21189 <entry>Type: <emphasis>integer</emphasis></entry>
21190 <entry>Default: <emphasis>100K</emphasis></entry>
21196 <indexterm role="concept">
21197 <primary>size</primary>
21198 <secondary>of bounce, limit</secondary>
21200 <indexterm role="concept">
21201 <primary>bounce message</primary>
21202 <secondary>size limit</secondary>
21204 <indexterm role="concept">
21205 <primary>limit</primary>
21206 <secondary>bounce message size</secondary>
21208 This option sets a limit in bytes on the size of messages that are returned to
21209 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
21210 limit should be less than the value of the global <option>message_size_limit</option> and of
21211 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
21212 that Exim generates. If this option is set to zero there is no limit.
21215 When the body of any message that is to be included in a bounce message is
21216 greater than the limit, it is truncated, and a comment pointing this out is
21217 added at the top. The actual cutoff may be greater than the value given, owing
21218 to the use of buffering for transferring the message in chunks (typically 8K in
21219 size). The idea is to save bandwidth on those undeliverable 15-megabyte
21223 <indexterm role="option">
21224 <primary><option>bounce_sender_authentication</option></primary>
21227 <informaltable frame="all">
21228 <tgroup cols="4" colsep="0" rowsep="0">
21229 <colspec colwidth="8*" align="left"/>
21230 <colspec colwidth="6*" align="center"/>
21231 <colspec colwidth="6*" align="center"/>
21232 <colspec colwidth="6*" align="right"/>
21235 <entry><option>bounce_sender_authentication</option></entry>
21236 <entry>Use: <emphasis>main</emphasis></entry>
21237 <entry>Type: <emphasis>string</emphasis></entry>
21238 <entry>Default: <emphasis>unset</emphasis></entry>
21244 <indexterm role="concept">
21245 <primary>bounce message</primary>
21246 <secondary>sender authentication</secondary>
21248 <indexterm role="concept">
21249 <primary>authentication</primary>
21250 <secondary>bounce message</secondary>
21252 <indexterm role="concept">
21253 <primary>AUTH</primary>
21254 <secondary>on bounce message</secondary>
21256 This option provides an authenticated sender address that is sent with any
21257 bounce messages generated by Exim that are sent over an authenticated SMTP
21258 connection. A typical setting might be:
21260 <literallayout class="monospaced">
21261 bounce_sender_authentication = mailer-daemon@my.domain.example
21264 which would cause bounce messages to be sent using the SMTP command:
21266 <literallayout class="monospaced">
21267 MAIL FROM:<> AUTH=mailer-daemon@my.domain.example
21270 The value of <option>bounce_sender_authentication</option> must always be a complete email
21274 <indexterm role="option">
21275 <primary><option>callout_domain_negative_expire</option></primary>
21278 <informaltable frame="all">
21279 <tgroup cols="4" colsep="0" rowsep="0">
21280 <colspec colwidth="8*" align="left"/>
21281 <colspec colwidth="6*" align="center"/>
21282 <colspec colwidth="6*" align="center"/>
21283 <colspec colwidth="6*" align="right"/>
21286 <entry><option>callout_domain_negative_expire</option></entry>
21287 <entry>Use: <emphasis>main</emphasis></entry>
21288 <entry>Type: <emphasis>time</emphasis></entry>
21289 <entry>Default: <emphasis>3h</emphasis></entry>
21295 <indexterm role="concept">
21296 <primary>caching</primary>
21297 <secondary>callout timeouts</secondary>
21299 <indexterm role="concept">
21300 <primary>callout</primary>
21301 <secondary>caching timeouts</secondary>
21303 This option specifies the expiry time for negative callout cache data for a
21304 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21305 section <xref linkend="SECTcallvercache"/> for details of the caching.
21308 <indexterm role="option">
21309 <primary><option>callout_domain_positive_expire</option></primary>
21312 <informaltable frame="all">
21313 <tgroup cols="4" colsep="0" rowsep="0">
21314 <colspec colwidth="8*" align="left"/>
21315 <colspec colwidth="6*" align="center"/>
21316 <colspec colwidth="6*" align="center"/>
21317 <colspec colwidth="6*" align="right"/>
21320 <entry><option>callout_domain_positive_expire</option></entry>
21321 <entry>Use: <emphasis>main</emphasis></entry>
21322 <entry>Type: <emphasis>time</emphasis></entry>
21323 <entry>Default: <emphasis>7d</emphasis></entry>
21329 This option specifies the expiry time for positive callout cache data for a
21330 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21331 section <xref linkend="SECTcallvercache"/> for details of the caching.
21334 <indexterm role="option">
21335 <primary><option>callout_negative_expire</option></primary>
21338 <informaltable frame="all">
21339 <tgroup cols="4" colsep="0" rowsep="0">
21340 <colspec colwidth="8*" align="left"/>
21341 <colspec colwidth="6*" align="center"/>
21342 <colspec colwidth="6*" align="center"/>
21343 <colspec colwidth="6*" align="right"/>
21346 <entry><option>callout_negative_expire</option></entry>
21347 <entry>Use: <emphasis>main</emphasis></entry>
21348 <entry>Type: <emphasis>time</emphasis></entry>
21349 <entry>Default: <emphasis>2h</emphasis></entry>
21355 This option specifies the expiry time for negative callout cache data for an
21356 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21357 section <xref linkend="SECTcallvercache"/> for details of the caching.
21360 <indexterm role="option">
21361 <primary><option>callout_positive_expire</option></primary>
21364 <informaltable frame="all">
21365 <tgroup cols="4" colsep="0" rowsep="0">
21366 <colspec colwidth="8*" align="left"/>
21367 <colspec colwidth="6*" align="center"/>
21368 <colspec colwidth="6*" align="center"/>
21369 <colspec colwidth="6*" align="right"/>
21372 <entry><option>callout_positive_expire</option></entry>
21373 <entry>Use: <emphasis>main</emphasis></entry>
21374 <entry>Type: <emphasis>time</emphasis></entry>
21375 <entry>Default: <emphasis>24h</emphasis></entry>
21381 This option specifies the expiry time for positive callout cache data for an
21382 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21383 section <xref linkend="SECTcallvercache"/> for details of the caching.
21386 <indexterm role="option">
21387 <primary><option>callout_random_local_part</option></primary>
21390 <informaltable frame="all">
21391 <tgroup cols="4" colsep="0" rowsep="0">
21392 <colspec colwidth="8*" align="left"/>
21393 <colspec colwidth="6*" align="center"/>
21394 <colspec colwidth="6*" align="center"/>
21395 <colspec colwidth="6*" align="right"/>
21398 <entry><option>callout_random_local_part</option></entry>
21399 <entry>Use: <emphasis>main</emphasis></entry>
21400 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
21401 <entry>Default: <emphasis>see below</emphasis></entry>
21407 This option defines the <quote>random</quote> local part that can be used as part of
21408 callout verification. The default value is
21410 <literallayout class="monospaced">
21411 $primary_host_name-$tod_epoch-testing
21414 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
21417 <indexterm role="option">
21418 <primary><option>check_log_inodes</option></primary>
21421 <informaltable frame="all">
21422 <tgroup cols="4" colsep="0" rowsep="0">
21423 <colspec colwidth="8*" align="left"/>
21424 <colspec colwidth="6*" align="center"/>
21425 <colspec colwidth="6*" align="center"/>
21426 <colspec colwidth="6*" align="right"/>
21429 <entry><option>check_log_inodes</option></entry>
21430 <entry>Use: <emphasis>main</emphasis></entry>
21431 <entry>Type: <emphasis>integer</emphasis></entry>
21432 <entry>Default: <emphasis>0</emphasis></entry>
21438 See <option>check_spool_space</option> below.
21441 <indexterm role="option">
21442 <primary><option>check_log_space</option></primary>
21445 <informaltable frame="all">
21446 <tgroup cols="4" colsep="0" rowsep="0">
21447 <colspec colwidth="8*" align="left"/>
21448 <colspec colwidth="6*" align="center"/>
21449 <colspec colwidth="6*" align="center"/>
21450 <colspec colwidth="6*" align="right"/>
21453 <entry><option>check_log_space</option></entry>
21454 <entry>Use: <emphasis>main</emphasis></entry>
21455 <entry>Type: <emphasis>integer</emphasis></entry>
21456 <entry>Default: <emphasis>0</emphasis></entry>
21462 See <option>check_spool_space</option> below.
21465 <indexterm role="option">
21466 <primary><option>check_rfc2047_length</option></primary>
21468 <indexterm role="concept">
21469 <primary>RFC 2047</primary>
21470 <secondary>disabling length check</secondary>
21472 <indexterm role="option">
21473 <primary><option>check_rfc2047_length</option></primary>
21476 <informaltable frame="all">
21477 <tgroup cols="4" colsep="0" rowsep="0">
21478 <colspec colwidth="8*" align="left"/>
21479 <colspec colwidth="6*" align="center"/>
21480 <colspec colwidth="6*" align="center"/>
21481 <colspec colwidth="6*" align="right"/>
21484 <entry><option>check_rfc2047_length</option></entry>
21485 <entry>Use: <emphasis>main</emphasis></entry>
21486 <entry>Type: <emphasis>boolean</emphasis></entry>
21487 <entry>Default: <emphasis>true</emphasis></entry>
21493 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
21494 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
21495 word; strings to be encoded that exceed this length are supposed to use
21496 multiple encoded words. By default, Exim does not recognize encoded words that
21497 exceed the maximum length. However, it seems that some software, in violation
21498 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
21499 set false, Exim recognizes encoded words of any length.
21502 <indexterm role="option">
21503 <primary><option>check_spool_inodes</option></primary>
21506 <informaltable frame="all">
21507 <tgroup cols="4" colsep="0" rowsep="0">
21508 <colspec colwidth="8*" align="left"/>
21509 <colspec colwidth="6*" align="center"/>
21510 <colspec colwidth="6*" align="center"/>
21511 <colspec colwidth="6*" align="right"/>
21514 <entry><option>check_spool_inodes</option></entry>
21515 <entry>Use: <emphasis>main</emphasis></entry>
21516 <entry>Type: <emphasis>integer</emphasis></entry>
21517 <entry>Default: <emphasis>0</emphasis></entry>
21523 See <option>check_spool_space</option> below.
21526 <indexterm role="option">
21527 <primary><option>check_spool_space</option></primary>
21530 <informaltable frame="all">
21531 <tgroup cols="4" colsep="0" rowsep="0">
21532 <colspec colwidth="8*" align="left"/>
21533 <colspec colwidth="6*" align="center"/>
21534 <colspec colwidth="6*" align="center"/>
21535 <colspec colwidth="6*" align="right"/>
21538 <entry><option>check_spool_space</option></entry>
21539 <entry>Use: <emphasis>main</emphasis></entry>
21540 <entry>Type: <emphasis>integer</emphasis></entry>
21541 <entry>Default: <emphasis>0</emphasis></entry>
21547 <indexterm role="concept">
21548 <primary>checking disk space</primary>
21550 <indexterm role="concept">
21551 <primary>disk space, checking</primary>
21553 <indexterm role="concept">
21554 <primary>spool directory</primary>
21555 <secondary>checking space</secondary>
21557 The four <option>check_...</option> options allow for checking of disk resources before a
21558 message is accepted.
21561 <indexterm role="variable">
21562 <primary><varname>$log_inodes</varname></primary>
21564 <indexterm role="variable">
21565 <primary><varname>$log_space</varname></primary>
21567 <indexterm role="variable">
21568 <primary><varname>$spool_inodes</varname></primary>
21570 <indexterm role="variable">
21571 <primary><varname>$spool_space</varname></primary>
21573 When any of these options are set, they apply to all incoming messages. If you
21574 want to apply different checks to different kinds of message, you can do so by
21575 testing the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
21576 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
21579 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
21580 either value is greater than zero, for example:
21582 <literallayout class="monospaced">
21583 check_spool_space = 10M
21584 check_spool_inodes = 100
21587 The spool partition is the one that contains the directory defined by
21588 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
21592 <option>check_log_space</option> and <option>check_log_inodes</option> check the partition in which log
21593 files are written if either is greater than zero. These should be set only if
21594 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
21597 If there is less space or fewer inodes than requested, Exim refuses to accept
21598 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
21599 error response to the MAIL command. If ESMTP is in use and there was a
21600 SIZE parameter on the MAIL command, its value is added to the
21601 <option>check_spool_space</option> value, and the check is performed even if
21602 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
21605 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
21606 number of kilobytes. If a non-multiple of 1024 is specified, it is rounded up.
21609 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
21610 failure a message is written to stderr and Exim exits with a non-zero code, as
21611 it obviously cannot send an error message of any kind.
21614 <indexterm role="option">
21615 <primary><option>daemon_smtp_ports</option></primary>
21618 <informaltable frame="all">
21619 <tgroup cols="4" colsep="0" rowsep="0">
21620 <colspec colwidth="8*" align="left"/>
21621 <colspec colwidth="6*" align="center"/>
21622 <colspec colwidth="6*" align="center"/>
21623 <colspec colwidth="6*" align="right"/>
21626 <entry><option>daemon_smtp_ports</option></entry>
21627 <entry>Use: <emphasis>main</emphasis></entry>
21628 <entry>Type: <emphasis>string</emphasis></entry>
21629 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
21635 <indexterm role="concept">
21636 <primary>port</primary>
21637 <secondary>for daemon</secondary>
21639 <indexterm role="concept">
21640 <primary>TCP/IP</primary>
21641 <secondary>setting listening ports</secondary>
21643 This option specifies one or more default SMTP ports on which the Exim daemon
21644 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
21645 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
21648 <indexterm role="option">
21649 <primary><option>daemon_startup_retries</option></primary>
21652 <informaltable frame="all">
21653 <tgroup cols="4" colsep="0" rowsep="0">
21654 <colspec colwidth="8*" align="left"/>
21655 <colspec colwidth="6*" align="center"/>
21656 <colspec colwidth="6*" align="center"/>
21657 <colspec colwidth="6*" align="right"/>
21660 <entry><option>daemon_startup_retries</option></entry>
21661 <entry>Use: <emphasis>main</emphasis></entry>
21662 <entry>Type: <emphasis>integer</emphasis></entry>
21663 <entry>Default: <emphasis>9</emphasis></entry>
21669 <indexterm role="concept">
21670 <primary>daemon startup, retrying</primary>
21672 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
21673 the daemon at startup when it cannot immediately bind a listening socket
21674 (typically because the socket is already in use): <option>daemon_startup_retries</option>
21675 defines the number of retries after the first failure, and
21676 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
21679 <indexterm role="option">
21680 <primary><option>daemon_startup_sleep</option></primary>
21683 <informaltable frame="all">
21684 <tgroup cols="4" colsep="0" rowsep="0">
21685 <colspec colwidth="8*" align="left"/>
21686 <colspec colwidth="6*" align="center"/>
21687 <colspec colwidth="6*" align="center"/>
21688 <colspec colwidth="6*" align="right"/>
21691 <entry><option>daemon_startup_sleep</option></entry>
21692 <entry>Use: <emphasis>main</emphasis></entry>
21693 <entry>Type: <emphasis>time</emphasis></entry>
21694 <entry>Default: <emphasis>30s</emphasis></entry>
21700 See <option>daemon_startup_retries</option>.
21703 <indexterm role="option">
21704 <primary><option>delay_warning</option></primary>
21707 <informaltable frame="all">
21708 <tgroup cols="4" colsep="0" rowsep="0">
21709 <colspec colwidth="8*" align="left"/>
21710 <colspec colwidth="6*" align="center"/>
21711 <colspec colwidth="6*" align="center"/>
21712 <colspec colwidth="6*" align="right"/>
21715 <entry><option>delay_warning</option></entry>
21716 <entry>Use: <emphasis>main</emphasis></entry>
21717 <entry>Type: <emphasis>time list</emphasis></entry>
21718 <entry>Default: <emphasis>24h</emphasis></entry>
21724 <indexterm role="concept">
21725 <primary>warning of delay</primary>
21727 <indexterm role="concept">
21728 <primary>delay warning, specifying</primary>
21730 When a message is delayed, Exim sends a warning message to the sender at
21731 intervals specified by this option. The data is a colon-separated list of times
21732 after which to send warning messages. If the value of the option is an empty
21733 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
21734 message has been on the queue for longer than the last time, the last interval
21735 between the times is used to compute subsequent warning times. For example,
21738 <literallayout class="monospaced">
21739 delay_warning = 4h:8h:24h
21742 the first message is sent after 4 hours, the second after 8 hours, and
21743 the third one after 24 hours. After that, messages are sent every 16 hours,
21744 because that is the interval between the last two times on the list. If you set
21745 just one time, it specifies the repeat interval. For example, with:
21747 <literallayout class="monospaced">
21751 messages are repeated every six hours. To stop warnings after a given time, set
21752 a very large time at the end of the list. For example:
21754 <literallayout class="monospaced">
21755 delay_warning = 2h:12h:99d
21758 <indexterm role="option">
21759 <primary><option>delay_warning_condition</option></primary>
21762 <informaltable frame="all">
21763 <tgroup cols="4" colsep="0" rowsep="0">
21764 <colspec colwidth="8*" align="left"/>
21765 <colspec colwidth="6*" align="center"/>
21766 <colspec colwidth="6*" align="center"/>
21767 <colspec colwidth="6*" align="right"/>
21770 <entry><option>delay_warning_condition</option></entry>
21771 <entry>Use: <emphasis>main</emphasis></entry>
21772 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
21773 <entry>Default: <emphasis>see below</emphasis></entry>
21779 <indexterm role="variable">
21780 <primary><varname>$domain</varname></primary>
21782 The string is expanded at the time a warning message might be sent. If all the
21783 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
21784 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
21785 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
21786 <quote>false</quote> (the comparison being done caselessly) then the warning message is
21787 not sent. The default is:
21789 <literallayout class="monospaced">
21790 delay_warning_condition = ${if or {\
21791 { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
21792 { match{$h_precedence:}{(?i)bulk|list|junk} }\
21793 { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
21797 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
21798 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
21799 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
21800 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
21803 <indexterm role="option">
21804 <primary><option>deliver_drop_privilege</option></primary>
21807 <informaltable frame="all">
21808 <tgroup cols="4" colsep="0" rowsep="0">
21809 <colspec colwidth="8*" align="left"/>
21810 <colspec colwidth="6*" align="center"/>
21811 <colspec colwidth="6*" align="center"/>
21812 <colspec colwidth="6*" align="right"/>
21815 <entry><option>deliver_drop_privilege</option></entry>
21816 <entry>Use: <emphasis>main</emphasis></entry>
21817 <entry>Type: <emphasis>boolean</emphasis></entry>
21818 <entry>Default: <emphasis>false</emphasis></entry>
21824 <indexterm role="concept">
21825 <primary>unprivileged delivery</primary>
21827 <indexterm role="concept">
21828 <primary>delivery</primary>
21829 <secondary>unprivileged</secondary>
21831 If this option is set true, Exim drops its root privilege at the start of a
21832 delivery process, and runs as the Exim user throughout. This severely restricts
21833 the kinds of local delivery that are possible, but is viable in certain types
21834 of configuration. There is a discussion about the use of root privilege in
21835 chapter <xref linkend="CHAPsecurity"/>.
21838 <indexterm role="option">
21839 <primary><option>deliver_queue_load_max</option></primary>
21842 <informaltable frame="all">
21843 <tgroup cols="4" colsep="0" rowsep="0">
21844 <colspec colwidth="8*" align="left"/>
21845 <colspec colwidth="6*" align="center"/>
21846 <colspec colwidth="6*" align="center"/>
21847 <colspec colwidth="6*" align="right"/>
21850 <entry><option>deliver_queue_load_max</option></entry>
21851 <entry>Use: <emphasis>main</emphasis></entry>
21852 <entry>Type: <emphasis>fixed-point</emphasis></entry>
21853 <entry>Default: <emphasis>unset</emphasis></entry>
21859 <indexterm role="concept">
21860 <primary>load average</primary>
21862 <indexterm role="concept">
21863 <primary>queue runner</primary>
21864 <secondary>abandoning</secondary>
21866 When this option is set, a queue run is abandoned if the system load average
21867 becomes greater than the value of the option. The option has no effect on
21868 ancient operating systems on which Exim cannot determine the load average.
21869 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
21872 <indexterm role="option">
21873 <primary><option>delivery_date_remove</option></primary>
21876 <informaltable frame="all">
21877 <tgroup cols="4" colsep="0" rowsep="0">
21878 <colspec colwidth="8*" align="left"/>
21879 <colspec colwidth="6*" align="center"/>
21880 <colspec colwidth="6*" align="center"/>
21881 <colspec colwidth="6*" align="right"/>
21884 <entry><option>delivery_date_remove</option></entry>
21885 <entry>Use: <emphasis>main</emphasis></entry>
21886 <entry>Type: <emphasis>boolean</emphasis></entry>
21887 <entry>Default: <emphasis>true</emphasis></entry>
21893 <indexterm role="concept">
21894 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
21896 Exim’s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
21897 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
21898 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
21899 should not be present in incoming messages, and this option causes them to be
21900 removed at the time the message is received, to avoid any problems that might
21901 occur when a delivered message is subsequently sent on to some other recipient.
21904 <indexterm role="option">
21905 <primary><option>disable_fsync</option></primary>
21908 <informaltable frame="all">
21909 <tgroup cols="4" colsep="0" rowsep="0">
21910 <colspec colwidth="8*" align="left"/>
21911 <colspec colwidth="6*" align="center"/>
21912 <colspec colwidth="6*" align="center"/>
21913 <colspec colwidth="6*" align="right"/>
21916 <entry><option>disable_fsync</option></entry>
21917 <entry>Use: <emphasis>main</emphasis></entry>
21918 <entry>Type: <emphasis>boolean</emphasis></entry>
21919 <entry>Default: <emphasis>false</emphasis></entry>
21925 <indexterm role="concept">
21926 <primary><function>fsync()</function>, disabling</primary>
21928 This option is available only if Exim was built with the compile-time option
21929 ENABLE_DISABLE_FSYNC. When this is not set, a reference to <option>disable_fsync</option> in
21930 a runtime configuration generates an <quote>unknown option</quote> error. You should not
21931 build Exim with ENABLE_DISABLE_FSYNC or set <option>disable_fsync</option> unless you
21932 really, really, really understand what you are doing. <emphasis>No pre-compiled
21933 distributions of Exim should ever make this option available.</emphasis>
21936 When <option>disable_fsync</option> is set true, Exim no longer calls <function>fsync()</function> to force
21937 updated files’ data to be written to disc before continuing. Unexpected events
21938 such as crashes and power outages may cause data to be lost or scrambled.
21939 Here be Dragons. <emphasis role="bold">Beware.</emphasis>
21942 <indexterm role="option">
21943 <primary><option>disable_ipv6</option></primary>
21946 <informaltable frame="all">
21947 <tgroup cols="4" colsep="0" rowsep="0">
21948 <colspec colwidth="8*" align="left"/>
21949 <colspec colwidth="6*" align="center"/>
21950 <colspec colwidth="6*" align="center"/>
21951 <colspec colwidth="6*" align="right"/>
21954 <entry><option>disable_ipv6</option></entry>
21955 <entry>Use: <emphasis>main</emphasis></entry>
21956 <entry>Type: <emphasis>boolean</emphasis></entry>
21957 <entry>Default: <emphasis>false</emphasis></entry>
21963 <indexterm role="concept">
21964 <primary>IPv6</primary>
21965 <secondary>disabling</secondary>
21967 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
21968 activities take place. AAAA records are never looked up, and any IPv6 addresses
21969 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
21970 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
21971 to handle IPv6 literal addresses.
21974 <indexterm role="option">
21975 <primary><option>dns_again_means_nonexist</option></primary>
21978 <informaltable frame="all">
21979 <tgroup cols="4" colsep="0" rowsep="0">
21980 <colspec colwidth="8*" align="left"/>
21981 <colspec colwidth="6*" align="center"/>
21982 <colspec colwidth="6*" align="center"/>
21983 <colspec colwidth="6*" align="right"/>
21986 <entry><option>dns_again_means_nonexist</option></entry>
21987 <entry>Use: <emphasis>main</emphasis></entry>
21988 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
21989 <entry>Default: <emphasis>unset</emphasis></entry>
21995 <indexterm role="concept">
21996 <primary>DNS</primary>
21997 <secondary><quote>try again</quote> response; overriding</secondary>
21999 DNS lookups give a <quote>try again</quote> response for the DNS errors
22000 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
22001 keep trying to deliver a message, or to give repeated temporary errors to
22002 incoming mail. Sometimes the effect is caused by a badly set up name server and
22003 may persist for a long time. If a domain which exhibits this problem matches
22004 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
22005 This option should be used with care. You can make it apply to reverse lookups
22006 by a setting such as this:
22008 <literallayout class="monospaced">
22009 dns_again_means_nonexist = *.in-addr.arpa
22012 This option applies to all DNS lookups that Exim does. It also applies when the
22013 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
22014 since these are most likely to be caused by DNS lookup problems. The
22015 <command>dnslookup</command> router has some options of its own for controlling what happens
22016 when lookups for MX or SRV records give temporary errors. These more specific
22017 options are applied after this global option.
22020 <indexterm role="option">
22021 <primary><option>dns_check_names_pattern</option></primary>
22024 <informaltable frame="all">
22025 <tgroup cols="4" colsep="0" rowsep="0">
22026 <colspec colwidth="8*" align="left"/>
22027 <colspec colwidth="6*" align="center"/>
22028 <colspec colwidth="6*" align="center"/>
22029 <colspec colwidth="6*" align="right"/>
22032 <entry><option>dns_check_names_pattern</option></entry>
22033 <entry>Use: <emphasis>main</emphasis></entry>
22034 <entry>Type: <emphasis>string</emphasis></entry>
22035 <entry>Default: <emphasis>see below</emphasis></entry>
22041 <indexterm role="concept">
22042 <primary>DNS</primary>
22043 <secondary>pre-check of name syntax</secondary>
22045 When this option is set to a non-empty string, it causes Exim to check domain
22046 names for characters that are not allowed in host names before handing them to
22047 the DNS resolver, because some resolvers give temporary errors for names that
22048 contain unusual characters. If a domain name contains any unwanted characters,
22049 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
22050 done by matching the domain name against a regular expression, which is the
22051 value of this option. The default pattern is
22053 <literallayout class="monospaced">
22054 dns_check_names_pattern = \
22055 (?i)^(?>(?(1)\.|())[^\W_](?>[a-z0-9/-]*[^\W_])?)+$
22058 which permits only letters, digits, slashes, and hyphens in components, but
22059 they must start and end with a letter or digit. Slashes are not, in fact,
22060 permitted in host names, but they are found in certain NS records (which can be
22061 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
22062 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
22066 <indexterm role="option">
22067 <primary><option>dns_csa_search_limit</option></primary>
22070 <informaltable frame="all">
22071 <tgroup cols="4" colsep="0" rowsep="0">
22072 <colspec colwidth="8*" align="left"/>
22073 <colspec colwidth="6*" align="center"/>
22074 <colspec colwidth="6*" align="center"/>
22075 <colspec colwidth="6*" align="right"/>
22078 <entry><option>dns_csa_search_limit</option></entry>
22079 <entry>Use: <emphasis>main</emphasis></entry>
22080 <entry>Type: <emphasis>integer</emphasis></entry>
22081 <entry>Default: <emphasis>5</emphasis></entry>
22087 This option controls the depth of parental searching for CSA SRV records in the
22088 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
22091 <indexterm role="option">
22092 <primary><option>dns_csa_use_reverse</option></primary>
22095 <informaltable frame="all">
22096 <tgroup cols="4" colsep="0" rowsep="0">
22097 <colspec colwidth="8*" align="left"/>
22098 <colspec colwidth="6*" align="center"/>
22099 <colspec colwidth="6*" align="center"/>
22100 <colspec colwidth="6*" align="right"/>
22103 <entry><option>dns_csa_use_reverse</option></entry>
22104 <entry>Use: <emphasis>main</emphasis></entry>
22105 <entry>Type: <emphasis>boolean</emphasis></entry>
22106 <entry>Default: <emphasis>true</emphasis></entry>
22112 This option controls whether or not an IP address, given as a CSA domain, is
22113 reversed and looked up in the reverse DNS, as described in more detail in
22114 section <xref linkend="SECTverifyCSA"/>.
22117 <indexterm role="option">
22118 <primary><option>dns_ipv4_lookup</option></primary>
22121 <informaltable frame="all">
22122 <tgroup cols="4" colsep="0" rowsep="0">
22123 <colspec colwidth="8*" align="left"/>
22124 <colspec colwidth="6*" align="center"/>
22125 <colspec colwidth="6*" align="center"/>
22126 <colspec colwidth="6*" align="right"/>
22129 <entry><option>dns_ipv4_lookup</option></entry>
22130 <entry>Use: <emphasis>main</emphasis></entry>
22131 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
22132 <entry>Default: <emphasis>unset</emphasis></entry>
22138 <indexterm role="concept">
22139 <primary>IPv6</primary>
22140 <secondary>DNS lookup for AAAA records</secondary>
22142 <indexterm role="concept">
22143 <primary>DNS</primary>
22144 <secondary>IPv6 lookup for AAAA records</secondary>
22146 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
22147 looks for IPv6 address records (AAAA records) as well as IPv4 address records
22148 (A records) when trying to find IP addresses for hosts, unless the host’s
22149 domain matches this list.
22152 This is a fudge to help with name servers that give big delays or otherwise do
22153 not work for the AAAA record type. In due course, when the world’s name
22154 servers have all been upgraded, there should be no need for this option.
22157 <indexterm role="option">
22158 <primary><option>dns_retrans</option></primary>
22161 <informaltable frame="all">
22162 <tgroup cols="4" colsep="0" rowsep="0">
22163 <colspec colwidth="8*" align="left"/>
22164 <colspec colwidth="6*" align="center"/>
22165 <colspec colwidth="6*" align="center"/>
22166 <colspec colwidth="6*" align="right"/>
22169 <entry><option>dns_retrans</option></entry>
22170 <entry>Use: <emphasis>main</emphasis></entry>
22171 <entry>Type: <emphasis>time</emphasis></entry>
22172 <entry>Default: <emphasis>0s</emphasis></entry>
22178 <indexterm role="concept">
22179 <primary>DNS</primary>
22180 <secondary>resolver options</secondary>
22182 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
22183 retransmission and retry parameters for DNS lookups. Values of zero (the
22184 defaults) leave the system default settings unchanged. The first value is the
22185 time between retries, and the second is the number of retries. It isn’t
22186 totally clear exactly how these settings affect the total time a DNS lookup may
22187 take. I haven’t found any documentation about timeouts on DNS lookups; these
22188 parameter values are available in the external resolver interface structure,
22189 but nowhere does it seem to describe how they are used or what you might want
22193 <indexterm role="option">
22194 <primary><option>dns_retry</option></primary>
22197 <informaltable frame="all">
22198 <tgroup cols="4" colsep="0" rowsep="0">
22199 <colspec colwidth="8*" align="left"/>
22200 <colspec colwidth="6*" align="center"/>
22201 <colspec colwidth="6*" align="center"/>
22202 <colspec colwidth="6*" align="right"/>
22205 <entry><option>dns_retry</option></entry>
22206 <entry>Use: <emphasis>main</emphasis></entry>
22207 <entry>Type: <emphasis>integer</emphasis></entry>
22208 <entry>Default: <emphasis>0</emphasis></entry>
22214 See <option>dns_retrans</option> above.
22217 <indexterm role="option">
22218 <primary><option>drop_cr</option></primary>
22221 <informaltable frame="all">
22222 <tgroup cols="4" colsep="0" rowsep="0">
22223 <colspec colwidth="8*" align="left"/>
22224 <colspec colwidth="6*" align="center"/>
22225 <colspec colwidth="6*" align="center"/>
22226 <colspec colwidth="6*" align="right"/>
22229 <entry><option>drop_cr</option></entry>
22230 <entry>Use: <emphasis>main</emphasis></entry>
22231 <entry>Type: <emphasis>boolean</emphasis></entry>
22232 <entry>Default: <emphasis>false</emphasis></entry>
22238 This is an obsolete option that is now a no-op. It used to affect the way Exim
22239 handled CR and LF characters in incoming messages. What happens now is
22240 described in section <xref linkend="SECTlineendings"/>.
22243 <indexterm role="option">
22244 <primary><option>dsn_from</option></primary>
22247 <informaltable frame="all">
22248 <tgroup cols="4" colsep="0" rowsep="0">
22249 <colspec colwidth="8*" align="left"/>
22250 <colspec colwidth="6*" align="center"/>
22251 <colspec colwidth="6*" align="center"/>
22252 <colspec colwidth="6*" align="right"/>
22255 <entry><option>dsn_from</option></entry>
22256 <entry>Use: <emphasis>main</emphasis></entry>
22257 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
22258 <entry>Default: <emphasis>see below</emphasis></entry>
22264 <indexterm role="concept">
22265 <primary><emphasis>From:</emphasis> header line</primary>
22266 <secondary>in bounces</secondary>
22268 <indexterm role="concept">
22269 <primary>bounce messages</primary>
22270 <secondary><emphasis>From:</emphasis> line, specifying</secondary>
22272 This option can be used to vary the contents of <emphasis>From:</emphasis> header lines in
22273 bounces and other automatically generated messages (<quote>Delivery Status
22274 Notifications</quote> – hence the name of the option). The default setting is:
22276 <literallayout class="monospaced">
22277 dsn_from = Mail Delivery System <Mailer-Daemon@$qualify_domain>
22280 The value is expanded every time it is needed. If the expansion fails, a
22281 panic is logged, and the default value is used.
22284 <indexterm role="option">
22285 <primary><option>envelope_to_remove</option></primary>
22288 <informaltable frame="all">
22289 <tgroup cols="4" colsep="0" rowsep="0">
22290 <colspec colwidth="8*" align="left"/>
22291 <colspec colwidth="6*" align="center"/>
22292 <colspec colwidth="6*" align="center"/>
22293 <colspec colwidth="6*" align="right"/>
22296 <entry><option>envelope_to_remove</option></entry>
22297 <entry>Use: <emphasis>main</emphasis></entry>
22298 <entry>Type: <emphasis>boolean</emphasis></entry>
22299 <entry>Default: <emphasis>true</emphasis></entry>
22305 <indexterm role="concept">
22306 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
22308 Exim’s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
22309 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
22310 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
22311 messages’s envelope that caused the delivery to happen. Such headers should not
22312 be present in incoming messages, and this option causes them to be removed at
22313 the time the message is received, to avoid any problems that might occur when a
22314 delivered message is subsequently sent on to some other recipient.
22317 <indexterm role="option">
22318 <primary><option>errors_copy</option></primary>
22321 <informaltable frame="all">
22322 <tgroup cols="4" colsep="0" rowsep="0">
22323 <colspec colwidth="8*" align="left"/>
22324 <colspec colwidth="6*" align="center"/>
22325 <colspec colwidth="6*" align="center"/>
22326 <colspec colwidth="6*" align="right"/>
22329 <entry><option>errors_copy</option></entry>
22330 <entry>Use: <emphasis>main</emphasis></entry>
22331 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
22332 <entry>Default: <emphasis>unset</emphasis></entry>
22338 <indexterm role="concept">
22339 <primary>bounce message</primary>
22340 <secondary>copy to other address</secondary>
22342 <indexterm role="concept">
22343 <primary>copy of bounce message</primary>
22345 Setting this option causes Exim to send bcc copies of bounce messages that it
22346 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
22347 coming from elsewhere. The value of the option is a colon-separated list of
22348 items. Each item consists of a pattern, terminated by white space, followed by
22349 a comma-separated list of email addresses. If a pattern contains spaces, it
22350 must be enclosed in double quotes.
22353 Each pattern is processed in the same way as a single item in an address list
22354 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
22355 the bounce message, the message is copied to the addresses on the list. The
22356 items are scanned in order, and once a matching one is found, no further items
22357 are examined. For example:
22359 <literallayout class="monospaced">
22360 errors_copy = spqr@mydomain postmaster@mydomain.example :\
22361 rqps@mydomain hostmaster@mydomain.example,\
22362 postmaster@mydomain.example
22365 <indexterm role="variable">
22366 <primary><varname>$domain</varname></primary>
22368 <indexterm role="variable">
22369 <primary><varname>$local_part</varname></primary>
22371 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
22372 and <varname>$domain</varname> are set from the original recipient of the error message, and if
22373 there was any wildcard matching in the pattern, the expansion
22374 <indexterm role="concept">
22375 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
22376 <secondary>in <option>errors_copy</option></secondary>
22378 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
22381 <indexterm role="option">
22382 <primary><option>errors_reply_to</option></primary>
22385 <informaltable frame="all">
22386 <tgroup cols="4" colsep="0" rowsep="0">
22387 <colspec colwidth="8*" align="left"/>
22388 <colspec colwidth="6*" align="center"/>
22389 <colspec colwidth="6*" align="center"/>
22390 <colspec colwidth="6*" align="right"/>
22393 <entry><option>errors_reply_to</option></entry>
22394 <entry>Use: <emphasis>main</emphasis></entry>
22395 <entry>Type: <emphasis>string</emphasis></entry>
22396 <entry>Default: <emphasis>unset</emphasis></entry>
22402 <indexterm role="concept">
22403 <primary>bounce message</primary>
22404 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
22406 By default, Exim’s bounce and delivery warning messages contain the header line
22409 <literal>From: Mail Delivery System <Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>></literal>
22412 <indexterm role="option">
22413 <primary><option>quota_warn_message</option></primary>
22415 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
22416 A warning message that is generated by the <option>quota_warn_message</option> option in an
22417 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
22418 overrides the default.
22421 Experience shows that people reply to bounce messages. If the
22422 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
22423 and warning messages. For example:
22425 <literallayout class="monospaced">
22426 errors_reply_to = postmaster@my.domain.example
22429 The value of the option is not expanded. It must specify a valid RFC 2822
22430 address. However, if a warning message that is generated by the
22431 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
22432 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
22436 <indexterm role="option">
22437 <primary><option>exim_group</option></primary>
22440 <informaltable frame="all">
22441 <tgroup cols="4" colsep="0" rowsep="0">
22442 <colspec colwidth="8*" align="left"/>
22443 <colspec colwidth="6*" align="center"/>
22444 <colspec colwidth="6*" align="center"/>
22445 <colspec colwidth="6*" align="right"/>
22448 <entry><option>exim_group</option></entry>
22449 <entry>Use: <emphasis>main</emphasis></entry>
22450 <entry>Type: <emphasis>string</emphasis></entry>
22451 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
22457 <indexterm role="concept">
22458 <primary>gid (group id)</primary>
22459 <secondary>Exim’s own</secondary>
22461 <indexterm role="concept">
22462 <primary>Exim group</primary>
22464 This option changes the gid under which Exim runs when it gives up root
22465 privilege. The default value is compiled into the binary. The value of this
22466 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
22467 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
22468 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
22472 <indexterm role="option">
22473 <primary><option>exim_path</option></primary>
22476 <informaltable frame="all">
22477 <tgroup cols="4" colsep="0" rowsep="0">
22478 <colspec colwidth="8*" align="left"/>
22479 <colspec colwidth="6*" align="center"/>
22480 <colspec colwidth="6*" align="center"/>
22481 <colspec colwidth="6*" align="right"/>
22484 <entry><option>exim_path</option></entry>
22485 <entry>Use: <emphasis>main</emphasis></entry>
22486 <entry>Type: <emphasis>string</emphasis></entry>
22487 <entry>Default: <emphasis>see below</emphasis></entry>
22493 <indexterm role="concept">
22494 <primary>Exim binary, path name</primary>
22496 This option specifies the path name of the Exim binary, which is used when Exim
22497 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
22498 the directory configured at compile time by the BIN_DIRECTORY setting. It
22499 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
22501 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
22502 you will break those Exim utilities that scan the configuration file to find
22503 where the binary is. (They then use the <option>-bP</option> option to extract option
22504 settings such as the value of <option>spool_directory</option>.)
22507 <indexterm role="option">
22508 <primary><option>exim_user</option></primary>
22511 <informaltable frame="all">
22512 <tgroup cols="4" colsep="0" rowsep="0">
22513 <colspec colwidth="8*" align="left"/>
22514 <colspec colwidth="6*" align="center"/>
22515 <colspec colwidth="6*" align="center"/>
22516 <colspec colwidth="6*" align="right"/>
22519 <entry><option>exim_user</option></entry>
22520 <entry>Use: <emphasis>main</emphasis></entry>
22521 <entry>Type: <emphasis>string</emphasis></entry>
22522 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
22528 <indexterm role="concept">
22529 <primary>uid (user id)</primary>
22530 <secondary>Exim’s own</secondary>
22532 <indexterm role="concept">
22533 <primary>Exim user</primary>
22535 This option changes the uid under which Exim runs when it gives up root
22536 privilege. The default value is compiled into the binary. Ownership of the run
22537 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
22538 options is checked against the values in the binary, not what is set here.
22541 Unless it consists entirely of digits, the string is looked up using
22542 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
22543 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
22544 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
22547 <indexterm role="option">
22548 <primary><option>extra_local_interfaces</option></primary>
22551 <informaltable frame="all">
22552 <tgroup cols="4" colsep="0" rowsep="0">
22553 <colspec colwidth="8*" align="left"/>
22554 <colspec colwidth="6*" align="center"/>
22555 <colspec colwidth="6*" align="center"/>
22556 <colspec colwidth="6*" align="right"/>
22559 <entry><option>extra_local_interfaces</option></entry>
22560 <entry>Use: <emphasis>main</emphasis></entry>
22561 <entry>Type: <emphasis>string list</emphasis></entry>
22562 <entry>Default: <emphasis>unset</emphasis></entry>
22568 This option defines network interfaces that are to be considered local when
22569 routing, but which are not used for listening by the daemon. See section
22570 <xref linkend="SECTreclocipadd"/> for details.
22573 <indexterm role="option">
22574 <primary><option>extract_addresses_remove_arguments</option></primary>
22577 <informaltable frame="all">
22578 <tgroup cols="4" colsep="0" rowsep="0">
22579 <colspec colwidth="8*" align="left"/>
22580 <colspec colwidth="6*" align="center"/>
22581 <colspec colwidth="6*" align="center"/>
22582 <colspec colwidth="6*" align="right"/>
22585 <entry><option>extract_addresses_remove_ arguments</option></entry>
22586 <entry>Use: <emphasis>main</emphasis></entry>
22587 <entry>Type: <emphasis>boolean</emphasis></entry>
22588 <entry>Default: <emphasis>true</emphasis></entry>
22594 <indexterm role="option">
22595 <primary><option>-t</option></primary>
22597 <indexterm role="concept">
22598 <primary>command line</primary>
22599 <secondary>addresses with <option>-t</option></secondary>
22601 <indexterm role="concept">
22602 <primary>Sendmail compatibility</primary>
22603 <secondary><option>-t</option> option</secondary>
22605 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
22606 are present on the command line when the <option>-t</option> option is used to build an
22607 envelope from a message’s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
22608 line addresses are removed from the recipients list. This is also how Smail
22609 behaves. However, other Sendmail documentation (the O’Reilly book) states that
22610 command line addresses are added to those obtained from the header lines. When
22611 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
22612 argument headers. If it is set false, Exim adds rather than removes argument
22616 <indexterm role="option">
22617 <primary><option>finduser_retries</option></primary>
22620 <informaltable frame="all">
22621 <tgroup cols="4" colsep="0" rowsep="0">
22622 <colspec colwidth="8*" align="left"/>
22623 <colspec colwidth="6*" align="center"/>
22624 <colspec colwidth="6*" align="center"/>
22625 <colspec colwidth="6*" align="right"/>
22628 <entry><option>finduser_retries</option></entry>
22629 <entry>Use: <emphasis>main</emphasis></entry>
22630 <entry>Type: <emphasis>integer</emphasis></entry>
22631 <entry>Default: <emphasis>0</emphasis></entry>
22637 <indexterm role="concept">
22638 <primary>NIS, retrying user lookups</primary>
22640 On systems running NIS or other schemes in which user and group information is
22641 distributed from a remote system, there can be times when <function>getpwnam()</function> and
22642 related functions fail, even when given valid data, because things time out.
22643 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
22644 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
22645 many extra times to find a user or a group, waiting for one second between
22649 <indexterm role="concept">
22650 <primary><filename>/etc/passwd</filename></primary>
22651 <secondary>multiple reading of</secondary>
22653 You should not set this option greater than zero if your user information is in
22654 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
22655 search the file multiple times for non-existent users, and also cause delay.
22658 <indexterm role="option">
22659 <primary><option>freeze_tell</option></primary>
22662 <informaltable frame="all">
22663 <tgroup cols="4" colsep="0" rowsep="0">
22664 <colspec colwidth="8*" align="left"/>
22665 <colspec colwidth="6*" align="center"/>
22666 <colspec colwidth="6*" align="center"/>
22667 <colspec colwidth="6*" align="right"/>
22670 <entry><option>freeze_tell</option></entry>
22671 <entry>Use: <emphasis>main</emphasis></entry>
22672 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
22673 <entry>Default: <emphasis>unset</emphasis></entry>
22679 <indexterm role="concept">
22680 <primary>freezing messages</primary>
22681 <secondary>sending a message when freezing</secondary>
22683 On encountering certain errors, or when configured to do so in a system filter,
22684 ACL, or special router, Exim freezes a message. This means that no further
22685 delivery attempts take place until an administrator thaws the message, or the
22686 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
22687 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
22688 warning message whenever it freezes something, unless the message it is
22689 freezing is a locally-generated bounce message. (Without this exception there
22690 is the possibility of looping.) The warning message is sent to the addresses
22691 supplied as the comma-separated value of this option. If several of the
22692 message’s addresses cause freezing, only a single message is sent. If the
22693 freezing was automatic, the reason(s) for freezing can be found in the message
22694 log. If you configure freezing in a filter or ACL, you must arrange for any
22695 logging that you require.
22698 <indexterm role="option">
22699 <primary><option>gecos_name</option></primary>
22702 <informaltable frame="all">
22703 <tgroup cols="4" colsep="0" rowsep="0">
22704 <colspec colwidth="8*" align="left"/>
22705 <colspec colwidth="6*" align="center"/>
22706 <colspec colwidth="6*" align="center"/>
22707 <colspec colwidth="6*" align="right"/>
22710 <entry><option>gecos_name</option></entry>
22711 <entry>Use: <emphasis>main</emphasis></entry>
22712 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
22713 <entry>Default: <emphasis>unset</emphasis></entry>
22719 <indexterm role="concept">
22720 <primary>HP-UX</primary>
22722 <indexterm role="concept">
22723 <primary><quote>gecos</quote> field, parsing</primary>
22725 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
22726 password file to hold other information in addition to users’ real names. Exim
22727 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
22728 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
22729 of the field are used unchanged, except that, if an ampersand is encountered,
22730 it is replaced by the user’s login name with the first character forced to
22731 upper case, since this is a convention that is observed on many systems.
22734 When these options are set, <option>gecos_pattern</option> is treated as a regular
22735 expression that is to be applied to the field (again with & replaced by the
22736 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
22737 user’s name.
22740 <indexterm role="concept">
22741 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
22742 <secondary>in <option>gecos_name</option></secondary>
22744 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
22745 pick up sub-fields that were matched by the pattern. In HP-UX, where the user’s
22746 name terminates at the first comma, the following can be used:
22748 <literallayout class="monospaced">
22749 gecos_pattern = ([^,]*)
22753 <indexterm role="option">
22754 <primary><option>gecos_pattern</option></primary>
22757 <informaltable frame="all">
22758 <tgroup cols="4" colsep="0" rowsep="0">
22759 <colspec colwidth="8*" align="left"/>
22760 <colspec colwidth="6*" align="center"/>
22761 <colspec colwidth="6*" align="center"/>
22762 <colspec colwidth="6*" align="right"/>
22765 <entry><option>gecos_pattern</option></entry>
22766 <entry>Use: <emphasis>main</emphasis></entry>
22767 <entry>Type: <emphasis>string</emphasis></entry>
22768 <entry>Default: <emphasis>unset</emphasis></entry>
22774 See <option>gecos_name</option> above.
22777 <indexterm role="option">
22778 <primary><option>gnutls_require_kx</option></primary>
22781 <informaltable frame="all">
22782 <tgroup cols="4" colsep="0" rowsep="0">
22783 <colspec colwidth="8*" align="left"/>
22784 <colspec colwidth="6*" align="center"/>
22785 <colspec colwidth="6*" align="center"/>
22786 <colspec colwidth="6*" align="right"/>
22789 <entry><option>gnutls_require_kx</option></entry>
22790 <entry>Use: <emphasis>main</emphasis></entry>
22791 <entry>Type: <emphasis>string</emphasis></entry>
22792 <entry>Default: <emphasis>unset</emphasis></entry>
22798 This option controls the key exchange mechanisms when GnuTLS is used in an Exim
22799 server. For details, see section <xref linkend="SECTreqciphgnu"/>.
22802 <indexterm role="option">
22803 <primary><option>gnutls_require_mac</option></primary>
22806 <informaltable frame="all">
22807 <tgroup cols="4" colsep="0" rowsep="0">
22808 <colspec colwidth="8*" align="left"/>
22809 <colspec colwidth="6*" align="center"/>
22810 <colspec colwidth="6*" align="center"/>
22811 <colspec colwidth="6*" align="right"/>
22814 <entry><option>gnutls_require_mac</option></entry>
22815 <entry>Use: <emphasis>main</emphasis></entry>
22816 <entry>Type: <emphasis>string</emphasis></entry>
22817 <entry>Default: <emphasis>unset</emphasis></entry>
22823 This option controls the MAC algorithms when GnuTLS is used in an Exim
22824 server. For details, see section <xref linkend="SECTreqciphgnu"/>.
22827 <indexterm role="option">
22828 <primary><option>gnutls_require_protocols</option></primary>
22831 <informaltable frame="all">
22832 <tgroup cols="4" colsep="0" rowsep="0">
22833 <colspec colwidth="8*" align="left"/>
22834 <colspec colwidth="6*" align="center"/>
22835 <colspec colwidth="6*" align="center"/>
22836 <colspec colwidth="6*" align="right"/>
22839 <entry><option>gnutls_require_protocols</option></entry>
22840 <entry>Use: <emphasis>main</emphasis></entry>
22841 <entry>Type: <emphasis>string</emphasis></entry>
22842 <entry>Default: <emphasis>unset</emphasis></entry>
22848 This option controls the protocols when GnuTLS is used in an Exim
22849 server. For details, see section <xref linkend="SECTreqciphgnu"/>.
22852 <indexterm role="option">
22853 <primary><option>gnutls_compat_mode</option></primary>
22856 <informaltable frame="all">
22857 <tgroup cols="4" colsep="0" rowsep="0">
22858 <colspec colwidth="8*" align="left"/>
22859 <colspec colwidth="6*" align="center"/>
22860 <colspec colwidth="6*" align="center"/>
22861 <colspec colwidth="6*" align="right"/>
22864 <entry><option>gnutls_compat_mode</option></entry>
22865 <entry>Use: <emphasis>main</emphasis></entry>
22866 <entry>Type: <emphasis>boolean</emphasis></entry>
22867 <entry>Default: <emphasis>unset</emphasis></entry>
22873 This option controls whether GnuTLS is used in compatibility mode in an Exim
22874 server. This reduces security slightly, but improves interworking with older
22875 implementations of TLS.
22878 <indexterm role="option">
22879 <primary><option>headers_charset</option></primary>
22882 <informaltable frame="all">
22883 <tgroup cols="4" colsep="0" rowsep="0">
22884 <colspec colwidth="8*" align="left"/>
22885 <colspec colwidth="6*" align="center"/>
22886 <colspec colwidth="6*" align="center"/>
22887 <colspec colwidth="6*" align="right"/>
22890 <entry><option>headers_charset</option></entry>
22891 <entry>Use: <emphasis>main</emphasis></entry>
22892 <entry>Type: <emphasis>string</emphasis></entry>
22893 <entry>Default: <emphasis>see below</emphasis></entry>
22899 This option sets a default character set for translating from encoded MIME
22900 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
22901 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
22902 ultimate default is ISO-8859-1. For more details see the description of header
22903 insertions in section <xref linkend="SECTexpansionitems"/>.
22906 <indexterm role="option">
22907 <primary><option>header_maxsize</option></primary>
22910 <informaltable frame="all">
22911 <tgroup cols="4" colsep="0" rowsep="0">
22912 <colspec colwidth="8*" align="left"/>
22913 <colspec colwidth="6*" align="center"/>
22914 <colspec colwidth="6*" align="center"/>
22915 <colspec colwidth="6*" align="right"/>
22918 <entry><option>header_maxsize</option></entry>
22919 <entry>Use: <emphasis>main</emphasis></entry>
22920 <entry>Type: <emphasis>integer</emphasis></entry>
22921 <entry>Default: <emphasis>see below</emphasis></entry>
22927 <indexterm role="concept">
22928 <primary>header section</primary>
22929 <secondary>maximum size of</secondary>
22931 <indexterm role="concept">
22932 <primary>limit</primary>
22933 <secondary>size of message header section</secondary>
22935 This option controls the overall maximum size of a message’s header
22936 section. The default is the value of HEADER_MAXSIZE in
22937 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
22938 sections are rejected.
22941 <indexterm role="option">
22942 <primary><option>header_line_maxsize</option></primary>
22945 <informaltable frame="all">
22946 <tgroup cols="4" colsep="0" rowsep="0">
22947 <colspec colwidth="8*" align="left"/>
22948 <colspec colwidth="6*" align="center"/>
22949 <colspec colwidth="6*" align="center"/>
22950 <colspec colwidth="6*" align="right"/>
22953 <entry><option>header_line_maxsize</option></entry>
22954 <entry>Use: <emphasis>main</emphasis></entry>
22955 <entry>Type: <emphasis>integer</emphasis></entry>
22956 <entry>Default: <emphasis>0</emphasis></entry>
22962 <indexterm role="concept">
22963 <primary>header lines</primary>
22964 <secondary>maximum size of</secondary>
22966 <indexterm role="concept">
22967 <primary>limit</primary>
22968 <secondary>size of one header line</secondary>
22970 This option limits the length of any individual header line in a message, after
22971 all the continuations have been joined together. Messages with individual
22972 header lines that are longer than the limit are rejected. The default value of
22973 zero means <quote>no limit</quote>.
22976 <indexterm role="option">
22977 <primary><option>helo_accept_junk_hosts</option></primary>
22980 <informaltable frame="all">
22981 <tgroup cols="4" colsep="0" rowsep="0">
22982 <colspec colwidth="8*" align="left"/>
22983 <colspec colwidth="6*" align="center"/>
22984 <colspec colwidth="6*" align="center"/>
22985 <colspec colwidth="6*" align="right"/>
22988 <entry><option>helo_accept_junk_hosts</option></entry>
22989 <entry>Use: <emphasis>main</emphasis></entry>
22990 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
22991 <entry>Default: <emphasis>unset</emphasis></entry>
22997 <indexterm role="concept">
22998 <primary>HELO</primary>
22999 <secondary>accepting junk data</secondary>
23001 <indexterm role="concept">
23002 <primary>EHLO</primary>
23003 <secondary>accepting junk data</secondary>
23005 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
23006 mail, and gives an error response for invalid data. Unfortunately, there are
23007 some SMTP clients that send syntactic junk. They can be accommodated by setting
23008 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
23009 if you want to do semantic checking.
23010 See also <option>helo_allow_chars</option> for a way of extending the permitted character
23014 <indexterm role="option">
23015 <primary><option>helo_allow_chars</option></primary>
23018 <informaltable frame="all">
23019 <tgroup cols="4" colsep="0" rowsep="0">
23020 <colspec colwidth="8*" align="left"/>
23021 <colspec colwidth="6*" align="center"/>
23022 <colspec colwidth="6*" align="center"/>
23023 <colspec colwidth="6*" align="right"/>
23026 <entry><option>helo_allow_chars</option></entry>
23027 <entry>Use: <emphasis>main</emphasis></entry>
23028 <entry>Type: <emphasis>string</emphasis></entry>
23029 <entry>Default: <emphasis>unset</emphasis></entry>
23035 <indexterm role="concept">
23036 <primary>HELO</primary>
23037 <secondary>underscores in</secondary>
23039 <indexterm role="concept">
23040 <primary>EHLO</primary>
23041 <secondary>underscores in</secondary>
23043 <indexterm role="concept">
23044 <primary>underscore in EHLO/HELO</primary>
23046 This option can be set to a string of rogue characters that are permitted in
23047 all EHLO and HELO names in addition to the standard letters, digits,
23048 hyphens, and dots. If you really must allow underscores, you can set
23050 <literallayout class="monospaced">
23051 helo_allow_chars = _
23054 Note that the value is one string, not a list.
23057 <indexterm role="option">
23058 <primary><option>helo_lookup_domains</option></primary>
23061 <informaltable frame="all">
23062 <tgroup cols="4" colsep="0" rowsep="0">
23063 <colspec colwidth="8*" align="left"/>
23064 <colspec colwidth="6*" align="center"/>
23065 <colspec colwidth="6*" align="center"/>
23066 <colspec colwidth="6*" align="right"/>
23069 <entry><option>helo_lookup_domains</option></entry>
23070 <entry>Use: <emphasis>main</emphasis></entry>
23071 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
23072 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
23078 <indexterm role="concept">
23079 <primary>HELO</primary>
23080 <secondary>forcing reverse lookup</secondary>
23082 <indexterm role="concept">
23083 <primary>EHLO</primary>
23084 <secondary>forcing reverse lookup</secondary>
23086 If the domain given by a client in a HELO or EHLO command matches this
23087 list, a reverse lookup is done in order to establish the host’s true name. The
23088 default forces a lookup if the client host gives the server’s name or any of
23089 its IP addresses (in brackets), something that broken clients have been seen to
23093 <indexterm role="option">
23094 <primary><option>helo_try_verify_hosts</option></primary>
23097 <informaltable frame="all">
23098 <tgroup cols="4" colsep="0" rowsep="0">
23099 <colspec colwidth="8*" align="left"/>
23100 <colspec colwidth="6*" align="center"/>
23101 <colspec colwidth="6*" align="center"/>
23102 <colspec colwidth="6*" align="right"/>
23105 <entry><option>helo_try_verify_hosts</option></entry>
23106 <entry>Use: <emphasis>main</emphasis></entry>
23107 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
23108 <entry>Default: <emphasis>unset</emphasis></entry>
23114 <indexterm role="concept">
23115 <primary>HELO verifying</primary>
23116 <secondary>optional</secondary>
23118 <indexterm role="concept">
23119 <primary>EHLO</primary>
23120 <secondary>verifying, optional</secondary>
23122 By default, Exim just checks the syntax of HELO and EHLO commands (see
23123 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
23124 to do more extensive checking of the data supplied by these commands. The ACL
23125 condition <literal>verify = helo</literal> is provided to make this possible.
23126 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
23127 to force the check to occur. From release 4.53 onwards, this is no longer
23128 necessary. If the check has not been done before <literal>verify = helo</literal> is
23129 encountered, it is done at that time. Consequently, this option is obsolete.
23130 Its specification is retained here for backwards compatibility.
23133 When an EHLO or HELO command is received, if the calling host matches
23134 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
23135 EHLO command either:
23140 is an IP literal matching the calling address of the host, or
23145 <indexterm role="concept">
23146 <primary>DNS</primary>
23147 <secondary>reverse lookup</secondary>
23149 <indexterm role="concept">
23150 <primary>reverse DNS lookup</primary>
23152 matches the host name that Exim obtains by doing a reverse lookup of the
23153 calling host address, or
23158 when looked up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when
23159 available) yields the calling host address.
23164 However, the EHLO or HELO command is not rejected if any of the checks
23165 fail. Processing continues, but the result of the check is remembered, and can
23166 be detected later in an ACL by the <literal>verify = helo</literal> condition.
23169 <indexterm role="option">
23170 <primary><option>helo_verify_hosts</option></primary>
23173 <informaltable frame="all">
23174 <tgroup cols="4" colsep="0" rowsep="0">
23175 <colspec colwidth="8*" align="left"/>
23176 <colspec colwidth="6*" align="center"/>
23177 <colspec colwidth="6*" align="center"/>
23178 <colspec colwidth="6*" align="right"/>
23181 <entry><option>helo_verify_hosts</option></entry>
23182 <entry>Use: <emphasis>main</emphasis></entry>
23183 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
23184 <entry>Default: <emphasis>unset</emphasis></entry>
23190 <indexterm role="concept">
23191 <primary>HELO verifying</primary>
23192 <secondary>mandatory</secondary>
23194 <indexterm role="concept">
23195 <primary>EHLO</primary>
23196 <secondary>verifying, mandatory</secondary>
23198 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
23199 backwards compatibility. For hosts that match this option, Exim checks the host
23200 name given in the HELO or EHLO in the same way as for
23201 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
23202 rejected with a 550 error, and entries are written to the main and reject logs.
23203 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
23207 <indexterm role="option">
23208 <primary><option>hold_domains</option></primary>
23211 <informaltable frame="all">
23212 <tgroup cols="4" colsep="0" rowsep="0">
23213 <colspec colwidth="8*" align="left"/>
23214 <colspec colwidth="6*" align="center"/>
23215 <colspec colwidth="6*" align="center"/>
23216 <colspec colwidth="6*" align="right"/>
23219 <entry><option>hold_domains</option></entry>
23220 <entry>Use: <emphasis>main</emphasis></entry>
23221 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
23222 <entry>Default: <emphasis>unset</emphasis></entry>
23228 <indexterm role="concept">
23229 <primary>domain</primary>
23230 <secondary>delaying delivery</secondary>
23232 <indexterm role="concept">
23233 <primary>delivery</primary>
23234 <secondary>delaying certain domains</secondary>
23236 This option allows mail for particular domains to be held on the queue
23237 manually. The option is overridden if a message delivery is forced with the
23238 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
23239 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
23240 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
23241 it is deferred every time the message is looked at.
23244 This option is intended as a temporary operational measure for delaying the
23245 delivery of mail while some problem is being sorted out, or some new
23246 configuration tested. If you just want to delay the processing of some
23247 domains until a queue run occurs, you should use <option>queue_domains</option> or
23248 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
23251 A setting of <option>hold_domains</option> does not override Exim’s code for removing
23252 messages from the queue if they have been there longer than the longest retry
23253 time in any retry rule. If you want to hold messages for longer than the normal
23254 retry times, insert a dummy retry rule with a long retry time.
23257 <indexterm role="option">
23258 <primary><option>host_lookup</option></primary>
23261 <informaltable frame="all">
23262 <tgroup cols="4" colsep="0" rowsep="0">
23263 <colspec colwidth="8*" align="left"/>
23264 <colspec colwidth="6*" align="center"/>
23265 <colspec colwidth="6*" align="center"/>
23266 <colspec colwidth="6*" align="right"/>
23269 <entry><option>host_lookup</option></entry>
23270 <entry>Use: <emphasis>main</emphasis></entry>
23271 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
23272 <entry>Default: <emphasis>unset</emphasis></entry>
23278 <indexterm role="concept">
23279 <primary>host name</primary>
23280 <secondary>lookup, forcing</secondary>
23282 Exim does not look up the name of a calling host from its IP address unless it
23283 is required to compare against some host list, or the host matches
23284 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
23285 option (which normally contains IP addresses rather than host names). The
23286 default configuration file contains
23288 <literallayout class="monospaced">
23292 which causes a lookup to happen for all hosts. If the expense of these lookups
23293 is felt to be too great, the setting can be changed or removed.
23296 After a successful reverse lookup, Exim does a forward lookup on the name it
23297 has obtained, to verify that it yields the IP address that it started with. If
23298 this check fails, Exim behaves as if the name lookup failed.
23301 <indexterm role="variable">
23302 <primary><varname>$host_lookup_failed</varname></primary>
23304 <indexterm role="variable">
23305 <primary><varname>$sender_host_name</varname></primary>
23307 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
23308 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
23309 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and
23310 <literal>verify = reverse_host_lookup</literal> in ACLs.
23313 <indexterm role="option">
23314 <primary><option>host_lookup_order</option></primary>
23317 <informaltable frame="all">
23318 <tgroup cols="4" colsep="0" rowsep="0">
23319 <colspec colwidth="8*" align="left"/>
23320 <colspec colwidth="6*" align="center"/>
23321 <colspec colwidth="6*" align="center"/>
23322 <colspec colwidth="6*" align="right"/>
23325 <entry><option>host_lookup_order</option></entry>
23326 <entry>Use: <emphasis>main</emphasis></entry>
23327 <entry>Type: <emphasis>string list</emphasis></entry>
23328 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
23334 This option specifies the order of different lookup methods when Exim is trying
23335 to find a host name from an IP address. The default is to do a DNS lookup
23336 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
23337 if that fails. You can change the order of these lookups, or omit one entirely,
23341 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
23342 multiple PTR records in the DNS and the IP address is not listed in
23343 <filename>/etc/hosts</filename>. Different operating systems give different results in this
23344 case. That is why the default tries a DNS lookup first.
23347 <indexterm role="option">
23348 <primary><option>host_reject_connection</option></primary>
23351 <informaltable frame="all">
23352 <tgroup cols="4" colsep="0" rowsep="0">
23353 <colspec colwidth="8*" align="left"/>
23354 <colspec colwidth="6*" align="center"/>
23355 <colspec colwidth="6*" align="center"/>
23356 <colspec colwidth="6*" align="right"/>
23359 <entry><option>host_reject_connection</option></entry>
23360 <entry>Use: <emphasis>main</emphasis></entry>
23361 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
23362 <entry>Default: <emphasis>unset</emphasis></entry>
23368 <indexterm role="concept">
23369 <primary>host</primary>
23370 <secondary>rejecting connections from</secondary>
23372 If this option is set, incoming SMTP calls from the hosts listed are rejected
23373 as soon as the connection is made.
23374 This option is obsolete, and retained only for backward compatibility, because
23375 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
23376 connections immediately.
23379 The ability to give an immediate rejection (either by this option or using an
23380 ACL) is provided for use in unusual cases. Many hosts will just try again,
23381 sometimes without much delay. Normally, it is better to use an ACL to reject
23382 incoming messages at a later stage, such as after RCPT commands. See
23383 chapter <xref linkend="CHAPACL"/>.
23386 <indexterm role="option">
23387 <primary><option>hosts_connection_nolog</option></primary>
23390 <informaltable frame="all">
23391 <tgroup cols="4" colsep="0" rowsep="0">
23392 <colspec colwidth="8*" align="left"/>
23393 <colspec colwidth="6*" align="center"/>
23394 <colspec colwidth="6*" align="center"/>
23395 <colspec colwidth="6*" align="right"/>
23398 <entry><option>hosts_connection_nolog</option></entry>
23399 <entry>Use: <emphasis>main</emphasis></entry>
23400 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
23401 <entry>Default: <emphasis>unset</emphasis></entry>
23407 <indexterm role="concept">
23408 <primary>host</primary>
23409 <secondary>not logging connections from</secondary>
23411 This option defines a list of hosts for which connection logging does not
23412 happen, even though the <option>smtp_connection</option> log selector is set. For example,
23413 you might want not to log SMTP connections from local processes, or from
23414 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
23415 the daemon; you should therefore strive to restrict its value to a short inline
23416 list of IP addresses and networks. To disable logging SMTP connections from
23417 local processes, you must create a host list with an empty item. For example:
23419 <literallayout class="monospaced">
23420 hosts_connection_nolog = :
23423 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
23426 <indexterm role="option">
23427 <primary><option>hosts_treat_as_local</option></primary>
23430 <informaltable frame="all">
23431 <tgroup cols="4" colsep="0" rowsep="0">
23432 <colspec colwidth="8*" align="left"/>
23433 <colspec colwidth="6*" align="center"/>
23434 <colspec colwidth="6*" align="center"/>
23435 <colspec colwidth="6*" align="right"/>
23438 <entry><option>hosts_treat_as_local</option></entry>
23439 <entry>Use: <emphasis>main</emphasis></entry>
23440 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
23441 <entry>Default: <emphasis>unset</emphasis></entry>
23447 <indexterm role="concept">
23448 <primary>local host</primary>
23449 <secondary>domains treated as</secondary>
23451 <indexterm role="concept">
23452 <primary>host</primary>
23453 <secondary>treated as local</secondary>
23455 If this option is set, any host names that match the domain list are treated as
23456 if they were the local host when Exim is scanning host lists obtained from MX
23458 or other sources. Note that the value of this option is a domain list, not a
23459 host list, because it is always used to check host names, not IP addresses.
23462 This option also applies when Exim is matching the special items
23463 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
23464 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
23465 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
23466 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
23467 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
23468 interfaces and recognizing the local host.
23471 <indexterm role="option">
23472 <primary><option>ibase_servers</option></primary>
23475 <informaltable frame="all">
23476 <tgroup cols="4" colsep="0" rowsep="0">
23477 <colspec colwidth="8*" align="left"/>
23478 <colspec colwidth="6*" align="center"/>
23479 <colspec colwidth="6*" align="center"/>
23480 <colspec colwidth="6*" align="right"/>
23483 <entry><option>ibase_servers</option></entry>
23484 <entry>Use: <emphasis>main</emphasis></entry>
23485 <entry>Type: <emphasis>string list</emphasis></entry>
23486 <entry>Default: <emphasis>unset</emphasis></entry>
23492 <indexterm role="concept">
23493 <primary>InterBase</primary>
23494 <secondary>server list</secondary>
23496 This option provides a list of InterBase servers and associated connection data,
23497 to be used in conjunction with <command>ibase</command> lookups (see section <xref linkend="SECID72"/>).
23498 The option is available only if Exim has been built with InterBase support.
23501 <indexterm role="option">
23502 <primary><option>ignore_bounce_errors_after</option></primary>
23505 <informaltable frame="all">
23506 <tgroup cols="4" colsep="0" rowsep="0">
23507 <colspec colwidth="8*" align="left"/>
23508 <colspec colwidth="6*" align="center"/>
23509 <colspec colwidth="6*" align="center"/>
23510 <colspec colwidth="6*" align="right"/>
23513 <entry><option>ignore_bounce_errors_after</option></entry>
23514 <entry>Use: <emphasis>main</emphasis></entry>
23515 <entry>Type: <emphasis>time</emphasis></entry>
23516 <entry>Default: <emphasis>10w</emphasis></entry>
23522 <indexterm role="concept">
23523 <primary>bounce message</primary>
23524 <secondary>discarding</secondary>
23526 <indexterm role="concept">
23527 <primary>discarding bounce message</primary>
23529 This option affects the processing of bounce messages that cannot be delivered,
23530 that is, those that suffer a permanent delivery failure. (Bounce messages that
23531 suffer temporary delivery failures are of course retried in the usual way.)
23534 After a permanent delivery failure, bounce messages are frozen,
23535 because there is no sender to whom they can be returned. When a frozen bounce
23536 message has been on the queue for more than the given time, it is unfrozen at
23537 the next queue run, and a further delivery is attempted. If delivery fails
23538 again, the bounce message is discarded. This makes it possible to keep failed
23539 bounce messages around for a shorter time than the normal maximum retry time
23540 for frozen messages. For example,
23542 <literallayout class="monospaced">
23543 ignore_bounce_errors_after = 12h
23546 retries failed bounce message deliveries after 12 hours, discarding any further
23547 failures. If the value of this option is set to a zero time period, bounce
23548 failures are discarded immediately. Setting a very long time (as in the default
23549 value) has the effect of disabling this option. For ways of automatically
23550 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
23551 <option>timeout_frozen_after</option>.
23554 <indexterm role="option">
23555 <primary><option>ignore_fromline_hosts</option></primary>
23558 <informaltable frame="all">
23559 <tgroup cols="4" colsep="0" rowsep="0">
23560 <colspec colwidth="8*" align="left"/>
23561 <colspec colwidth="6*" align="center"/>
23562 <colspec colwidth="6*" align="center"/>
23563 <colspec colwidth="6*" align="right"/>
23566 <entry><option>ignore_fromline_hosts</option></entry>
23567 <entry>Use: <emphasis>main</emphasis></entry>
23568 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
23569 <entry>Default: <emphasis>unset</emphasis></entry>
23575 <indexterm role="concept">
23576 <primary><quote>From</quote> line</primary>
23578 <indexterm role="concept">
23579 <primary>UUCP</primary>
23580 <secondary><quote>From</quote> line</secondary>
23582 Some broken SMTP clients insist on sending a UUCP-like <quote>From </quote> line before
23583 the headers of a message. By default this is treated as the start of the
23584 message’s body, which means that any following headers are not recognized as
23585 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
23586 match those hosts that insist on sending it. If the sender is actually a local
23587 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
23588 <option>ignore_fromline_local</option> must be set to achieve this effect.
23591 <indexterm role="option">
23592 <primary><option>ignore_fromline_local</option></primary>
23595 <informaltable frame="all">
23596 <tgroup cols="4" colsep="0" rowsep="0">
23597 <colspec colwidth="8*" align="left"/>
23598 <colspec colwidth="6*" align="center"/>
23599 <colspec colwidth="6*" align="center"/>
23600 <colspec colwidth="6*" align="right"/>
23603 <entry><option>ignore_fromline_local</option></entry>
23604 <entry>Use: <emphasis>main</emphasis></entry>
23605 <entry>Type: <emphasis>boolean</emphasis></entry>
23606 <entry>Default: <emphasis>false</emphasis></entry>
23612 See <option>ignore_fromline_hosts</option> above.
23615 <indexterm role="option">
23616 <primary><option>keep_malformed</option></primary>
23619 <informaltable frame="all">
23620 <tgroup cols="4" colsep="0" rowsep="0">
23621 <colspec colwidth="8*" align="left"/>
23622 <colspec colwidth="6*" align="center"/>
23623 <colspec colwidth="6*" align="center"/>
23624 <colspec colwidth="6*" align="right"/>
23627 <entry><option>keep_malformed</option></entry>
23628 <entry>Use: <emphasis>main</emphasis></entry>
23629 <entry>Type: <emphasis>time</emphasis></entry>
23630 <entry>Default: <emphasis>4d</emphasis></entry>
23636 This option specifies the length of time to keep messages whose spool files
23637 have been corrupted in some way. This should, of course, never happen. At the
23638 next attempt to deliver such a message, it gets removed. The incident is
23642 <indexterm role="option">
23643 <primary><option>ldap_default_servers</option></primary>
23646 <informaltable frame="all">
23647 <tgroup cols="4" colsep="0" rowsep="0">
23648 <colspec colwidth="8*" align="left"/>
23649 <colspec colwidth="6*" align="center"/>
23650 <colspec colwidth="6*" align="center"/>
23651 <colspec colwidth="6*" align="right"/>
23654 <entry><option>ldap_default_servers</option></entry>
23655 <entry>Use: <emphasis>main</emphasis></entry>
23656 <entry>Type: <emphasis>string list</emphasis></entry>
23657 <entry>Default: <emphasis>unset</emphasis></entry>
23663 <indexterm role="concept">
23664 <primary>LDAP</primary>
23665 <secondary>default servers</secondary>
23667 This option provides a list of LDAP servers which are tried in turn when an
23668 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
23669 details of LDAP queries. This option is available only when Exim has been built
23673 <indexterm role="option">
23674 <primary><option>ldap_version</option></primary>
23677 <informaltable frame="all">
23678 <tgroup cols="4" colsep="0" rowsep="0">
23679 <colspec colwidth="8*" align="left"/>
23680 <colspec colwidth="6*" align="center"/>
23681 <colspec colwidth="6*" align="center"/>
23682 <colspec colwidth="6*" align="right"/>
23685 <entry><option>ldap_version</option></entry>
23686 <entry>Use: <emphasis>main</emphasis></entry>
23687 <entry>Type: <emphasis>integer</emphasis></entry>
23688 <entry>Default: <emphasis>unset</emphasis></entry>
23694 <indexterm role="concept">
23695 <primary>LDAP</primary>
23696 <secondary>protocol version, forcing</secondary>
23698 This option can be used to force Exim to set a specific protocol version for
23699 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
23700 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
23701 the LDAP headers; otherwise it is 2. This option is available only when Exim
23702 has been built with LDAP support.
23705 <indexterm role="option">
23706 <primary><option>local_from_check</option></primary>
23709 <informaltable frame="all">
23710 <tgroup cols="4" colsep="0" rowsep="0">
23711 <colspec colwidth="8*" align="left"/>
23712 <colspec colwidth="6*" align="center"/>
23713 <colspec colwidth="6*" align="center"/>
23714 <colspec colwidth="6*" align="right"/>
23717 <entry><option>local_from_check</option></entry>
23718 <entry>Use: <emphasis>main</emphasis></entry>
23719 <entry>Type: <emphasis>boolean</emphasis></entry>
23720 <entry>Default: <emphasis>true</emphasis></entry>
23726 <indexterm role="concept">
23727 <primary><emphasis>Sender:</emphasis> header line</primary>
23728 <secondary>disabling addition of</secondary>
23730 <indexterm role="concept">
23731 <primary><emphasis>From:</emphasis> header line</primary>
23732 <secondary>disabling checking of</secondary>
23734 When a message is submitted locally (that is, not over a TCP/IP connection) by
23735 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
23736 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
23737 the domain specified by <option>qualify_domain</option>.
23740 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
23741 locally submitted message is automatically qualified by Exim, unless the
23742 <option>-bnq</option> command line option is used.
23745 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
23746 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
23747 <emphasis>Sender:</emphasis> header with an address constructed from the calling user’s login
23748 and the default qualify domain.
23751 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
23752 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
23753 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
23754 <option>local_sender_retain</option> to be true.
23757 <indexterm role="concept">
23758 <primary>envelope sender</primary>
23760 These options affect only the header lines in the message. The envelope sender
23761 is still forced to be the login id at the qualify domain unless
23762 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
23765 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
23766 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
23767 has more details about <emphasis>Sender:</emphasis> processing.
23770 <indexterm role="option">
23771 <primary><option>local_from_prefix</option></primary>
23774 <informaltable frame="all">
23775 <tgroup cols="4" colsep="0" rowsep="0">
23776 <colspec colwidth="8*" align="left"/>
23777 <colspec colwidth="6*" align="center"/>
23778 <colspec colwidth="6*" align="center"/>
23779 <colspec colwidth="6*" align="right"/>
23782 <entry><option>local_from_prefix</option></entry>
23783 <entry>Use: <emphasis>main</emphasis></entry>
23784 <entry>Type: <emphasis>string</emphasis></entry>
23785 <entry>Default: <emphasis>unset</emphasis></entry>
23791 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
23792 matching the login id (see <option>local_from_check</option> above), it can be configured to
23793 ignore certain prefixes and suffixes in the local part of the address. This is
23794 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
23795 appropriate lists, in the same form as the <option>local_part_prefix</option> and
23796 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
23799 <literallayout class="monospaced">
23800 local_from_prefix = *-
23803 is set, a <emphasis>From:</emphasis> line containing
23805 <literallayout class="monospaced">
23806 From: anything-user@your.domain.example
23809 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
23810 matches the actual sender address that is constructed from the login name and
23814 <indexterm role="option">
23815 <primary><option>local_from_suffix</option></primary>
23818 <informaltable frame="all">
23819 <tgroup cols="4" colsep="0" rowsep="0">
23820 <colspec colwidth="8*" align="left"/>
23821 <colspec colwidth="6*" align="center"/>
23822 <colspec colwidth="6*" align="center"/>
23823 <colspec colwidth="6*" align="right"/>
23826 <entry><option>local_from_suffix</option></entry>
23827 <entry>Use: <emphasis>main</emphasis></entry>
23828 <entry>Type: <emphasis>string</emphasis></entry>
23829 <entry>Default: <emphasis>unset</emphasis></entry>
23835 See <option>local_from_prefix</option> above.
23838 <indexterm role="option">
23839 <primary><option>local_interfaces</option></primary>
23842 <informaltable frame="all">
23843 <tgroup cols="4" colsep="0" rowsep="0">
23844 <colspec colwidth="8*" align="left"/>
23845 <colspec colwidth="6*" align="center"/>
23846 <colspec colwidth="6*" align="center"/>
23847 <colspec colwidth="6*" align="right"/>
23850 <entry><option>local_interfaces</option></entry>
23851 <entry>Use: <emphasis>main</emphasis></entry>
23852 <entry>Type: <emphasis>string list</emphasis></entry>
23853 <entry>Default: <emphasis>see below</emphasis></entry>
23859 This option controls which network interfaces are used by the daemon for
23860 listening; they are also used to identify the local host when routing. Chapter
23861 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
23862 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
23863 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
23864 <option>local_interfaces</option> is
23866 <literallayout class="monospaced">
23867 local_interfaces = 0.0.0.0
23870 when Exim is built without IPv6 support; otherwise it is
23872 <literallayout class="monospaced">
23873 local_interfaces = <; ::0 ; 0.0.0.0
23876 <indexterm role="option">
23877 <primary><option>local_scan_timeout</option></primary>
23880 <informaltable frame="all">
23881 <tgroup cols="4" colsep="0" rowsep="0">
23882 <colspec colwidth="8*" align="left"/>
23883 <colspec colwidth="6*" align="center"/>
23884 <colspec colwidth="6*" align="center"/>
23885 <colspec colwidth="6*" align="right"/>
23888 <entry><option>local_scan_timeout</option></entry>
23889 <entry>Use: <emphasis>main</emphasis></entry>
23890 <entry>Type: <emphasis>time</emphasis></entry>
23891 <entry>Default: <emphasis>5m</emphasis></entry>
23897 <indexterm role="concept">
23898 <primary>timeout</primary>
23899 <secondary>for <function>local_scan()</function> function</secondary>
23901 <indexterm role="concept">
23902 <primary><function>local_scan()</function> function</primary>
23903 <secondary>timeout</secondary>
23905 This timeout applies to the <function>local_scan()</function> function (see chapter
23906 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
23907 the incoming message is rejected with a temporary error if it is an SMTP
23908 message. For a non-SMTP message, the message is dropped and Exim ends with a
23909 non-zero code. The incident is logged on the main and reject logs.
23912 <indexterm role="option">
23913 <primary><option>local_sender_retain</option></primary>
23916 <informaltable frame="all">
23917 <tgroup cols="4" colsep="0" rowsep="0">
23918 <colspec colwidth="8*" align="left"/>
23919 <colspec colwidth="6*" align="center"/>
23920 <colspec colwidth="6*" align="center"/>
23921 <colspec colwidth="6*" align="right"/>
23924 <entry><option>local_sender_retain</option></entry>
23925 <entry>Use: <emphasis>main</emphasis></entry>
23926 <entry>Type: <emphasis>boolean</emphasis></entry>
23927 <entry>Default: <emphasis>false</emphasis></entry>
23933 <indexterm role="concept">
23934 <primary><emphasis>Sender:</emphasis> header line</primary>
23935 <secondary>retaining from local submission</secondary>
23937 When a message is submitted locally (that is, not over a TCP/IP connection) by
23938 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
23939 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
23940 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
23941 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
23942 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
23945 <indexterm role="option">
23946 <primary><option>localhost_number</option></primary>
23949 <informaltable frame="all">
23950 <tgroup cols="4" colsep="0" rowsep="0">
23951 <colspec colwidth="8*" align="left"/>
23952 <colspec colwidth="6*" align="center"/>
23953 <colspec colwidth="6*" align="center"/>
23954 <colspec colwidth="6*" align="right"/>
23957 <entry><option>localhost_number</option></entry>
23958 <entry>Use: <emphasis>main</emphasis></entry>
23959 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
23960 <entry>Default: <emphasis>unset</emphasis></entry>
23966 <indexterm role="concept">
23967 <primary>host</primary>
23968 <secondary>locally unique number for</secondary>
23970 <indexterm role="concept">
23971 <primary>message ids</primary>
23972 <secondary>with multiple hosts</secondary>
23974 <indexterm role="variable">
23975 <primary><varname>$localhost_number</varname></primary>
23977 Exim’s message ids are normally unique only within the local host. If
23978 uniqueness among a set of hosts is required, each host must set a different
23979 value for the <option>localhost_number</option> option. The string is expanded immediately
23980 after reading the configuration file (so that a number can be computed from the
23981 host name, for example) and the result of the expansion must be a number in the
23982 range 0–16 (or 0–10 on operating systems with case-insensitive file
23983 systems). This is available in subsequent string expansions via the variable
23984 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
23985 characters of the message id, instead of just being a fractional part of the
23986 time, are computed from the time and the local host number as described in
23987 section <xref linkend="SECTmessiden"/>.
23990 <indexterm role="option">
23991 <primary><option>log_file_path</option></primary>
23994 <informaltable frame="all">
23995 <tgroup cols="4" colsep="0" rowsep="0">
23996 <colspec colwidth="8*" align="left"/>
23997 <colspec colwidth="6*" align="center"/>
23998 <colspec colwidth="6*" align="center"/>
23999 <colspec colwidth="6*" align="right"/>
24002 <entry><option>log_file_path</option></entry>
24003 <entry>Use: <emphasis>main</emphasis></entry>
24004 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
24005 <entry>Default: <emphasis>set at compile time</emphasis></entry>
24011 <indexterm role="concept">
24012 <primary>log</primary>
24013 <secondary>file path for</secondary>
24015 This option sets the path which is used to determine the names of Exim’s log
24016 files, or indicates that logging is to be to syslog, or both. It is expanded
24017 when Exim is entered, so it can, for example, contain a reference to the host
24018 name. If no specific path is set for the log files at compile or run time, they
24019 are written in a sub-directory called <filename>log</filename> in Exim’s spool directory.
24020 Chapter <xref linkend="CHAPlog"/> contains further details about Exim’s logging, and
24021 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
24022 used. If this string is fixed at your installation (contains no expansion
24023 variables) it is recommended that you do not set this option in the
24024 configuration file, but instead supply the path using LOG_FILE_PATH in
24025 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
24026 early on – in particular, failure to read the configuration file.
24029 <indexterm role="option">
24030 <primary><option>log_selector</option></primary>
24033 <informaltable frame="all">
24034 <tgroup cols="4" colsep="0" rowsep="0">
24035 <colspec colwidth="8*" align="left"/>
24036 <colspec colwidth="6*" align="center"/>
24037 <colspec colwidth="6*" align="center"/>
24038 <colspec colwidth="6*" align="right"/>
24041 <entry><option>log_selector</option></entry>
24042 <entry>Use: <emphasis>main</emphasis></entry>
24043 <entry>Type: <emphasis>string</emphasis></entry>
24044 <entry>Default: <emphasis>unset</emphasis></entry>
24050 <indexterm role="concept">
24051 <primary>log</primary>
24052 <secondary>selectors</secondary>
24054 This option can be used to reduce or increase the number of things that Exim
24055 writes to its log files. Its argument is made up of names preceded by plus or
24056 minus characters. For example:
24058 <literallayout class="monospaced">
24059 log_selector = +arguments -retry_defer
24062 A list of possible names and what they control is given in the chapter on
24063 logging, in section <xref linkend="SECTlogselector"/>.
24066 <indexterm role="option">
24067 <primary><option>log_timezone</option></primary>
24070 <informaltable frame="all">
24071 <tgroup cols="4" colsep="0" rowsep="0">
24072 <colspec colwidth="8*" align="left"/>
24073 <colspec colwidth="6*" align="center"/>
24074 <colspec colwidth="6*" align="center"/>
24075 <colspec colwidth="6*" align="right"/>
24078 <entry><option>log_timezone</option></entry>
24079 <entry>Use: <emphasis>main</emphasis></entry>
24080 <entry>Type: <emphasis>boolean</emphasis></entry>
24081 <entry>Default: <emphasis>false</emphasis></entry>
24087 <indexterm role="concept">
24088 <primary>log</primary>
24089 <secondary>timezone for entries</secondary>
24091 <indexterm role="variable">
24092 <primary><varname>$tod_log</varname></primary>
24094 <indexterm role="variable">
24095 <primary><varname>$tod_zone</varname></primary>
24097 By default, the timestamps on log lines are in local time without the
24098 timezone. This means that if your timezone changes twice a year, the timestamps
24099 in log lines are ambiguous for an hour when the clocks go back. One way of
24100 avoiding this problem is to set the timezone to UTC. An alternative is to set
24101 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
24102 timestamps in log lines. Turning on this option can add quite a lot to the size
24103 of log files because each line is extended by 6 characters. Note that the
24104 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
24105 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
24108 <indexterm role="option">
24109 <primary><option>lookup_open_max</option></primary>
24112 <informaltable frame="all">
24113 <tgroup cols="4" colsep="0" rowsep="0">
24114 <colspec colwidth="8*" align="left"/>
24115 <colspec colwidth="6*" align="center"/>
24116 <colspec colwidth="6*" align="center"/>
24117 <colspec colwidth="6*" align="right"/>
24120 <entry><option>lookup_open_max</option></entry>
24121 <entry>Use: <emphasis>main</emphasis></entry>
24122 <entry>Type: <emphasis>integer</emphasis></entry>
24123 <entry>Default: <emphasis>25</emphasis></entry>
24129 <indexterm role="concept">
24130 <primary>too many open files</primary>
24132 <indexterm role="concept">
24133 <primary>open files, too many</primary>
24135 <indexterm role="concept">
24136 <primary>file</primary>
24137 <secondary>too many open</secondary>
24139 <indexterm role="concept">
24140 <primary>lookup</primary>
24141 <secondary>maximum open files</secondary>
24143 <indexterm role="concept">
24144 <primary>limit</primary>
24145 <secondary>open files for lookups</secondary>
24147 This option limits the number of simultaneously open files for single-key
24148 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
24149 Exim normally keeps these files open during routing, because often the same
24150 file is required several times. If the limit is reached, Exim closes the least
24151 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
24152 actually opens two files for each logical DBM database, though it still counts
24153 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
24154 open files</quote> errors with NDBM, you need to reduce the value of
24155 <option>lookup_open_max</option>.
24158 <indexterm role="option">
24159 <primary><option>max_username_length</option></primary>
24162 <informaltable frame="all">
24163 <tgroup cols="4" colsep="0" rowsep="0">
24164 <colspec colwidth="8*" align="left"/>
24165 <colspec colwidth="6*" align="center"/>
24166 <colspec colwidth="6*" align="center"/>
24167 <colspec colwidth="6*" align="right"/>
24170 <entry><option>max_username_length</option></entry>
24171 <entry>Use: <emphasis>main</emphasis></entry>
24172 <entry>Type: <emphasis>integer</emphasis></entry>
24173 <entry>Default: <emphasis>0</emphasis></entry>
24179 <indexterm role="concept">
24180 <primary>length of login name</primary>
24182 <indexterm role="concept">
24183 <primary>user name</primary>
24184 <secondary>maximum length</secondary>
24186 <indexterm role="concept">
24187 <primary>limit</primary>
24188 <secondary>user name length</secondary>
24190 Some operating systems are broken in that they truncate long arguments to
24191 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
24192 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
24193 an argument that is longer behaves as if <function>getpwnam()</function> failed.
24196 <indexterm role="option">
24197 <primary><option>message_body_newlines</option></primary>
24200 <informaltable frame="all">
24201 <tgroup cols="4" colsep="0" rowsep="0">
24202 <colspec colwidth="8*" align="left"/>
24203 <colspec colwidth="6*" align="center"/>
24204 <colspec colwidth="6*" align="center"/>
24205 <colspec colwidth="6*" align="right"/>
24208 <entry><option>message_body_newlines</option></entry>
24209 <entry>Use: <emphasis>main</emphasis></entry>
24210 <entry>Type: <emphasis>bool</emphasis></entry>
24211 <entry>Default: <emphasis>false</emphasis></entry>
24217 <indexterm role="concept">
24218 <primary>message body</primary>
24219 <secondary>newlines in variables</secondary>
24221 <indexterm role="concept">
24222 <primary>newline</primary>
24223 <secondary>in message body variables</secondary>
24225 <indexterm role="variable">
24226 <primary><varname>$message_body</varname></primary>
24228 <indexterm role="variable">
24229 <primary><varname>$message_body_end</varname></primary>
24231 By default, newlines in the message body are replaced by spaces when setting
24232 the <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables. If this
24233 option is set true, this no longer happens.
24236 <indexterm role="option">
24237 <primary><option>message_body_visible</option></primary>
24240 <informaltable frame="all">
24241 <tgroup cols="4" colsep="0" rowsep="0">
24242 <colspec colwidth="8*" align="left"/>
24243 <colspec colwidth="6*" align="center"/>
24244 <colspec colwidth="6*" align="center"/>
24245 <colspec colwidth="6*" align="right"/>
24248 <entry><option>message_body_visible</option></entry>
24249 <entry>Use: <emphasis>main</emphasis></entry>
24250 <entry>Type: <emphasis>integer</emphasis></entry>
24251 <entry>Default: <emphasis>500</emphasis></entry>
24257 <indexterm role="concept">
24258 <primary>body of message</primary>
24259 <secondary>visible size</secondary>
24261 <indexterm role="concept">
24262 <primary>message body</primary>
24263 <secondary>visible size</secondary>
24265 <indexterm role="variable">
24266 <primary><varname>$message_body</varname></primary>
24268 <indexterm role="variable">
24269 <primary><varname>$message_body_end</varname></primary>
24271 This option specifies how much of a message’s body is to be included in the
24272 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
24275 <indexterm role="option">
24276 <primary><option>message_id_header_domain</option></primary>
24279 <informaltable frame="all">
24280 <tgroup cols="4" colsep="0" rowsep="0">
24281 <colspec colwidth="8*" align="left"/>
24282 <colspec colwidth="6*" align="center"/>
24283 <colspec colwidth="6*" align="center"/>
24284 <colspec colwidth="6*" align="right"/>
24287 <entry><option>message_id_header_domain</option></entry>
24288 <entry>Use: <emphasis>main</emphasis></entry>
24289 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
24290 <entry>Default: <emphasis>unset</emphasis></entry>
24296 <indexterm role="concept">
24297 <primary><emphasis>Message-ID:</emphasis> header line</primary>
24299 If this option is set, the string is expanded and used as the right hand side
24300 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
24301 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
24302 means <quote>not received over TCP/IP.</quote>
24303 Otherwise, the primary host name is used.
24304 Only letters, digits, dot and hyphen are accepted; any other characters are
24305 replaced by hyphens. If the expansion is forced to fail, or if the result is an
24306 empty string, the option is ignored.
24309 <indexterm role="option">
24310 <primary><option>message_id_header_text</option></primary>
24313 <informaltable frame="all">
24314 <tgroup cols="4" colsep="0" rowsep="0">
24315 <colspec colwidth="8*" align="left"/>
24316 <colspec colwidth="6*" align="center"/>
24317 <colspec colwidth="6*" align="center"/>
24318 <colspec colwidth="6*" align="right"/>
24321 <entry><option>message_id_header_text</option></entry>
24322 <entry>Use: <emphasis>main</emphasis></entry>
24323 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
24324 <entry>Default: <emphasis>unset</emphasis></entry>
24330 If this variable is set, the string is expanded and used to augment the text of
24331 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
24332 message does not have one. The text of this header is required by RFC 2822 to
24333 take the form of an address. By default, Exim uses its internal message id as
24334 the local part, and the primary host name as the domain. If this option is set,
24335 it is expanded, and provided the expansion is not forced to fail, and does not
24336 yield an empty string, the result is inserted into the header immediately
24337 before the @, separated from the internal message id by a dot. Any characters
24338 that are illegal in an address are automatically converted into hyphens. This
24339 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
24340 colons will become hyphens.
24343 <indexterm role="option">
24344 <primary><option>message_logs</option></primary>
24347 <informaltable frame="all">
24348 <tgroup cols="4" colsep="0" rowsep="0">
24349 <colspec colwidth="8*" align="left"/>
24350 <colspec colwidth="6*" align="center"/>
24351 <colspec colwidth="6*" align="center"/>
24352 <colspec colwidth="6*" align="right"/>
24355 <entry><option>message_logs</option></entry>
24356 <entry>Use: <emphasis>main</emphasis></entry>
24357 <entry>Type: <emphasis>boolean</emphasis></entry>
24358 <entry>Default: <emphasis>true</emphasis></entry>
24364 <indexterm role="concept">
24365 <primary>message logs</primary>
24366 <secondary>disabling</secondary>
24368 <indexterm role="concept">
24369 <primary>log</primary>
24370 <secondary>message log; disabling</secondary>
24372 If this option is turned off, per-message log files are not created in the
24373 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
24374 Exim, by reducing the number of files involved in handling a message from a
24375 minimum of four (header spool file, body spool file, delivery journal, and
24376 per-message log) to three. The other major I/O activity is Exim’s main log,
24377 which is not affected by this option.
24380 <indexterm role="option">
24381 <primary><option>message_size_limit</option></primary>
24384 <informaltable frame="all">
24385 <tgroup cols="4" colsep="0" rowsep="0">
24386 <colspec colwidth="8*" align="left"/>
24387 <colspec colwidth="6*" align="center"/>
24388 <colspec colwidth="6*" align="center"/>
24389 <colspec colwidth="6*" align="right"/>
24392 <entry><option>message_size_limit</option></entry>
24393 <entry>Use: <emphasis>main</emphasis></entry>
24394 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
24395 <entry>Default: <emphasis>50M</emphasis></entry>
24401 <indexterm role="concept">
24402 <primary>message</primary>
24403 <secondary>size limit</secondary>
24405 <indexterm role="concept">
24406 <primary>limit</primary>
24407 <secondary>message size</secondary>
24409 <indexterm role="concept">
24410 <primary>size</primary>
24411 <secondary>of message, limit</secondary>
24413 This option limits the maximum size of message that Exim will process. The
24414 value is expanded for each incoming connection so, for example, it can be made
24415 to depend on the IP address of the remote host for messages arriving via
24416 TCP/IP. After expansion, the value must be a sequence of decimal digits,
24417 optionally followed by K or M.
24420 <emphasis role="bold">Note</emphasis>: This limit cannot be made to depend on a message’s sender or any
24421 other properties of an individual message, because it has to be advertised in
24422 the server’s response to EHLO. String expansion failure causes a temporary
24423 error. A value of zero means no limit, but its use is not recommended. See also
24424 <option>bounce_return_size_limit</option>.
24427 Incoming SMTP messages are failed with a 552 error if the limit is
24428 exceeded; locally-generated messages either get a stderr message or a delivery
24429 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
24430 an oversized message is logged in both the main and the reject logs. See also
24431 the generic transport option <option>message_size_limit</option>, which limits the size of
24432 message that an individual transport can process.
24435 If you use a virus-scanner and set this option to to a value larger than the
24436 maximum size that your virus-scanner is configured to support, you may get
24437 failures triggered by large mails. The right size to configure for the
24438 virus-scanner depends upon what data is passed and the options in use but it’s
24439 probably safest to just set it to a little larger than this value. Eg, with a
24440 default Exim message size of 50M and a default ClamAV StreamMaxLength of 10M,
24441 some problems may result.
24444 <indexterm role="option">
24445 <primary><option>move_frozen_messages</option></primary>
24448 <informaltable frame="all">
24449 <tgroup cols="4" colsep="0" rowsep="0">
24450 <colspec colwidth="8*" align="left"/>
24451 <colspec colwidth="6*" align="center"/>
24452 <colspec colwidth="6*" align="center"/>
24453 <colspec colwidth="6*" align="right"/>
24456 <entry><option>move_frozen_messages</option></entry>
24457 <entry>Use: <emphasis>main</emphasis></entry>
24458 <entry>Type: <emphasis>boolean</emphasis></entry>
24459 <entry>Default: <emphasis>false</emphasis></entry>
24465 <indexterm role="concept">
24466 <primary>frozen messages</primary>
24467 <secondary>moving</secondary>
24469 This option, which is available only if Exim has been built with the setting
24471 <literallayout class="monospaced">
24472 SUPPORT_MOVE_FROZEN_MESSAGES=yes
24475 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
24476 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
24477 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
24478 standard utilities for handling such moved messages, and they do not show up in
24479 lists generated by <option>-bp</option> or by the Exim monitor.
24482 <indexterm role="option">
24483 <primary><option>mua_wrapper</option></primary>
24486 <informaltable frame="all">
24487 <tgroup cols="4" colsep="0" rowsep="0">
24488 <colspec colwidth="8*" align="left"/>
24489 <colspec colwidth="6*" align="center"/>
24490 <colspec colwidth="6*" align="center"/>
24491 <colspec colwidth="6*" align="right"/>
24494 <entry><option>mua_wrapper</option></entry>
24495 <entry>Use: <emphasis>main</emphasis></entry>
24496 <entry>Type: <emphasis>boolean</emphasis></entry>
24497 <entry>Default: <emphasis>false</emphasis></entry>
24503 Setting this option true causes Exim to run in a very restrictive mode in which
24504 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
24505 contains a full description of this facility.
24508 <indexterm role="option">
24509 <primary><option>mysql_servers</option></primary>
24512 <informaltable frame="all">
24513 <tgroup cols="4" colsep="0" rowsep="0">
24514 <colspec colwidth="8*" align="left"/>
24515 <colspec colwidth="6*" align="center"/>
24516 <colspec colwidth="6*" align="center"/>
24517 <colspec colwidth="6*" align="right"/>
24520 <entry><option>mysql_servers</option></entry>
24521 <entry>Use: <emphasis>main</emphasis></entry>
24522 <entry>Type: <emphasis>string list</emphasis></entry>
24523 <entry>Default: <emphasis>unset</emphasis></entry>
24529 <indexterm role="concept">
24530 <primary>MySQL</primary>
24531 <secondary>server list</secondary>
24533 This option provides a list of MySQL servers and associated connection data, to
24534 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECID72"/>). The
24535 option is available only if Exim has been built with MySQL support.
24538 <indexterm role="option">
24539 <primary><option>never_users</option></primary>
24542 <informaltable frame="all">
24543 <tgroup cols="4" colsep="0" rowsep="0">
24544 <colspec colwidth="8*" align="left"/>
24545 <colspec colwidth="6*" align="center"/>
24546 <colspec colwidth="6*" align="center"/>
24547 <colspec colwidth="6*" align="right"/>
24550 <entry><option>never_users</option></entry>
24551 <entry>Use: <emphasis>main</emphasis></entry>
24552 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
24553 <entry>Default: <emphasis>unset</emphasis></entry>
24559 This option is expanded just once, at the start of Exim’s processing. Local
24560 message deliveries are normally run in processes that are setuid to the
24561 recipient, and remote deliveries are normally run under Exim’s own uid and gid.
24562 It is usually desirable to prevent any deliveries from running as root, as a
24566 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
24567 list of users that must not be used for local deliveries. This list is fixed in
24568 the binary and cannot be overridden by the configuration file. By default, it
24569 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
24570 can be used to add more users to the fixed list.
24573 If a message is to be delivered as one of the users on the fixed list or the
24574 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
24577 <literallayout class="monospaced">
24578 never_users = root:daemon:bin
24581 Including root is redundant if it is also on the fixed list, but it does no
24582 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
24586 <indexterm role="option">
24587 <primary><option>openssl_options</option></primary>
24590 <informaltable frame="all">
24591 <tgroup cols="4" colsep="0" rowsep="0">
24592 <colspec colwidth="8*" align="left"/>
24593 <colspec colwidth="6*" align="center"/>
24594 <colspec colwidth="6*" align="center"/>
24595 <colspec colwidth="6*" align="right"/>
24598 <entry><option>openssl_options</option></entry>
24599 <entry>Use: <emphasis>main</emphasis></entry>
24600 <entry>Type: <emphasis>string list</emphasis></entry>
24601 <entry>Default: <emphasis>+dont_insert_empty_fragments</emphasis></entry>
24607 <indexterm role="concept">
24608 <primary>OpenSSL </primary>
24609 <secondary>compatibility</secondary>
24611 This option allows an administrator to adjust the SSL options applied
24612 by OpenSSL to connections. It is given as a space-separated list of items,
24613 each one to be +added or -subtracted from the current value. The default
24614 value is one option which happens to have been set historically. You can
24615 remove all options with:
24617 <literallayout class="monospaced">
24618 openssl_options = -all
24621 This option is only available if Exim is built against OpenSSL. The values
24622 available for this option vary according to the age of your OpenSSL install.
24623 The <quote>all</quote> value controls a subset of flags which are available, typically
24624 the bug workaround options. The <emphasis>SSL_CTX_set_options</emphasis> man page will
24625 list the values known on your system and Exim should support all the
24626 <quote>bug workaround</quote> options and many of the <quote>modifying</quote> options. The Exim
24627 names lose the leading <quote>SSL_OP_</quote> and are lower-cased.
24630 Note that adjusting the options can have severe impact upon the security of
24631 SSL as used by Exim. It is possible to disable safety checks and shoot
24632 yourself in the foot in various unpleasant ways. This option should not be
24633 adjusted lightly. An unrecognised item will be detected at by invoking Exim
24634 with the <option>-bV</option> flag.
24639 <literallayout class="monospaced">
24640 openssl_options = -all +microsoft_big_sslv3_buffer
24643 <indexterm role="option">
24644 <primary><option>oracle_servers</option></primary>
24647 <informaltable frame="all">
24648 <tgroup cols="4" colsep="0" rowsep="0">
24649 <colspec colwidth="8*" align="left"/>
24650 <colspec colwidth="6*" align="center"/>
24651 <colspec colwidth="6*" align="center"/>
24652 <colspec colwidth="6*" align="right"/>
24655 <entry><option>oracle_servers</option></entry>
24656 <entry>Use: <emphasis>main</emphasis></entry>
24657 <entry>Type: <emphasis>string list</emphasis></entry>
24658 <entry>Default: <emphasis>unset</emphasis></entry>
24664 <indexterm role="concept">
24665 <primary>Oracle</primary>
24666 <secondary>server list</secondary>
24668 This option provides a list of Oracle servers and associated connection data,
24669 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECID72"/>).
24670 The option is available only if Exim has been built with Oracle support.
24673 <indexterm role="option">
24674 <primary><option>percent_hack_domains</option></primary>
24677 <informaltable frame="all">
24678 <tgroup cols="4" colsep="0" rowsep="0">
24679 <colspec colwidth="8*" align="left"/>
24680 <colspec colwidth="6*" align="center"/>
24681 <colspec colwidth="6*" align="center"/>
24682 <colspec colwidth="6*" align="right"/>
24685 <entry><option>percent_hack_domains</option></entry>
24686 <entry>Use: <emphasis>main</emphasis></entry>
24687 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
24688 <entry>Default: <emphasis>unset</emphasis></entry>
24694 <indexterm role="concept">
24695 <primary><quote>percent hack</quote></primary>
24697 <indexterm role="concept">
24698 <primary>source routing</primary>
24699 <secondary>in email address</secondary>
24701 <indexterm role="concept">
24702 <primary>address</primary>
24703 <secondary>source-routed</secondary>
24705 The <quote>percent hack</quote> is the convention whereby a local part containing a
24706 percent sign is re-interpreted as a new email address, with the percent
24707 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
24708 also applied to RFC 2822 addresses that begin with an @ character. If this
24709 option is set, Exim implements the percent facility for those domains listed,
24710 but no others. This happens before an incoming SMTP address is tested against
24714 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
24715 trying to get round relaying restrictions. For this reason, it is best avoided
24716 if at all possible. Unfortunately, a number of less security-conscious MTAs
24717 implement it unconditionally. If you are running Exim on a gateway host, and
24718 routing mail through to internal MTAs without processing the local parts, it is
24719 a good idea to reject recipient addresses with percent characters in their
24720 local parts. Exim’s default configuration does this.
24723 <indexterm role="option">
24724 <primary><option>perl_at_start</option></primary>
24727 <informaltable frame="all">
24728 <tgroup cols="4" colsep="0" rowsep="0">
24729 <colspec colwidth="8*" align="left"/>
24730 <colspec colwidth="6*" align="center"/>
24731 <colspec colwidth="6*" align="center"/>
24732 <colspec colwidth="6*" align="right"/>
24735 <entry><option>perl_at_start</option></entry>
24736 <entry>Use: <emphasis>main</emphasis></entry>
24737 <entry>Type: <emphasis>boolean</emphasis></entry>
24738 <entry>Default: <emphasis>false</emphasis></entry>
24744 This option is available only when Exim is built with an embedded Perl
24745 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
24748 <indexterm role="option">
24749 <primary><option>perl_startup</option></primary>
24752 <informaltable frame="all">
24753 <tgroup cols="4" colsep="0" rowsep="0">
24754 <colspec colwidth="8*" align="left"/>
24755 <colspec colwidth="6*" align="center"/>
24756 <colspec colwidth="6*" align="center"/>
24757 <colspec colwidth="6*" align="right"/>
24760 <entry><option>perl_startup</option></entry>
24761 <entry>Use: <emphasis>main</emphasis></entry>
24762 <entry>Type: <emphasis>string</emphasis></entry>
24763 <entry>Default: <emphasis>unset</emphasis></entry>
24769 This option is available only when Exim is built with an embedded Perl
24770 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
24773 <indexterm role="option">
24774 <primary><option>pgsql_servers</option></primary>
24777 <informaltable frame="all">
24778 <tgroup cols="4" colsep="0" rowsep="0">
24779 <colspec colwidth="8*" align="left"/>
24780 <colspec colwidth="6*" align="center"/>
24781 <colspec colwidth="6*" align="center"/>
24782 <colspec colwidth="6*" align="right"/>
24785 <entry><option>pgsql_servers</option></entry>
24786 <entry>Use: <emphasis>main</emphasis></entry>
24787 <entry>Type: <emphasis>string list</emphasis></entry>
24788 <entry>Default: <emphasis>unset</emphasis></entry>
24794 <indexterm role="concept">
24795 <primary>PostgreSQL lookup type</primary>
24796 <secondary>server list</secondary>
24798 This option provides a list of PostgreSQL servers and associated connection
24799 data, to be used in conjunction with <command>pgsql</command> lookups (see section
24800 <xref linkend="SECID72"/>). The option is available only if Exim has been built with
24801 PostgreSQL support.
24804 <indexterm role="option">
24805 <primary><option>pid_file_path</option></primary>
24808 <informaltable frame="all">
24809 <tgroup cols="4" colsep="0" rowsep="0">
24810 <colspec colwidth="8*" align="left"/>
24811 <colspec colwidth="6*" align="center"/>
24812 <colspec colwidth="6*" align="center"/>
24813 <colspec colwidth="6*" align="right"/>
24816 <entry><option>pid_file_path</option></entry>
24817 <entry>Use: <emphasis>main</emphasis></entry>
24818 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
24819 <entry>Default: <emphasis>set at compile time</emphasis></entry>
24825 <indexterm role="concept">
24826 <primary>daemon</primary>
24827 <secondary>pid file path</secondary>
24829 <indexterm role="concept">
24830 <primary>pid file, path for</primary>
24832 This option sets the name of the file to which the Exim daemon writes its
24833 process id. The string is expanded, so it can contain, for example, references
24836 <literallayout class="monospaced">
24837 pid_file_path = /var/log/$primary_hostname/exim.pid
24840 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim’s
24842 The value set by the option can be overridden by the <option>-oP</option> command line
24843 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
24844 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
24847 <indexterm role="option">
24848 <primary><option>pipelining_advertise_hosts</option></primary>
24851 <informaltable frame="all">
24852 <tgroup cols="4" colsep="0" rowsep="0">
24853 <colspec colwidth="8*" align="left"/>
24854 <colspec colwidth="6*" align="center"/>
24855 <colspec colwidth="6*" align="center"/>
24856 <colspec colwidth="6*" align="right"/>
24859 <entry><option>pipelining_advertise_hosts</option></entry>
24860 <entry>Use: <emphasis>main</emphasis></entry>
24861 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
24862 <entry>Default: <emphasis>*</emphasis></entry>
24868 <indexterm role="concept">
24869 <primary>PIPELINING</primary>
24870 <secondary>suppressing advertising</secondary>
24872 This option can be used to suppress the advertisement of the SMTP
24873 PIPELINING extension to specific hosts. See also the <emphasis role="bold">no_pipelining</emphasis>
24874 control in section <xref linkend="SECTcontrols"/>. When PIPELINING is not advertised and
24875 <option>smtp_enforce_sync</option> is true, an Exim server enforces strict synchronization
24876 for each SMTP command and response. When PIPELINING is advertised, Exim assumes
24877 that clients will use it; <quote>out of order</quote> commands that are <quote>expected</quote> do
24878 not count as protocol errors (see <option>smtp_max_synprot_errors</option>).
24881 <indexterm role="option">
24882 <primary><option>preserve_message_logs</option></primary>
24885 <informaltable frame="all">
24886 <tgroup cols="4" colsep="0" rowsep="0">
24887 <colspec colwidth="8*" align="left"/>
24888 <colspec colwidth="6*" align="center"/>
24889 <colspec colwidth="6*" align="center"/>
24890 <colspec colwidth="6*" align="right"/>
24893 <entry><option>preserve_message_logs</option></entry>
24894 <entry>Use: <emphasis>main</emphasis></entry>
24895 <entry>Type: <emphasis>boolean</emphasis></entry>
24896 <entry>Default: <emphasis>false</emphasis></entry>
24902 <indexterm role="concept">
24903 <primary>message logs</primary>
24904 <secondary>preserving</secondary>
24906 If this option is set, message log files are not deleted when messages are
24907 completed. Instead, they are moved to a sub-directory of the spool directory
24908 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
24909 purposes. This is a dangerous option to set on systems with any appreciable
24910 volume of mail. Use with care!
24913 <indexterm role="option">
24914 <primary><option>primary_hostname</option></primary>
24917 <informaltable frame="all">
24918 <tgroup cols="4" colsep="0" rowsep="0">
24919 <colspec colwidth="8*" align="left"/>
24920 <colspec colwidth="6*" align="center"/>
24921 <colspec colwidth="6*" align="center"/>
24922 <colspec colwidth="6*" align="right"/>
24925 <entry><option>primary_hostname</option></entry>
24926 <entry>Use: <emphasis>main</emphasis></entry>
24927 <entry>Type: <emphasis>string</emphasis></entry>
24928 <entry>Default: <emphasis>see below</emphasis></entry>
24934 <indexterm role="concept">
24935 <primary>name</primary>
24936 <secondary>of local host</secondary>
24938 <indexterm role="concept">
24939 <primary>host</primary>
24940 <secondary>name of local</secondary>
24942 <indexterm role="concept">
24943 <primary>local host</primary>
24944 <secondary>name of</secondary>
24946 <indexterm role="variable">
24947 <primary><varname>$primary_hostname</varname></primary>
24949 This specifies the name of the current host. It is used in the default EHLO or
24950 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
24951 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
24952 The value is also used by default in some SMTP response messages from an Exim
24953 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
24956 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
24957 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
24958 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
24959 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
24960 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
24961 explicitly by this option, or defaulted.
24964 <indexterm role="option">
24965 <primary><option>print_topbitchars</option></primary>
24968 <informaltable frame="all">
24969 <tgroup cols="4" colsep="0" rowsep="0">
24970 <colspec colwidth="8*" align="left"/>
24971 <colspec colwidth="6*" align="center"/>
24972 <colspec colwidth="6*" align="center"/>
24973 <colspec colwidth="6*" align="right"/>
24976 <entry><option>print_topbitchars</option></entry>
24977 <entry>Use: <emphasis>main</emphasis></entry>
24978 <entry>Type: <emphasis>boolean</emphasis></entry>
24979 <entry>Default: <emphasis>false</emphasis></entry>
24985 <indexterm role="concept">
24986 <primary>printing characters</primary>
24988 <indexterm role="concept">
24989 <primary>8-bit characters</primary>
24991 By default, Exim considers only those characters whose codes lie in the range
24992 32–126 to be printing characters. In a number of circumstances (for example,
24993 when writing log entries) non-printing characters are converted into escape
24994 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
24995 is set, code values of 128 and above are also considered to be printing
24999 This option also affects the header syntax checks performed by the
25000 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
25001 the user’s full name when constructing From: and Sender: addresses (as
25002 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
25003 Exim to generate eight bit message headers that do not conform to the
25007 <indexterm role="option">
25008 <primary><option>process_log_path</option></primary>
25011 <informaltable frame="all">
25012 <tgroup cols="4" colsep="0" rowsep="0">
25013 <colspec colwidth="8*" align="left"/>
25014 <colspec colwidth="6*" align="center"/>
25015 <colspec colwidth="6*" align="center"/>
25016 <colspec colwidth="6*" align="right"/>
25019 <entry><option>process_log_path</option></entry>
25020 <entry>Use: <emphasis>main</emphasis></entry>
25021 <entry>Type: <emphasis>string</emphasis></entry>
25022 <entry>Default: <emphasis>unset</emphasis></entry>
25028 <indexterm role="concept">
25029 <primary>process log path</primary>
25031 <indexterm role="concept">
25032 <primary>log</primary>
25033 <secondary>process log</secondary>
25035 <indexterm role="concept">
25036 <primary><emphasis>exiwhat</emphasis></primary>
25038 This option sets the name of the file to which an Exim process writes its
25039 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
25040 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
25041 in Exim’s spool directory is used. The ability to specify the name explicitly
25042 can be useful in environments where two different Exims are running, using
25043 different spool directories.
25046 <indexterm role="option">
25047 <primary><option>prod_requires_admin</option></primary>
25050 <informaltable frame="all">
25051 <tgroup cols="4" colsep="0" rowsep="0">
25052 <colspec colwidth="8*" align="left"/>
25053 <colspec colwidth="6*" align="center"/>
25054 <colspec colwidth="6*" align="center"/>
25055 <colspec colwidth="6*" align="right"/>
25058 <entry><option>prod_requires_admin</option></entry>
25059 <entry>Use: <emphasis>main</emphasis></entry>
25060 <entry>Type: <emphasis>boolean</emphasis></entry>
25061 <entry>Default: <emphasis>true</emphasis></entry>
25067 <indexterm role="option">
25068 <primary><option>-M</option></primary>
25070 <indexterm role="option">
25071 <primary><option>-R</option></primary>
25073 <indexterm role="option">
25074 <primary><option>-q</option></primary>
25076 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
25077 admin user unless <option>prod_requires_admin</option> is set false. See also
25078 <option>queue_list_requires_admin</option>.
25081 <indexterm role="option">
25082 <primary><option>qualify_domain</option></primary>
25085 <informaltable frame="all">
25086 <tgroup cols="4" colsep="0" rowsep="0">
25087 <colspec colwidth="8*" align="left"/>
25088 <colspec colwidth="6*" align="center"/>
25089 <colspec colwidth="6*" align="center"/>
25090 <colspec colwidth="6*" align="right"/>
25093 <entry><option>qualify_domain</option></entry>
25094 <entry>Use: <emphasis>main</emphasis></entry>
25095 <entry>Type: <emphasis>string</emphasis></entry>
25096 <entry>Default: <emphasis>see below</emphasis></entry>
25102 <indexterm role="concept">
25103 <primary>domain</primary>
25104 <secondary>for qualifying addresses</secondary>
25106 <indexterm role="concept">
25107 <primary>address</primary>
25108 <secondary>qualification</secondary>
25110 This option specifies the domain name that is added to any envelope sender
25111 addresses that do not have a domain qualification. It also applies to
25112 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
25113 are accepted by default only for locally-generated messages. Qualification is
25114 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
25115 locally-generated messages, unless the <option>-bnq</option> command line option is used.
25118 Messages from external sources must always contain fully qualified addresses,
25119 unless the sending host matches <option>sender_unqualified_hosts</option> or
25120 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
25121 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
25122 necessary. Internally, Exim always works with fully qualified envelope
25123 addresses. If <option>qualify_domain</option> is not set, it defaults to the
25124 <option>primary_hostname</option> value.
25127 <indexterm role="option">
25128 <primary><option>qualify_recipient</option></primary>
25131 <informaltable frame="all">
25132 <tgroup cols="4" colsep="0" rowsep="0">
25133 <colspec colwidth="8*" align="left"/>
25134 <colspec colwidth="6*" align="center"/>
25135 <colspec colwidth="6*" align="center"/>
25136 <colspec colwidth="6*" align="right"/>
25139 <entry><option>qualify_recipient</option></entry>
25140 <entry>Use: <emphasis>main</emphasis></entry>
25141 <entry>Type: <emphasis>string</emphasis></entry>
25142 <entry>Default: <emphasis>see below</emphasis></entry>
25148 This option allows you to specify a different domain for qualifying recipient
25149 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
25152 <indexterm role="option">
25153 <primary><option>queue_domains</option></primary>
25156 <informaltable frame="all">
25157 <tgroup cols="4" colsep="0" rowsep="0">
25158 <colspec colwidth="8*" align="left"/>
25159 <colspec colwidth="6*" align="center"/>
25160 <colspec colwidth="6*" align="center"/>
25161 <colspec colwidth="6*" align="right"/>
25164 <entry><option>queue_domains</option></entry>
25165 <entry>Use: <emphasis>main</emphasis></entry>
25166 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
25167 <entry>Default: <emphasis>unset</emphasis></entry>
25173 <indexterm role="concept">
25174 <primary>domain</primary>
25175 <secondary>specifying non-immediate delivery</secondary>
25177 <indexterm role="concept">
25178 <primary>queueing incoming messages</primary>
25180 <indexterm role="concept">
25181 <primary>message</primary>
25182 <secondary>queueing certain domains</secondary>
25184 This option lists domains for which immediate delivery is not required.
25185 A delivery process is started whenever a message is received, but only those
25186 domains that do not match are processed. All other deliveries wait until the
25187 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
25190 <indexterm role="option">
25191 <primary><option>queue_list_requires_admin</option></primary>
25194 <informaltable frame="all">
25195 <tgroup cols="4" colsep="0" rowsep="0">
25196 <colspec colwidth="8*" align="left"/>
25197 <colspec colwidth="6*" align="center"/>
25198 <colspec colwidth="6*" align="center"/>
25199 <colspec colwidth="6*" align="right"/>
25202 <entry><option>queue_list_requires_admin</option></entry>
25203 <entry>Use: <emphasis>main</emphasis></entry>
25204 <entry>Type: <emphasis>boolean</emphasis></entry>
25205 <entry>Default: <emphasis>true</emphasis></entry>
25211 <indexterm role="option">
25212 <primary><option>-bp</option></primary>
25214 The <option>-bp</option> command-line option, which lists the messages that are on the
25215 queue, requires the caller to be an admin user unless
25216 <option>queue_list_requires_admin</option> is set false. See also <option>prod_requires_admin</option>.
25219 <indexterm role="option">
25220 <primary><option>queue_only</option></primary>
25223 <informaltable frame="all">
25224 <tgroup cols="4" colsep="0" rowsep="0">
25225 <colspec colwidth="8*" align="left"/>
25226 <colspec colwidth="6*" align="center"/>
25227 <colspec colwidth="6*" align="center"/>
25228 <colspec colwidth="6*" align="right"/>
25231 <entry><option>queue_only</option></entry>
25232 <entry>Use: <emphasis>main</emphasis></entry>
25233 <entry>Type: <emphasis>boolean</emphasis></entry>
25234 <entry>Default: <emphasis>false</emphasis></entry>
25240 <indexterm role="concept">
25241 <primary>queueing incoming messages</primary>
25243 <indexterm role="concept">
25244 <primary>message</primary>
25245 <secondary>queueing unconditionally</secondary>
25247 If <option>queue_only</option> is set, a delivery process is not automatically started
25248 whenever a message is received. Instead, the message waits on the queue for the
25249 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
25250 delivered immediately when certain conditions (such as heavy load) occur.
25253 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
25254 and <option>-odi</option> command line options override <option>queue_only</option> unless
25255 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
25256 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
25259 <indexterm role="option">
25260 <primary><option>queue_only_file</option></primary>
25263 <informaltable frame="all">
25264 <tgroup cols="4" colsep="0" rowsep="0">
25265 <colspec colwidth="8*" align="left"/>
25266 <colspec colwidth="6*" align="center"/>
25267 <colspec colwidth="6*" align="center"/>
25268 <colspec colwidth="6*" align="right"/>
25271 <entry><option>queue_only_file</option></entry>
25272 <entry>Use: <emphasis>main</emphasis></entry>
25273 <entry>Type: <emphasis>string</emphasis></entry>
25274 <entry>Default: <emphasis>unset</emphasis></entry>
25280 <indexterm role="concept">
25281 <primary>queueing incoming messages</primary>
25283 <indexterm role="concept">
25284 <primary>message</primary>
25285 <secondary>queueing by file existence</secondary>
25287 This option can be set to a colon-separated list of absolute path names, each
25288 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
25289 it tests for the existence of each listed path using a call to <function>stat()</function>. For
25290 each path that exists, the corresponding queueing option is set.
25291 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
25292 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
25294 <literallayout class="monospaced">
25295 queue_only_file = smtp/some/file
25298 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
25299 <filename>/some/file</filename> exists.
25302 <indexterm role="option">
25303 <primary><option>queue_only_load</option></primary>
25306 <informaltable frame="all">
25307 <tgroup cols="4" colsep="0" rowsep="0">
25308 <colspec colwidth="8*" align="left"/>
25309 <colspec colwidth="6*" align="center"/>
25310 <colspec colwidth="6*" align="center"/>
25311 <colspec colwidth="6*" align="right"/>
25314 <entry><option>queue_only_load</option></entry>
25315 <entry>Use: <emphasis>main</emphasis></entry>
25316 <entry>Type: <emphasis>fixed-point</emphasis></entry>
25317 <entry>Default: <emphasis>unset</emphasis></entry>
25323 <indexterm role="concept">
25324 <primary>load average</primary>
25326 <indexterm role="concept">
25327 <primary>queueing incoming messages</primary>
25329 <indexterm role="concept">
25330 <primary>message</primary>
25331 <secondary>queueing by load</secondary>
25333 If the system load average is higher than this value, incoming messages from
25334 all sources are queued, and no automatic deliveries are started. If this
25335 happens during local or remote SMTP input, all subsequent messages received on
25336 the same SMTP connection are queued by default, whatever happens to the load in
25337 the meantime, but this can be changed by setting <option>queue_only_load_latch</option>
25341 Deliveries will subsequently be performed by queue runner processes. This
25342 option has no effect on ancient operating systems on which Exim cannot
25343 determine the load average. See also <option>deliver_queue_load_max</option> and
25344 <option>smtp_load_reserve</option>.
25347 <indexterm role="option">
25348 <primary><option>queue_only_load_latch</option></primary>
25351 <informaltable frame="all">
25352 <tgroup cols="4" colsep="0" rowsep="0">
25353 <colspec colwidth="8*" align="left"/>
25354 <colspec colwidth="6*" align="center"/>
25355 <colspec colwidth="6*" align="center"/>
25356 <colspec colwidth="6*" align="right"/>
25359 <entry><option>queue_only_load_latch</option></entry>
25360 <entry>Use: <emphasis>main</emphasis></entry>
25361 <entry>Type: <emphasis>boolean</emphasis></entry>
25362 <entry>Default: <emphasis>true</emphasis></entry>
25368 <indexterm role="concept">
25369 <primary>load average</primary>
25370 <secondary>re-evaluating per message</secondary>
25372 When this option is true (the default), once one message has been queued
25373 because the load average is higher than the value set by <option>queue_only_load</option>,
25374 all subsequent messages received on the same SMTP connection are also queued.
25375 This is a deliberate choice; even though the load average may fall below the
25376 threshold, it doesn’t seem right to deliver later messages on the same
25377 connection when not delivering earlier ones. However, there are special
25378 circumstances such as very long-lived connections from scanning appliances
25379 where this is not the best strategy. In such cases, <option>queue_only_load_latch</option>
25380 should be set false. This causes the value of the load average to be
25381 re-evaluated for each message.
25384 <indexterm role="option">
25385 <primary><option>queue_only_override</option></primary>
25388 <informaltable frame="all">
25389 <tgroup cols="4" colsep="0" rowsep="0">
25390 <colspec colwidth="8*" align="left"/>
25391 <colspec colwidth="6*" align="center"/>
25392 <colspec colwidth="6*" align="center"/>
25393 <colspec colwidth="6*" align="right"/>
25396 <entry><option>queue_only_override</option></entry>
25397 <entry>Use: <emphasis>main</emphasis></entry>
25398 <entry>Type: <emphasis>boolean</emphasis></entry>
25399 <entry>Default: <emphasis>true</emphasis></entry>
25405 <indexterm role="concept">
25406 <primary>queueing incoming messages</primary>
25408 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
25409 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
25410 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
25411 to override; they are accepted, but ignored.
25414 <indexterm role="option">
25415 <primary><option>queue_run_in_order</option></primary>
25418 <informaltable frame="all">
25419 <tgroup cols="4" colsep="0" rowsep="0">
25420 <colspec colwidth="8*" align="left"/>
25421 <colspec colwidth="6*" align="center"/>
25422 <colspec colwidth="6*" align="center"/>
25423 <colspec colwidth="6*" align="right"/>
25426 <entry><option>queue_run_in_order</option></entry>
25427 <entry>Use: <emphasis>main</emphasis></entry>
25428 <entry>Type: <emphasis>boolean</emphasis></entry>
25429 <entry>Default: <emphasis>false</emphasis></entry>
25435 <indexterm role="concept">
25436 <primary>queue runner</primary>
25437 <secondary>processing messages in order</secondary>
25439 If this option is set, queue runs happen in order of message arrival instead of
25440 in an arbitrary order. For this to happen, a complete list of the entire queue
25441 must be set up before the deliveries start. When the queue is all held in a
25442 single directory (the default), a single list is created for both the ordered
25443 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
25444 single list is not created when <option>queue_run_in_order</option> is false. In this case,
25445 the sub-directories are processed one at a time (in a random order), and this
25446 avoids setting up one huge list for the whole queue. Thus, setting
25447 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
25448 when the queue is large, because of the extra work in setting up the single,
25449 large list. In most situations, <option>queue_run_in_order</option> should not be set.
25452 <indexterm role="option">
25453 <primary><option>queue_run_max</option></primary>
25456 <informaltable frame="all">
25457 <tgroup cols="4" colsep="0" rowsep="0">
25458 <colspec colwidth="8*" align="left"/>
25459 <colspec colwidth="6*" align="center"/>
25460 <colspec colwidth="6*" align="center"/>
25461 <colspec colwidth="6*" align="right"/>
25464 <entry><option>queue_run_max</option></entry>
25465 <entry>Use: <emphasis>main</emphasis></entry>
25466 <entry>Type: <emphasis>integer</emphasis></entry>
25467 <entry>Default: <emphasis>5</emphasis></entry>
25473 <indexterm role="concept">
25474 <primary>queue runner</primary>
25475 <secondary>maximum number of</secondary>
25477 This controls the maximum number of queue runner processes that an Exim daemon
25478 can run simultaneously. This does not mean that it starts them all at once,
25479 but rather that if the maximum number are still running when the time comes to
25480 start another one, it refrains from starting another one. This can happen with
25481 very large queues and/or very sluggish deliveries. This option does not,
25482 however, interlock with other processes, so additional queue runners can be
25483 started by other means, or by killing and restarting the daemon.
25486 Setting this option to zero does not suppress queue runs; rather, it disables
25487 the limit, allowing any number of simultaneous queue runner processes to be
25488 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
25489 the daemon’s command line.
25492 <indexterm role="option">
25493 <primary><option>queue_smtp_domains</option></primary>
25496 <informaltable frame="all">
25497 <tgroup cols="4" colsep="0" rowsep="0">
25498 <colspec colwidth="8*" align="left"/>
25499 <colspec colwidth="6*" align="center"/>
25500 <colspec colwidth="6*" align="center"/>
25501 <colspec colwidth="6*" align="right"/>
25504 <entry><option>queue_smtp_domains</option></entry>
25505 <entry>Use: <emphasis>main</emphasis></entry>
25506 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
25507 <entry>Default: <emphasis>unset</emphasis></entry>
25513 <indexterm role="concept">
25514 <primary>queueing incoming messages</primary>
25516 <indexterm role="concept">
25517 <primary>message</primary>
25518 <secondary>queueing remote deliveries</secondary>
25520 When this option is set, a delivery process is started whenever a message is
25521 received, routing is performed, and local deliveries take place.
25522 However, if any SMTP deliveries are required for domains that match
25523 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
25524 message waits on the queue for the next queue run. Since routing of the message
25525 has taken place, Exim knows to which remote hosts it must be delivered, and so
25526 when the queue run happens, multiple messages for the same host are delivered
25527 over a single SMTP connection. The <option>-odqs</option> command line option causes all
25528 SMTP deliveries to be queued in this way, and is equivalent to setting
25529 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
25530 <option>queue_domains</option>.
25533 <indexterm role="option">
25534 <primary><option>receive_timeout</option></primary>
25537 <informaltable frame="all">
25538 <tgroup cols="4" colsep="0" rowsep="0">
25539 <colspec colwidth="8*" align="left"/>
25540 <colspec colwidth="6*" align="center"/>
25541 <colspec colwidth="6*" align="center"/>
25542 <colspec colwidth="6*" align="right"/>
25545 <entry><option>receive_timeout</option></entry>
25546 <entry>Use: <emphasis>main</emphasis></entry>
25547 <entry>Type: <emphasis>time</emphasis></entry>
25548 <entry>Default: <emphasis>0s</emphasis></entry>
25554 <indexterm role="concept">
25555 <primary>timeout</primary>
25556 <secondary>for non-SMTP input</secondary>
25558 This option sets the timeout for accepting a non-SMTP message, that is, the
25559 maximum time that Exim waits when reading a message on the standard input. If
25560 the value is zero, it will wait for ever. This setting is overridden by the
25561 <option>-or</option> command line option. The timeout for incoming SMTP messages is
25562 controlled by <option>smtp_receive_timeout</option>.
25565 <indexterm role="option">
25566 <primary><option>received_header_text</option></primary>
25569 <informaltable frame="all">
25570 <tgroup cols="4" colsep="0" rowsep="0">
25571 <colspec colwidth="8*" align="left"/>
25572 <colspec colwidth="6*" align="center"/>
25573 <colspec colwidth="6*" align="center"/>
25574 <colspec colwidth="6*" align="right"/>
25577 <entry><option>received_header_text</option></entry>
25578 <entry>Use: <emphasis>main</emphasis></entry>
25579 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
25580 <entry>Default: <emphasis>see below</emphasis></entry>
25586 <indexterm role="concept">
25587 <primary>customizing</primary>
25588 <secondary><emphasis>Received:</emphasis> header</secondary>
25590 <indexterm role="concept">
25591 <primary><emphasis>Received:</emphasis> header line</primary>
25592 <secondary>customizing</secondary>
25594 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
25595 added to each message, except for the timestamp, which is automatically added
25596 on at the end (preceded by a semicolon). The string is expanded each time it is
25597 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
25598 added to the message. Otherwise, the string should start with the text
25599 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
25600 header lines. The default setting is:
25602 <literallayout class="monospaced">
25603 received_header_text = Received: \
25604 ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
25605 {${if def:sender_ident \
25606 {from ${quote_local_part:$sender_ident} }}\
25607 ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
25608 by $primary_hostname \
25609 ${if def:received_protocol {with $received_protocol}} \
25610 ${if def:tls_cipher {($tls_cipher)\n\t}}\
25611 (Exim $version_number)\n\t\
25612 ${if def:sender_address \
25613 {(envelope-from <$sender_address>)\n\t}}\
25614 id $message_exim_id\
25615 ${if def:received_for {\n\tfor $received_for}}
25618 The reference to the TLS cipher is omitted when Exim is built without TLS
25619 support. The use of conditional expansions ensures that this works for both
25620 locally generated messages and messages received from remote hosts, giving
25621 header lines such as the following:
25623 <literallayout class="monospaced">
25624 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
25625 by marley.carol.example with esmtp (Exim 4.00)
25626 (envelope-from <bob@carol.example>)
25627 id 16IOWa-00019l-00
25628 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
25629 Received: by scrooge.carol.example with local (Exim 4.00)
25630 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
25633 Until the body of the message has been received, the timestamp is the time when
25634 the message started to be received. Once the body has arrived, and all policy
25635 checks have taken place, the timestamp is updated to the time at which the
25636 message was accepted.
25639 <indexterm role="option">
25640 <primary><option>received_headers_max</option></primary>
25643 <informaltable frame="all">
25644 <tgroup cols="4" colsep="0" rowsep="0">
25645 <colspec colwidth="8*" align="left"/>
25646 <colspec colwidth="6*" align="center"/>
25647 <colspec colwidth="6*" align="center"/>
25648 <colspec colwidth="6*" align="right"/>
25651 <entry><option>received_headers_max</option></entry>
25652 <entry>Use: <emphasis>main</emphasis></entry>
25653 <entry>Type: <emphasis>integer</emphasis></entry>
25654 <entry>Default: <emphasis>30</emphasis></entry>
25660 <indexterm role="concept">
25661 <primary>loop</primary>
25662 <secondary>prevention</secondary>
25664 <indexterm role="concept">
25665 <primary>mail loop prevention</primary>
25667 <indexterm role="concept">
25668 <primary><emphasis>Received:</emphasis> header line</primary>
25669 <secondary>counting</secondary>
25671 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
25672 counted, and if it is greater than this parameter, a mail loop is assumed to
25673 have occurred, the delivery is abandoned, and an error message is generated.
25674 This applies to both local and remote deliveries.
25677 <indexterm role="option">
25678 <primary><option>recipient_unqualified_hosts</option></primary>
25681 <informaltable frame="all">
25682 <tgroup cols="4" colsep="0" rowsep="0">
25683 <colspec colwidth="8*" align="left"/>
25684 <colspec colwidth="6*" align="center"/>
25685 <colspec colwidth="6*" align="center"/>
25686 <colspec colwidth="6*" align="right"/>
25689 <entry><option>recipient_unqualified_hosts</option></entry>
25690 <entry>Use: <emphasis>main</emphasis></entry>
25691 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
25692 <entry>Default: <emphasis>unset</emphasis></entry>
25698 <indexterm role="concept">
25699 <primary>unqualified addresses</primary>
25701 <indexterm role="concept">
25702 <primary>host</primary>
25703 <secondary>unqualified addresses from</secondary>
25705 This option lists those hosts from which Exim is prepared to accept unqualified
25706 recipient addresses in message envelopes. The addresses are made fully
25707 qualified by the addition of the <option>qualify_recipient</option> value. This option also
25708 affects message header lines. Exim does not reject unqualified recipient
25709 addresses in headers, but it qualifies them only if the message came from a
25710 host that matches <option>recipient_unqualified_hosts</option>,
25711 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
25712 option was not set.
25715 <indexterm role="option">
25716 <primary><option>recipients_max</option></primary>
25719 <informaltable frame="all">
25720 <tgroup cols="4" colsep="0" rowsep="0">
25721 <colspec colwidth="8*" align="left"/>
25722 <colspec colwidth="6*" align="center"/>
25723 <colspec colwidth="6*" align="center"/>
25724 <colspec colwidth="6*" align="right"/>
25727 <entry><option>recipients_max</option></entry>
25728 <entry>Use: <emphasis>main</emphasis></entry>
25729 <entry>Type: <emphasis>integer</emphasis></entry>
25730 <entry>Default: <emphasis>0</emphasis></entry>
25736 <indexterm role="concept">
25737 <primary>limit</primary>
25738 <secondary>number of recipients</secondary>
25740 <indexterm role="concept">
25741 <primary>recipient</primary>
25742 <secondary>maximum number</secondary>
25744 If this option is set greater than zero, it specifies the maximum number of
25745 original recipients for any message. Additional recipients that are generated
25746 by aliasing or forwarding do not count. SMTP messages get a 452 response for
25747 all recipients over the limit; earlier recipients are delivered as normal.
25748 Non-SMTP messages with too many recipients are failed, and no deliveries are
25752 <indexterm role="concept">
25753 <primary>RCPT</primary>
25754 <secondary>maximum number of incoming</secondary>
25756 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
25757 RCPT commands in a single message.
25760 <indexterm role="option">
25761 <primary><option>recipients_max_reject</option></primary>
25764 <informaltable frame="all">
25765 <tgroup cols="4" colsep="0" rowsep="0">
25766 <colspec colwidth="8*" align="left"/>
25767 <colspec colwidth="6*" align="center"/>
25768 <colspec colwidth="6*" align="center"/>
25769 <colspec colwidth="6*" align="right"/>
25772 <entry><option>recipients_max_reject</option></entry>
25773 <entry>Use: <emphasis>main</emphasis></entry>
25774 <entry>Type: <emphasis>boolean</emphasis></entry>
25775 <entry>Default: <emphasis>false</emphasis></entry>
25781 If this option is set true, Exim rejects SMTP messages containing too many
25782 recipients by giving 552 errors to the surplus RCPT commands, and a 554
25783 error to the eventual DATA command. Otherwise (the default) it gives a 452
25784 error to the surplus RCPT commands and accepts the message on behalf of the
25785 initial set of recipients. The remote server should then re-send the message
25786 for the remaining recipients at a later time.
25789 <indexterm role="option">
25790 <primary><option>remote_max_parallel</option></primary>
25793 <informaltable frame="all">
25794 <tgroup cols="4" colsep="0" rowsep="0">
25795 <colspec colwidth="8*" align="left"/>
25796 <colspec colwidth="6*" align="center"/>
25797 <colspec colwidth="6*" align="center"/>
25798 <colspec colwidth="6*" align="right"/>
25801 <entry><option>remote_max_parallel</option></entry>
25802 <entry>Use: <emphasis>main</emphasis></entry>
25803 <entry>Type: <emphasis>integer</emphasis></entry>
25804 <entry>Default: <emphasis>2</emphasis></entry>
25810 <indexterm role="concept">
25811 <primary>delivery</primary>
25812 <secondary>parallelism for remote</secondary>
25814 This option controls parallel delivery of one message to a number of remote
25815 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
25816 does all the remote deliveries for a message one by one. Otherwise, if a single
25817 message has to be delivered to more than one remote host, or if several copies
25818 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
25819 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
25820 deliveries are required, the maximum number of processes are started, and as
25821 each one finishes, another is begun. The order of starting processes is the
25822 same as if sequential delivery were being done, and can be controlled by the
25823 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
25824 with debugging turned on, the debugging output from each delivery process is
25825 tagged with its process id.
25828 This option controls only the maximum number of parallel deliveries for one
25829 message in one Exim delivery process. Because Exim has no central queue
25830 manager, there is no way of controlling the total number of simultaneous
25831 deliveries if the configuration allows a delivery attempt as soon as a message
25835 <indexterm role="concept">
25836 <primary>number of deliveries</primary>
25838 <indexterm role="concept">
25839 <primary>delivery</primary>
25840 <secondary>maximum number of</secondary>
25842 If you want to control the total number of deliveries on the system, you
25843 need to set the <option>queue_only</option> option. This ensures that all incoming messages
25844 are added to the queue without starting a delivery process. Then set up an Exim
25845 daemon to start queue runner processes at appropriate intervals (probably
25846 fairly often, for example, every minute), and limit the total number of queue
25847 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
25848 delivers only one message at a time, the maximum number of deliveries that can
25849 then take place at once is <option>queue_run_max</option> multiplied by
25850 <option>remote_max_parallel</option>.
25853 If it is purely remote deliveries you want to control, use
25854 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
25855 doing the SMTP routing before queueing, so that several messages for the same
25856 host will eventually get delivered down the same connection.
25859 <indexterm role="option">
25860 <primary><option>remote_sort_domains</option></primary>
25863 <informaltable frame="all">
25864 <tgroup cols="4" colsep="0" rowsep="0">
25865 <colspec colwidth="8*" align="left"/>
25866 <colspec colwidth="6*" align="center"/>
25867 <colspec colwidth="6*" align="center"/>
25868 <colspec colwidth="6*" align="right"/>
25871 <entry><option>remote_sort_domains</option></entry>
25872 <entry>Use: <emphasis>main</emphasis></entry>
25873 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
25874 <entry>Default: <emphasis>unset</emphasis></entry>
25880 <indexterm role="concept">
25881 <primary>sorting remote deliveries</primary>
25883 <indexterm role="concept">
25884 <primary>delivery</primary>
25885 <secondary>sorting remote</secondary>
25887 When there are a number of remote deliveries for a message, they are sorted by
25888 domain into the order given by this list. For example,
25890 <literallayout class="monospaced">
25891 remote_sort_domains = *.cam.ac.uk:*.uk
25894 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
25895 then to those in the <option>uk</option> domain, then to any others.
25898 <indexterm role="option">
25899 <primary><option>retry_data_expire</option></primary>
25902 <informaltable frame="all">
25903 <tgroup cols="4" colsep="0" rowsep="0">
25904 <colspec colwidth="8*" align="left"/>
25905 <colspec colwidth="6*" align="center"/>
25906 <colspec colwidth="6*" align="center"/>
25907 <colspec colwidth="6*" align="right"/>
25910 <entry><option>retry_data_expire</option></entry>
25911 <entry>Use: <emphasis>main</emphasis></entry>
25912 <entry>Type: <emphasis>time</emphasis></entry>
25913 <entry>Default: <emphasis>7d</emphasis></entry>
25919 <indexterm role="concept">
25920 <primary>hints database</primary>
25921 <secondary>data expiry</secondary>
25923 This option sets a <quote>use before</quote> time on retry information in Exim’s hints
25924 database. Any older retry data is ignored. This means that, for example, once a
25925 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
25929 <indexterm role="option">
25930 <primary><option>retry_interval_max</option></primary>
25933 <informaltable frame="all">
25934 <tgroup cols="4" colsep="0" rowsep="0">
25935 <colspec colwidth="8*" align="left"/>
25936 <colspec colwidth="6*" align="center"/>
25937 <colspec colwidth="6*" align="center"/>
25938 <colspec colwidth="6*" align="right"/>
25941 <entry><option>retry_interval_max</option></entry>
25942 <entry>Use: <emphasis>main</emphasis></entry>
25943 <entry>Type: <emphasis>time</emphasis></entry>
25944 <entry>Default: <emphasis>24h</emphasis></entry>
25950 <indexterm role="concept">
25951 <primary>retry</primary>
25952 <secondary>limit on interval</secondary>
25954 <indexterm role="concept">
25955 <primary>limit</primary>
25956 <secondary>on retry interval</secondary>
25958 Chapter <xref linkend="CHAPretry"/> describes Exim’s mechanisms for controlling the
25959 intervals between delivery attempts for messages that cannot be delivered
25960 straight away. This option sets an overall limit to the length of time between
25961 retries. It cannot be set greater than 24 hours; any attempt to do so forces
25965 <indexterm role="option">
25966 <primary><option>return_path_remove</option></primary>
25969 <informaltable frame="all">
25970 <tgroup cols="4" colsep="0" rowsep="0">
25971 <colspec colwidth="8*" align="left"/>
25972 <colspec colwidth="6*" align="center"/>
25973 <colspec colwidth="6*" align="center"/>
25974 <colspec colwidth="6*" align="right"/>
25977 <entry><option>return_path_remove</option></entry>
25978 <entry>Use: <emphasis>main</emphasis></entry>
25979 <entry>Type: <emphasis>boolean</emphasis></entry>
25980 <entry>Default: <emphasis>true</emphasis></entry>
25986 <indexterm role="concept">
25987 <primary><emphasis>Return-path:</emphasis> header line</primary>
25988 <secondary>removing</secondary>
25990 RFC 2821, section 4.4, states that an SMTP server must insert a
25991 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
25992 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
25993 MAIL command. This description implies that this header should not be present
25994 in an incoming message. If <option>return_path_remove</option> is true, any existing
25995 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
25996 received. Exim’s transports have options for adding <emphasis>Return-path:</emphasis> headers at
25997 the time of delivery. They are normally used only for final local deliveries.
26000 <indexterm role="option">
26001 <primary><option>return_size_limit</option></primary>
26004 <informaltable frame="all">
26005 <tgroup cols="4" colsep="0" rowsep="0">
26006 <colspec colwidth="8*" align="left"/>
26007 <colspec colwidth="6*" align="center"/>
26008 <colspec colwidth="6*" align="center"/>
26009 <colspec colwidth="6*" align="right"/>
26012 <entry><option>return_size_limit</option></entry>
26013 <entry>Use: <emphasis>main</emphasis></entry>
26014 <entry>Type: <emphasis>integer</emphasis></entry>
26015 <entry>Default: <emphasis>100K</emphasis></entry>
26021 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
26024 <indexterm role="option">
26025 <primary><option>rfc1413_hosts</option></primary>
26028 <informaltable frame="all">
26029 <tgroup cols="4" colsep="0" rowsep="0">
26030 <colspec colwidth="8*" align="left"/>
26031 <colspec colwidth="6*" align="center"/>
26032 <colspec colwidth="6*" align="center"/>
26033 <colspec colwidth="6*" align="right"/>
26036 <entry><option>rfc1413_hosts</option></entry>
26037 <entry>Use: <emphasis>main</emphasis></entry>
26038 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
26039 <entry>Default: <emphasis>*</emphasis></entry>
26045 <indexterm role="concept">
26046 <primary>RFC 1413</primary>
26048 <indexterm role="concept">
26049 <primary>host</primary>
26050 <secondary>for RFC 1413 calls</secondary>
26052 RFC 1413 identification calls are made to any client host which matches an item
26056 <indexterm role="option">
26057 <primary><option>rfc1413_query_timeout</option></primary>
26060 <informaltable frame="all">
26061 <tgroup cols="4" colsep="0" rowsep="0">
26062 <colspec colwidth="8*" align="left"/>
26063 <colspec colwidth="6*" align="center"/>
26064 <colspec colwidth="6*" align="center"/>
26065 <colspec colwidth="6*" align="right"/>
26068 <entry><option>rfc1413_query_timeout</option></entry>
26069 <entry>Use: <emphasis>main</emphasis></entry>
26070 <entry>Type: <emphasis>time</emphasis></entry>
26071 <entry>Default: <emphasis>5s</emphasis></entry>
26077 <indexterm role="concept">
26078 <primary>RFC 1413</primary>
26079 <secondary>query timeout</secondary>
26081 <indexterm role="concept">
26082 <primary>timeout</primary>
26083 <secondary>for RFC 1413 call</secondary>
26085 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
26086 no RFC 1413 calls are ever made.
26089 <indexterm role="option">
26090 <primary><option>sender_unqualified_hosts</option></primary>
26093 <informaltable frame="all">
26094 <tgroup cols="4" colsep="0" rowsep="0">
26095 <colspec colwidth="8*" align="left"/>
26096 <colspec colwidth="6*" align="center"/>
26097 <colspec colwidth="6*" align="center"/>
26098 <colspec colwidth="6*" align="right"/>
26101 <entry><option>sender_unqualified_hosts</option></entry>
26102 <entry>Use: <emphasis>main</emphasis></entry>
26103 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
26104 <entry>Default: <emphasis>unset</emphasis></entry>
26110 <indexterm role="concept">
26111 <primary>unqualified addresses</primary>
26113 <indexterm role="concept">
26114 <primary>host</primary>
26115 <secondary>unqualified addresses from</secondary>
26117 This option lists those hosts from which Exim is prepared to accept unqualified
26118 sender addresses. The addresses are made fully qualified by the addition of
26119 <option>qualify_domain</option>. This option also affects message header lines. Exim does
26120 not reject unqualified addresses in headers that contain sender addresses, but
26121 it qualifies them only if the message came from a host that matches
26122 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
26123 using TCP/IP), and the <option>-bnq</option> option was not set.
26126 <indexterm role="option">
26127 <primary><option>smtp_accept_keepalive</option></primary>
26130 <informaltable frame="all">
26131 <tgroup cols="4" colsep="0" rowsep="0">
26132 <colspec colwidth="8*" align="left"/>
26133 <colspec colwidth="6*" align="center"/>
26134 <colspec colwidth="6*" align="center"/>
26135 <colspec colwidth="6*" align="right"/>
26138 <entry><option>smtp_accept_keepalive</option></entry>
26139 <entry>Use: <emphasis>main</emphasis></entry>
26140 <entry>Type: <emphasis>boolean</emphasis></entry>
26141 <entry>Default: <emphasis>true</emphasis></entry>
26147 <indexterm role="concept">
26148 <primary>keepalive</primary>
26149 <secondary>on incoming connection</secondary>
26151 This option controls the setting of the SO_KEEPALIVE option on incoming
26152 TCP/IP socket connections. When set, it causes the kernel to probe idle
26153 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
26154 other end of the connection should send an acknowledgment if the connection is
26155 still okay or a reset if the connection has been aborted. The reason for doing
26156 this is that it has the beneficial effect of freeing up certain types of
26157 connection that can get stuck when the remote host is disconnected without
26158 tidying up the TCP/IP call properly. The keepalive mechanism takes several
26159 hours to detect unreachable hosts.
26162 <indexterm role="option">
26163 <primary><option>smtp_accept_max</option></primary>
26166 <informaltable frame="all">
26167 <tgroup cols="4" colsep="0" rowsep="0">
26168 <colspec colwidth="8*" align="left"/>
26169 <colspec colwidth="6*" align="center"/>
26170 <colspec colwidth="6*" align="center"/>
26171 <colspec colwidth="6*" align="right"/>
26174 <entry><option>smtp_accept_max</option></entry>
26175 <entry>Use: <emphasis>main</emphasis></entry>
26176 <entry>Type: <emphasis>integer</emphasis></entry>
26177 <entry>Default: <emphasis>20</emphasis></entry>
26183 <indexterm role="concept">
26184 <primary>limit</primary>
26185 <secondary>incoming SMTP connections</secondary>
26187 <indexterm role="concept">
26188 <primary>SMTP</primary>
26189 <secondary>incoming connection count</secondary>
26191 <indexterm role="concept">
26192 <primary>inetd</primary>
26194 This option specifies the maximum number of simultaneous incoming SMTP calls
26195 that Exim will accept. It applies only to the listening daemon; there is no
26196 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
26197 value is set to zero, no limit is applied. However, it is required to be
26198 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
26199 set. See also <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option>.
26202 A new SMTP connection is immediately rejected if the <option>smtp_accept_max</option> limit
26203 has been reached. If not, Exim first checks <option>smtp_accept_max_per_host</option>. If
26204 that limit has not been reached for the client host, <option>smtp_accept_reserve</option>
26205 and <option>smtp_load_reserve</option> are then checked before accepting the connection.
26208 <indexterm role="option">
26209 <primary><option>smtp_accept_max_nonmail</option></primary>
26212 <informaltable frame="all">
26213 <tgroup cols="4" colsep="0" rowsep="0">
26214 <colspec colwidth="8*" align="left"/>
26215 <colspec colwidth="6*" align="center"/>
26216 <colspec colwidth="6*" align="center"/>
26217 <colspec colwidth="6*" align="right"/>
26220 <entry><option>smtp_accept_max_nonmail</option></entry>
26221 <entry>Use: <emphasis>main</emphasis></entry>
26222 <entry>Type: <emphasis>integer</emphasis></entry>
26223 <entry>Default: <emphasis>10</emphasis></entry>
26229 <indexterm role="concept">
26230 <primary>limit</primary>
26231 <secondary>non-mail SMTP commands</secondary>
26233 <indexterm role="concept">
26234 <primary>SMTP</primary>
26235 <secondary>limiting non-mail commands</secondary>
26237 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
26238 the connection if there are too many. This option defines <quote>too many</quote>. The
26239 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
26240 client looping sending EHLO, for example. The check is applied only if the
26241 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
26244 When a new message is expected, one occurrence of RSET is not counted. This
26245 allows a client to send one RSET between messages (this is not necessary,
26246 but some clients do it). Exim also allows one uncounted occurrence of HELO
26247 or EHLO, and one occurrence of STARTTLS between messages. After
26248 starting up a TLS session, another EHLO is expected, and so it too is not
26249 counted. The first occurrence of AUTH in a connection, or immediately
26250 following STARTTLS is not counted. Otherwise, all commands other than
26251 MAIL, RCPT, DATA, and QUIT are counted.
26254 <indexterm role="option">
26255 <primary><option>smtp_accept_max_nonmail_hosts</option></primary>
26258 <informaltable frame="all">
26259 <tgroup cols="4" colsep="0" rowsep="0">
26260 <colspec colwidth="8*" align="left"/>
26261 <colspec colwidth="6*" align="center"/>
26262 <colspec colwidth="6*" align="center"/>
26263 <colspec colwidth="6*" align="right"/>
26266 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
26267 <entry>Use: <emphasis>main</emphasis></entry>
26268 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
26269 <entry>Default: <emphasis>*</emphasis></entry>
26275 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
26276 check by setting this option. The default value makes it apply to all hosts. By
26277 changing the value, you can exclude any badly-behaved hosts that you have to
26281 <indexterm role="option">
26282 <primary><option>smtp_accept_max_per_connection</option></primary>
26285 <informaltable frame="all">
26286 <tgroup cols="4" colsep="0" rowsep="0">
26287 <colspec colwidth="8*" align="left"/>
26288 <colspec colwidth="6*" align="center"/>
26289 <colspec colwidth="6*" align="center"/>
26290 <colspec colwidth="6*" align="right"/>
26293 <entry><option>smtp_accept_max_per_ connection</option></entry>
26294 <entry>Use: <emphasis>main</emphasis></entry>
26295 <entry>Type: <emphasis>integer</emphasis></entry>
26296 <entry>Default: <emphasis>1000</emphasis></entry>
26302 <indexterm role="concept">
26303 <primary>SMTP</primary>
26304 <secondary>limiting incoming message count</secondary>
26306 <indexterm role="concept">
26307 <primary>limit</primary>
26308 <secondary>messages per SMTP connection</secondary>
26310 The value of this option limits the number of MAIL commands that Exim is
26311 prepared to accept over a single SMTP connection, whether or not each command
26312 results in the transfer of a message. After the limit is reached, a 421
26313 response is given to subsequent MAIL commands. This limit is a safety
26314 precaution against a client that goes mad (incidents of this type have been
26318 <indexterm role="option">
26319 <primary><option>smtp_accept_max_per_host</option></primary>
26322 <informaltable frame="all">
26323 <tgroup cols="4" colsep="0" rowsep="0">
26324 <colspec colwidth="8*" align="left"/>
26325 <colspec colwidth="6*" align="center"/>
26326 <colspec colwidth="6*" align="center"/>
26327 <colspec colwidth="6*" align="right"/>
26330 <entry><option>smtp_accept_max_per_host</option></entry>
26331 <entry>Use: <emphasis>main</emphasis></entry>
26332 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26333 <entry>Default: <emphasis>unset</emphasis></entry>
26339 <indexterm role="concept">
26340 <primary>limit</primary>
26341 <secondary>SMTP connections from one host</secondary>
26343 <indexterm role="concept">
26344 <primary>host</primary>
26345 <secondary>limiting SMTP connections from</secondary>
26347 This option restricts the number of simultaneous IP connections from a single
26348 host (strictly, from a single IP address) to the Exim daemon. The option is
26349 expanded, to enable different limits to be applied to different hosts by
26350 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
26351 connection attempts from the same host are rejected with error code 421. This
26352 is entirely independent of <option>smtp_accept_reserve</option>. The option’s default value
26353 of zero imposes no limit. If this option is set greater than zero, it is
26354 required that <option>smtp_accept_max</option> be non-zero.
26357 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
26358 constructions that take an appreciable amount of time. The expansion and test
26359 happen in the main daemon loop, in order to reject additional connections
26360 without forking additional processes (otherwise a denial-of-service attack
26361 could cause a vast number or processes to be created). While the daemon is
26362 doing this processing, it cannot accept any other incoming connections.
26365 <indexterm role="option">
26366 <primary><option>smtp_accept_queue</option></primary>
26369 <informaltable frame="all">
26370 <tgroup cols="4" colsep="0" rowsep="0">
26371 <colspec colwidth="8*" align="left"/>
26372 <colspec colwidth="6*" align="center"/>
26373 <colspec colwidth="6*" align="center"/>
26374 <colspec colwidth="6*" align="right"/>
26377 <entry><option>smtp_accept_queue</option></entry>
26378 <entry>Use: <emphasis>main</emphasis></entry>
26379 <entry>Type: <emphasis>integer</emphasis></entry>
26380 <entry>Default: <emphasis>0</emphasis></entry>
26386 <indexterm role="concept">
26387 <primary>SMTP</primary>
26388 <secondary>incoming connection count</secondary>
26390 <indexterm role="concept">
26391 <primary>queueing incoming messages</primary>
26393 <indexterm role="concept">
26394 <primary>message</primary>
26395 <secondary>queueing by SMTP connection count</secondary>
26397 If the number of simultaneous incoming SMTP connections being handled via the
26398 listening daemon exceeds this value, messages received by SMTP are just placed
26399 on the queue; no delivery processes are started automatically. The count is
26400 fixed at the start of an SMTP connection. It cannot be updated in the
26401 subprocess that receives messages, and so the queueing or not queueing applies
26402 to all messages received in the same connection.
26405 A value of zero implies no limit, and clearly any non-zero value is useful only
26406 if it is less than the <option>smtp_accept_max</option> value (unless that is zero). See
26407 also <option>queue_only</option>, <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the
26408 various <option>-od</option><emphasis>x</emphasis> command line options.
26411 <indexterm role="option">
26412 <primary><option>smtp_accept_queue_per_connection</option></primary>
26415 <informaltable frame="all">
26416 <tgroup cols="4" colsep="0" rowsep="0">
26417 <colspec colwidth="8*" align="left"/>
26418 <colspec colwidth="6*" align="center"/>
26419 <colspec colwidth="6*" align="center"/>
26420 <colspec colwidth="6*" align="right"/>
26423 <entry><option>smtp_accept_queue_per_ connection</option></entry>
26424 <entry>Use: <emphasis>main</emphasis></entry>
26425 <entry>Type: <emphasis>integer</emphasis></entry>
26426 <entry>Default: <emphasis>10</emphasis></entry>
26432 <indexterm role="concept">
26433 <primary>queueing incoming messages</primary>
26435 <indexterm role="concept">
26436 <primary>message</primary>
26437 <secondary>queueing by message count</secondary>
26439 This option limits the number of delivery processes that Exim starts
26440 automatically when receiving messages via SMTP, whether via the daemon or by
26441 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
26442 and the number of messages received in a single SMTP session exceeds this
26443 number, subsequent messages are placed on the queue, but no delivery processes
26444 are started. This helps to limit the number of Exim processes when a server
26445 restarts after downtime and there is a lot of mail waiting for it on other
26446 systems. On large systems, the default should probably be increased, and on
26447 dial-in client systems it should probably be set to zero (that is, disabled).
26450 <indexterm role="option">
26451 <primary><option>smtp_accept_reserve</option></primary>
26454 <informaltable frame="all">
26455 <tgroup cols="4" colsep="0" rowsep="0">
26456 <colspec colwidth="8*" align="left"/>
26457 <colspec colwidth="6*" align="center"/>
26458 <colspec colwidth="6*" align="center"/>
26459 <colspec colwidth="6*" align="right"/>
26462 <entry><option>smtp_accept_reserve</option></entry>
26463 <entry>Use: <emphasis>main</emphasis></entry>
26464 <entry>Type: <emphasis>integer</emphasis></entry>
26465 <entry>Default: <emphasis>0</emphasis></entry>
26471 <indexterm role="concept">
26472 <primary>SMTP</primary>
26473 <secondary>incoming call count</secondary>
26475 <indexterm role="concept">
26476 <primary>host</primary>
26477 <secondary>reserved</secondary>
26479 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
26480 number of SMTP connections that are reserved for connections from the hosts
26481 that are specified in <option>smtp_reserve_hosts</option>. The value set in
26482 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
26483 restricted to this number of connections; the option specifies a minimum number
26484 of connection slots for them, not a maximum. It is a guarantee that this group
26485 of hosts can always get at least <option>smtp_accept_reserve</option> connections. However,
26486 the limit specified by <option>smtp_accept_max_per_host</option> is still applied to each
26490 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
26491 set to 5, once there are 45 active connections (from any hosts), new
26492 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>,
26493 provided the other criteria for acceptance are met.
26496 <indexterm role="option">
26497 <primary><option>smtp_active_hostname</option></primary>
26500 <informaltable frame="all">
26501 <tgroup cols="4" colsep="0" rowsep="0">
26502 <colspec colwidth="8*" align="left"/>
26503 <colspec colwidth="6*" align="center"/>
26504 <colspec colwidth="6*" align="center"/>
26505 <colspec colwidth="6*" align="right"/>
26508 <entry><option>smtp_active_hostname</option></entry>
26509 <entry>Use: <emphasis>main</emphasis></entry>
26510 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26511 <entry>Default: <emphasis>unset</emphasis></entry>
26517 <indexterm role="concept">
26518 <primary>host</primary>
26519 <secondary>name in SMTP responses</secondary>
26521 <indexterm role="concept">
26522 <primary>SMTP</primary>
26523 <secondary>host name in responses</secondary>
26525 <indexterm role="variable">
26526 <primary><varname>$primary_hostname</varname></primary>
26528 This option is provided for multi-homed servers that want to masquerade as
26529 several different hosts. At the start of an incoming SMTP connection, its value
26530 is expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
26531 responses. For example, it is used as domain name in the response to an
26532 incoming HELO or EHLO command.
26535 <indexterm role="variable">
26536 <primary><varname>$smtp_active_hostname</varname></primary>
26538 The active hostname is placed in the <varname>$smtp_active_hostname</varname> variable, which
26539 is saved with any messages that are received. It is therefore available for use
26540 in routers and transports when the message is later delivered.
26543 If this option is unset, or if its expansion is forced to fail, or if the
26544 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
26545 used. Other expansion failures cause a message to be written to the main and
26546 panic logs, and the SMTP command receives a temporary error. Typically, the
26547 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
26550 <literallayout class="monospaced">
26551 smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\
26552 {cox.mydomain}{box.mydomain}}
26555 Although <varname>$smtp_active_hostname</varname> is primarily concerned with incoming
26556 messages, it is also used as the default for HELO commands in callout
26557 verification if there is no remote transport from which to obtain a
26558 <option>helo_data</option> value.
26561 <indexterm role="option">
26562 <primary><option>smtp_banner</option></primary>
26565 <informaltable frame="all">
26566 <tgroup cols="4" colsep="0" rowsep="0">
26567 <colspec colwidth="8*" align="left"/>
26568 <colspec colwidth="6*" align="center"/>
26569 <colspec colwidth="6*" align="center"/>
26570 <colspec colwidth="6*" align="right"/>
26573 <entry><option>smtp_banner</option></entry>
26574 <entry>Use: <emphasis>main</emphasis></entry>
26575 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26576 <entry>Default: <emphasis>see below</emphasis></entry>
26582 <indexterm role="concept">
26583 <primary>SMTP</primary>
26584 <secondary>welcome banner</secondary>
26586 <indexterm role="concept">
26587 <primary>banner for SMTP</primary>
26589 <indexterm role="concept">
26590 <primary>welcome banner for SMTP</primary>
26592 <indexterm role="concept">
26593 <primary>customizing</primary>
26594 <secondary>SMTP banner</secondary>
26596 This string, which is expanded every time it is used, is output as the initial
26597 positive response to an SMTP connection. The default setting is:
26599 <literallayout class="monospaced">
26600 smtp_banner = $smtp_active_hostname ESMTP Exim \
26601 $version_number $tod_full
26604 Failure to expand the string causes a panic error. If you want to create a
26605 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
26606 appropriate points, but not at the end. Note that the 220 code is not included
26607 in this string. Exim adds it automatically (several times in the case of a
26608 multiline response).
26611 <indexterm role="option">
26612 <primary><option>smtp_check_spool_space</option></primary>
26615 <informaltable frame="all">
26616 <tgroup cols="4" colsep="0" rowsep="0">
26617 <colspec colwidth="8*" align="left"/>
26618 <colspec colwidth="6*" align="center"/>
26619 <colspec colwidth="6*" align="center"/>
26620 <colspec colwidth="6*" align="right"/>
26623 <entry><option>smtp_check_spool_space</option></entry>
26624 <entry>Use: <emphasis>main</emphasis></entry>
26625 <entry>Type: <emphasis>boolean</emphasis></entry>
26626 <entry>Default: <emphasis>true</emphasis></entry>
26632 <indexterm role="concept">
26633 <primary>checking disk space</primary>
26635 <indexterm role="concept">
26636 <primary>disk space, checking</primary>
26638 <indexterm role="concept">
26639 <primary>spool directory</primary>
26640 <secondary>checking space</secondary>
26642 When this option is set, if an incoming SMTP session encounters the SIZE
26643 option on a MAIL command, it checks that there is enough space in the
26644 spool directory’s partition to accept a message of that size, while still
26645 leaving free the amount specified by <option>check_spool_space</option> (even if that value
26646 is zero). If there isn’t enough space, a temporary error code is returned.
26649 <indexterm role="option">
26650 <primary><option>smtp_connect_backlog</option></primary>
26653 <informaltable frame="all">
26654 <tgroup cols="4" colsep="0" rowsep="0">
26655 <colspec colwidth="8*" align="left"/>
26656 <colspec colwidth="6*" align="center"/>
26657 <colspec colwidth="6*" align="center"/>
26658 <colspec colwidth="6*" align="right"/>
26661 <entry><option>smtp_connect_backlog</option></entry>
26662 <entry>Use: <emphasis>main</emphasis></entry>
26663 <entry>Type: <emphasis>integer</emphasis></entry>
26664 <entry>Default: <emphasis>20</emphasis></entry>
26670 <indexterm role="concept">
26671 <primary>connection backlog</primary>
26673 <indexterm role="concept">
26674 <primary>SMTP</primary>
26675 <secondary>connection backlog</secondary>
26677 <indexterm role="concept">
26678 <primary>backlog of connections</primary>
26680 This option specifies a maximum number of waiting SMTP connections. Exim passes
26681 this value to the TCP/IP system when it sets up its listener. Once this number
26682 of connections are waiting for the daemon’s attention, subsequent connection
26683 attempts are refused at the TCP/IP level. At least, that is what the manuals
26684 say; in some circumstances such connection attempts have been observed to time
26685 out instead. For large systems it is probably a good idea to increase the
26686 value (to 50, say). It also gives some protection against denial-of-service
26687 attacks by SYN flooding.
26690 <indexterm role="option">
26691 <primary><option>smtp_enforce_sync</option></primary>
26694 <informaltable frame="all">
26695 <tgroup cols="4" colsep="0" rowsep="0">
26696 <colspec colwidth="8*" align="left"/>
26697 <colspec colwidth="6*" align="center"/>
26698 <colspec colwidth="6*" align="center"/>
26699 <colspec colwidth="6*" align="right"/>
26702 <entry><option>smtp_enforce_sync</option></entry>
26703 <entry>Use: <emphasis>main</emphasis></entry>
26704 <entry>Type: <emphasis>boolean</emphasis></entry>
26705 <entry>Default: <emphasis>true</emphasis></entry>
26711 <indexterm role="concept">
26712 <primary>SMTP</primary>
26713 <secondary>synchronization checking</secondary>
26715 <indexterm role="concept">
26716 <primary>synchronization checking in SMTP</primary>
26718 The SMTP protocol specification requires the client to wait for a response from
26719 the server at certain points in the dialogue. Without PIPELINING these
26720 synchronization points are after every command; with PIPELINING they are
26721 fewer, but they still exist.
26724 Some spamming sites send out a complete set of SMTP commands without waiting
26725 for any response. Exim protects against this by rejecting a message if the
26726 client has sent further input when it should not have. The error response <quote>554
26727 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
26728 for this error cannot be perfect because of transmission delays (unexpected
26729 input may be on its way but not yet received when Exim checks). However, it
26730 does detect many instances.
26733 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
26734 If you want to disable the check selectively (for example, only for certain
26735 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
26736 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
26739 <indexterm role="option">
26740 <primary><option>smtp_etrn_command</option></primary>
26743 <informaltable frame="all">
26744 <tgroup cols="4" colsep="0" rowsep="0">
26745 <colspec colwidth="8*" align="left"/>
26746 <colspec colwidth="6*" align="center"/>
26747 <colspec colwidth="6*" align="center"/>
26748 <colspec colwidth="6*" align="right"/>
26751 <entry><option>smtp_etrn_command</option></entry>
26752 <entry>Use: <emphasis>main</emphasis></entry>
26753 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26754 <entry>Default: <emphasis>unset</emphasis></entry>
26760 <indexterm role="concept">
26761 <primary>ETRN</primary>
26762 <secondary>command to be run</secondary>
26764 <indexterm role="variable">
26765 <primary><varname>$domain</varname></primary>
26767 If this option is set, the given command is run whenever an SMTP ETRN
26768 command is received from a host that is permitted to issue such commands (see
26769 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
26770 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
26771 argument of the ETRN command, and no syntax checking is done on it. For
26774 <literallayout class="monospaced">
26775 smtp_etrn_command = /etc/etrn_command $domain \
26776 $sender_host_address
26779 A new process is created to run the command, but Exim does not wait for it to
26780 complete. Consequently, its status cannot be checked. If the command cannot be
26781 run, a line is written to the panic log, but the ETRN caller still receives
26782 a 250 success response. Exim is normally running under its own uid when
26783 receiving SMTP, so it is not possible for it to change the uid before running
26787 <indexterm role="option">
26788 <primary><option>smtp_etrn_serialize</option></primary>
26791 <informaltable frame="all">
26792 <tgroup cols="4" colsep="0" rowsep="0">
26793 <colspec colwidth="8*" align="left"/>
26794 <colspec colwidth="6*" align="center"/>
26795 <colspec colwidth="6*" align="center"/>
26796 <colspec colwidth="6*" align="right"/>
26799 <entry><option>smtp_etrn_serialize</option></entry>
26800 <entry>Use: <emphasis>main</emphasis></entry>
26801 <entry>Type: <emphasis>boolean</emphasis></entry>
26802 <entry>Default: <emphasis>true</emphasis></entry>
26808 <indexterm role="concept">
26809 <primary>ETRN</primary>
26810 <secondary>serializing</secondary>
26812 When this option is set, it prevents the simultaneous execution of more than
26813 one identical command as a result of ETRN in an SMTP connection. See
26814 section <xref linkend="SECTETRN"/> for details.
26817 <indexterm role="option">
26818 <primary><option>smtp_load_reserve</option></primary>
26821 <informaltable frame="all">
26822 <tgroup cols="4" colsep="0" rowsep="0">
26823 <colspec colwidth="8*" align="left"/>
26824 <colspec colwidth="6*" align="center"/>
26825 <colspec colwidth="6*" align="center"/>
26826 <colspec colwidth="6*" align="right"/>
26829 <entry><option>smtp_load_reserve</option></entry>
26830 <entry>Use: <emphasis>main</emphasis></entry>
26831 <entry>Type: <emphasis>fixed-point</emphasis></entry>
26832 <entry>Default: <emphasis>unset</emphasis></entry>
26838 <indexterm role="concept">
26839 <primary>load average</primary>
26841 If the system load average ever gets higher than this, incoming SMTP calls are
26842 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
26843 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
26844 the load is over the limit. The option has no effect on ancient operating
26845 systems on which Exim cannot determine the load average. See also
26846 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
26849 <indexterm role="option">
26850 <primary><option>smtp_max_synprot_errors</option></primary>
26853 <informaltable frame="all">
26854 <tgroup cols="4" colsep="0" rowsep="0">
26855 <colspec colwidth="8*" align="left"/>
26856 <colspec colwidth="6*" align="center"/>
26857 <colspec colwidth="6*" align="center"/>
26858 <colspec colwidth="6*" align="right"/>
26861 <entry><option>smtp_max_synprot_errors</option></entry>
26862 <entry>Use: <emphasis>main</emphasis></entry>
26863 <entry>Type: <emphasis>integer</emphasis></entry>
26864 <entry>Default: <emphasis>3</emphasis></entry>
26870 <indexterm role="concept">
26871 <primary>SMTP</primary>
26872 <secondary>limiting syntax and protocol errors</secondary>
26874 <indexterm role="concept">
26875 <primary>limit</primary>
26876 <secondary>SMTP syntax and protocol errors</secondary>
26878 Exim rejects SMTP commands that contain syntax or protocol errors. In
26879 particular, a syntactically invalid email address, as in this command:
26881 <literallayout class="monospaced">
26882 RCPT TO:<abc xyz@a.b.c>
26885 causes immediate rejection of the command, before any other tests are done.
26886 (The ACL cannot be run if there is no valid address to set up for it.) An
26887 example of a protocol error is receiving RCPT before MAIL. If there are
26888 too many syntax or protocol errors in one SMTP session, the connection is
26889 dropped. The limit is set by this option.
26892 <indexterm role="concept">
26893 <primary>PIPELINING</primary>
26894 <secondary>expected errors</secondary>
26896 When the PIPELINING extension to SMTP is in use, some protocol errors are
26897 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
26898 Exim assumes that PIPELINING will be used if it advertises it (see
26899 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
26900 not count towards the limit.
26903 <indexterm role="option">
26904 <primary><option>smtp_max_unknown_commands</option></primary>
26907 <informaltable frame="all">
26908 <tgroup cols="4" colsep="0" rowsep="0">
26909 <colspec colwidth="8*" align="left"/>
26910 <colspec colwidth="6*" align="center"/>
26911 <colspec colwidth="6*" align="center"/>
26912 <colspec colwidth="6*" align="right"/>
26915 <entry><option>smtp_max_unknown_commands</option></entry>
26916 <entry>Use: <emphasis>main</emphasis></entry>
26917 <entry>Type: <emphasis>integer</emphasis></entry>
26918 <entry>Default: <emphasis>3</emphasis></entry>
26924 <indexterm role="concept">
26925 <primary>SMTP</primary>
26926 <secondary>limiting unknown commands</secondary>
26928 <indexterm role="concept">
26929 <primary>limit</primary>
26930 <secondary>unknown SMTP commands</secondary>
26932 If there are too many unrecognized commands in an incoming SMTP session, an
26933 Exim server drops the connection. This is a defence against some kinds of abuse
26936 into making connections to SMTP ports; in these circumstances, a number of
26937 non-SMTP command lines are sent first.
26940 <indexterm role="option">
26941 <primary><option>smtp_ratelimit_hosts</option></primary>
26944 <informaltable frame="all">
26945 <tgroup cols="4" colsep="0" rowsep="0">
26946 <colspec colwidth="8*" align="left"/>
26947 <colspec colwidth="6*" align="center"/>
26948 <colspec colwidth="6*" align="center"/>
26949 <colspec colwidth="6*" align="right"/>
26952 <entry><option>smtp_ratelimit_hosts</option></entry>
26953 <entry>Use: <emphasis>main</emphasis></entry>
26954 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
26955 <entry>Default: <emphasis>unset</emphasis></entry>
26961 <indexterm role="concept">
26962 <primary>SMTP</primary>
26963 <secondary>rate limiting</secondary>
26965 <indexterm role="concept">
26966 <primary>limit</primary>
26967 <secondary>rate of message arrival</secondary>
26969 <indexterm role="concept">
26970 <primary>RCPT</primary>
26971 <secondary>rate limiting</secondary>
26973 Some sites find it helpful to be able to limit the rate at which certain hosts
26974 can send them messages, and the rate at which an individual message can specify
26978 Exim has two rate-limiting facilities. This section describes the older
26979 facility, which can limit rates within a single connection. The newer
26980 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
26981 <xref linkend="SECTratelimiting"/> for details of the newer facility.
26984 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
26985 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
26986 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
26987 respectively. Each option, if set, must contain a set of four comma-separated
26993 A threshold, before which there is no rate limiting.
26998 An initial time delay. Unlike other times in Exim, numbers with decimal
26999 fractional parts are allowed here.
27004 A factor by which to increase the delay each time.
27009 A maximum value for the delay. This should normally be less than 5 minutes,
27010 because after that time, the client is liable to timeout the SMTP command.
27015 For example, these settings have been used successfully at the site which
27016 first suggested this feature, for controlling mail from their customers:
27018 <literallayout class="monospaced">
27019 smtp_ratelimit_mail = 2,0.5s,1.05,4m
27020 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
27023 The first setting specifies delays that are applied to MAIL commands after
27024 two have been received over a single connection. The initial delay is 0.5
27025 seconds, increasing by a factor of 1.05 each time. The second setting applies
27026 delays to RCPT commands when more than four occur in a single message.
27029 <indexterm role="option">
27030 <primary><option>smtp_ratelimit_mail</option></primary>
27033 <informaltable frame="all">
27034 <tgroup cols="4" colsep="0" rowsep="0">
27035 <colspec colwidth="8*" align="left"/>
27036 <colspec colwidth="6*" align="center"/>
27037 <colspec colwidth="6*" align="center"/>
27038 <colspec colwidth="6*" align="right"/>
27041 <entry><option>smtp_ratelimit_mail</option></entry>
27042 <entry>Use: <emphasis>main</emphasis></entry>
27043 <entry>Type: <emphasis>string</emphasis></entry>
27044 <entry>Default: <emphasis>unset</emphasis></entry>
27050 See <option>smtp_ratelimit_hosts</option> above.
27053 <indexterm role="option">
27054 <primary><option>smtp_ratelimit_rcpt</option></primary>
27057 <informaltable frame="all">
27058 <tgroup cols="4" colsep="0" rowsep="0">
27059 <colspec colwidth="8*" align="left"/>
27060 <colspec colwidth="6*" align="center"/>
27061 <colspec colwidth="6*" align="center"/>
27062 <colspec colwidth="6*" align="right"/>
27065 <entry><option>smtp_ratelimit_rcpt</option></entry>
27066 <entry>Use: <emphasis>main</emphasis></entry>
27067 <entry>Type: <emphasis>string</emphasis></entry>
27068 <entry>Default: <emphasis>unset</emphasis></entry>
27074 See <option>smtp_ratelimit_hosts</option> above.
27077 <indexterm role="option">
27078 <primary><option>smtp_receive_timeout</option></primary>
27081 <informaltable frame="all">
27082 <tgroup cols="4" colsep="0" rowsep="0">
27083 <colspec colwidth="8*" align="left"/>
27084 <colspec colwidth="6*" align="center"/>
27085 <colspec colwidth="6*" align="center"/>
27086 <colspec colwidth="6*" align="right"/>
27089 <entry><option>smtp_receive_timeout</option></entry>
27090 <entry>Use: <emphasis>main</emphasis></entry>
27091 <entry>Type: <emphasis>time</emphasis></entry>
27092 <entry>Default: <emphasis>5m</emphasis></entry>
27098 <indexterm role="concept">
27099 <primary>timeout</primary>
27100 <secondary>for SMTP input</secondary>
27102 <indexterm role="concept">
27103 <primary>SMTP</primary>
27104 <secondary>input timeout</secondary>
27106 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
27107 input, including batch SMTP. If a line of input (either an SMTP command or a
27108 data line) is not received within this time, the SMTP connection is dropped and
27109 the message is abandoned.
27110 A line is written to the log containing one of the following messages:
27112 <literallayout class="monospaced">
27113 SMTP command timeout on connection from...
27114 SMTP data timeout on connection from...
27117 The former means that Exim was expecting to read an SMTP command; the latter
27118 means that it was in the DATA phase, reading the contents of a message.
27121 <indexterm role="option">
27122 <primary><option>-os</option></primary>
27124 The value set by this option can be overridden by the
27125 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
27126 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
27127 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
27128 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
27131 <indexterm role="option">
27132 <primary><option>smtp_reserve_hosts</option></primary>
27135 <informaltable frame="all">
27136 <tgroup cols="4" colsep="0" rowsep="0">
27137 <colspec colwidth="8*" align="left"/>
27138 <colspec colwidth="6*" align="center"/>
27139 <colspec colwidth="6*" align="center"/>
27140 <colspec colwidth="6*" align="right"/>
27143 <entry><option>smtp_reserve_hosts</option></entry>
27144 <entry>Use: <emphasis>main</emphasis></entry>
27145 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
27146 <entry>Default: <emphasis>unset</emphasis></entry>
27152 This option defines hosts for which SMTP connections are reserved; see
27153 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
27156 <indexterm role="option">
27157 <primary><option>smtp_return_error_details</option></primary>
27160 <informaltable frame="all">
27161 <tgroup cols="4" colsep="0" rowsep="0">
27162 <colspec colwidth="8*" align="left"/>
27163 <colspec colwidth="6*" align="center"/>
27164 <colspec colwidth="6*" align="center"/>
27165 <colspec colwidth="6*" align="right"/>
27168 <entry><option>smtp_return_error_details</option></entry>
27169 <entry>Use: <emphasis>main</emphasis></entry>
27170 <entry>Type: <emphasis>boolean</emphasis></entry>
27171 <entry>Default: <emphasis>false</emphasis></entry>
27177 <indexterm role="concept">
27178 <primary>SMTP</primary>
27179 <secondary>details policy failures</secondary>
27181 <indexterm role="concept">
27182 <primary>policy control</primary>
27183 <secondary>rejection, returning details</secondary>
27185 In the default state, Exim uses bland messages such as
27186 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
27187 reasons. Many sysadmins like this because it gives away little information
27188 to spammers. However, some other sysadmins who are applying strict checking
27189 policies want to give out much fuller information about failures. Setting
27190 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
27191 example, instead of <quote>Administrative prohibition</quote>, it might give:
27193 <literallayout class="monospaced">
27194 550-Rejected after DATA: '>' missing at end of address:
27195 550 failing address in "From" header is: <user@dom.ain
27198 <indexterm role="option">
27199 <primary><option>spamd_address</option></primary>
27202 <informaltable frame="all">
27203 <tgroup cols="4" colsep="0" rowsep="0">
27204 <colspec colwidth="8*" align="left"/>
27205 <colspec colwidth="6*" align="center"/>
27206 <colspec colwidth="6*" align="center"/>
27207 <colspec colwidth="6*" align="right"/>
27210 <entry><option>spamd_address</option></entry>
27211 <entry>Use: <emphasis>main</emphasis></entry>
27212 <entry>Type: <emphasis>string</emphasis></entry>
27213 <entry>Default: <emphasis>see below</emphasis></entry>
27219 This option is available when Exim is compiled with the content-scanning
27220 extension. It specifies how Exim connects to SpamAssassin’s <option>spamd</option> daemon.
27221 The default value is
27223 <literallayout class="monospaced">
27227 See section <xref linkend="SECTscanspamass"/> for more details.
27230 <indexterm role="option">
27231 <primary><option>split_spool_directory</option></primary>
27234 <informaltable frame="all">
27235 <tgroup cols="4" colsep="0" rowsep="0">
27236 <colspec colwidth="8*" align="left"/>
27237 <colspec colwidth="6*" align="center"/>
27238 <colspec colwidth="6*" align="center"/>
27239 <colspec colwidth="6*" align="right"/>
27242 <entry><option>split_spool_directory</option></entry>
27243 <entry>Use: <emphasis>main</emphasis></entry>
27244 <entry>Type: <emphasis>boolean</emphasis></entry>
27245 <entry>Default: <emphasis>false</emphasis></entry>
27251 <indexterm role="concept">
27252 <primary>multiple spool directories</primary>
27254 <indexterm role="concept">
27255 <primary>spool directory</primary>
27256 <secondary>split</secondary>
27258 <indexterm role="concept">
27259 <primary>directories, multiple</primary>
27261 If this option is set, it causes Exim to split its input directory into 62
27262 subdirectories, each with a single alphanumeric character as its name. The
27263 sixth character of the message id is used to allocate messages to
27264 subdirectories; this is the least significant base-62 digit of the time of
27265 arrival of the message.
27268 Splitting up the spool in this way may provide better performance on systems
27269 where there are long mail queues, by reducing the number of files in any one
27270 directory. The msglog directory is also split up in a similar way to the input
27271 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
27272 are still placed in the single directory <filename>msglog.OLD</filename>.
27275 It is not necessary to take any special action for existing messages when
27276 changing <option>split_spool_directory</option>. Exim notices messages that are in the
27277 <quote>wrong</quote> place, and continues to process them. If the option is turned off
27278 after a period of being on, the subdirectories will eventually empty and be
27279 automatically deleted.
27282 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
27283 changes. Instead of creating a list of all messages in the queue, and then
27284 trying to deliver each one in turn, it constructs a list of those in one
27285 sub-directory and tries to deliver them, before moving on to the next
27286 sub-directory. The sub-directories are processed in a random order. This
27287 spreads out the scanning of the input directories, and uses less memory. It is
27288 particularly beneficial when there are lots of messages on the queue. However,
27289 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
27290 entire queue has to be scanned and sorted before any deliveries can start.
27293 <indexterm role="option">
27294 <primary><option>spool_directory</option></primary>
27297 <informaltable frame="all">
27298 <tgroup cols="4" colsep="0" rowsep="0">
27299 <colspec colwidth="8*" align="left"/>
27300 <colspec colwidth="6*" align="center"/>
27301 <colspec colwidth="6*" align="center"/>
27302 <colspec colwidth="6*" align="right"/>
27305 <entry><option>spool_directory</option></entry>
27306 <entry>Use: <emphasis>main</emphasis></entry>
27307 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27308 <entry>Default: <emphasis>set at compile time</emphasis></entry>
27314 <indexterm role="concept">
27315 <primary>spool directory</primary>
27316 <secondary>path to</secondary>
27318 This defines the directory in which Exim keeps its spool, that is, the messages
27319 it is waiting to deliver. The default value is taken from the compile-time
27320 configuration setting, if there is one. If not, this option must be set. The
27321 string is expanded, so it can contain, for example, a reference to
27322 <varname>$primary_hostname</varname>.
27325 If the spool directory name is fixed on your installation, it is recommended
27326 that you set it at build time rather than from this option, particularly if the
27327 log files are being written to the spool directory (see <option>log_file_path</option>).
27328 Otherwise log files cannot be used for errors that are detected early on, such
27329 as failures in the configuration file.
27332 By using this option to override the compiled-in path, it is possible to run
27333 tests of Exim without using the standard spool.
27336 <indexterm role="option">
27337 <primary><option>sqlite_lock_timeout</option></primary>
27340 <informaltable frame="all">
27341 <tgroup cols="4" colsep="0" rowsep="0">
27342 <colspec colwidth="8*" align="left"/>
27343 <colspec colwidth="6*" align="center"/>
27344 <colspec colwidth="6*" align="center"/>
27345 <colspec colwidth="6*" align="right"/>
27348 <entry><option>sqlite_lock_timeout</option></entry>
27349 <entry>Use: <emphasis>main</emphasis></entry>
27350 <entry>Type: <emphasis>time</emphasis></entry>
27351 <entry>Default: <emphasis>5s</emphasis></entry>
27357 <indexterm role="concept">
27358 <primary>sqlite lookup type</primary>
27359 <secondary>lock timeout</secondary>
27361 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
27362 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
27365 <indexterm role="option">
27366 <primary><option>strict_acl_vars</option></primary>
27369 <informaltable frame="all">
27370 <tgroup cols="4" colsep="0" rowsep="0">
27371 <colspec colwidth="8*" align="left"/>
27372 <colspec colwidth="6*" align="center"/>
27373 <colspec colwidth="6*" align="center"/>
27374 <colspec colwidth="6*" align="right"/>
27377 <entry><option>strict_acl_vars</option></entry>
27378 <entry>Use: <emphasis>main</emphasis></entry>
27379 <entry>Type: <emphasis>boolean</emphasis></entry>
27380 <entry>Default: <emphasis>false</emphasis></entry>
27386 <indexterm role="concept">
27387 <primary>access control lists (ACLs)</primary>
27388 <secondary>variables, handling unset</secondary>
27390 This option controls what happens if a syntactically valid but undefined ACL
27391 variable is referenced. If it is false (the default), an empty string
27392 is substituted; if it is true, an error is generated. See section
27393 <xref linkend="SECTaclvariables"/> for details of ACL variables.
27396 <indexterm role="option">
27397 <primary><option>strip_excess_angle_brackets</option></primary>
27400 <informaltable frame="all">
27401 <tgroup cols="4" colsep="0" rowsep="0">
27402 <colspec colwidth="8*" align="left"/>
27403 <colspec colwidth="6*" align="center"/>
27404 <colspec colwidth="6*" align="center"/>
27405 <colspec colwidth="6*" align="right"/>
27408 <entry><option>strip_excess_angle_brackets</option></entry>
27409 <entry>Use: <emphasis>main</emphasis></entry>
27410 <entry>Type: <emphasis>boolean</emphasis></entry>
27411 <entry>Default: <emphasis>false</emphasis></entry>
27417 <indexterm role="concept">
27418 <primary>angle brackets, excess</primary>
27420 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
27421 items in addresses are stripped. For example, <emphasis><<xxx@a.b.c.d>></emphasis> is
27422 treated as <emphasis><xxx@a.b.c.d></emphasis>. If this is in the envelope and the message is
27423 passed on to another MTA, the excess angle brackets are not passed on. If this
27424 option is not set, multiple pairs of angle brackets cause a syntax error.
27427 <indexterm role="option">
27428 <primary><option>strip_trailing_dot</option></primary>
27431 <informaltable frame="all">
27432 <tgroup cols="4" colsep="0" rowsep="0">
27433 <colspec colwidth="8*" align="left"/>
27434 <colspec colwidth="6*" align="center"/>
27435 <colspec colwidth="6*" align="center"/>
27436 <colspec colwidth="6*" align="right"/>
27439 <entry><option>strip_trailing_dot</option></entry>
27440 <entry>Use: <emphasis>main</emphasis></entry>
27441 <entry>Type: <emphasis>boolean</emphasis></entry>
27442 <entry>Default: <emphasis>false</emphasis></entry>
27448 <indexterm role="concept">
27449 <primary>trailing dot on domain</primary>
27451 <indexterm role="concept">
27452 <primary>dot</primary>
27453 <secondary>trailing on domain</secondary>
27455 If this option is set, a trailing dot at the end of a domain in an address is
27456 ignored. If this is in the envelope and the message is passed on to another
27457 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
27458 domain causes a syntax error.
27459 However, addresses in header lines are checked only when an ACL requests header
27463 <indexterm role="option">
27464 <primary><option>syslog_duplication</option></primary>
27467 <informaltable frame="all">
27468 <tgroup cols="4" colsep="0" rowsep="0">
27469 <colspec colwidth="8*" align="left"/>
27470 <colspec colwidth="6*" align="center"/>
27471 <colspec colwidth="6*" align="center"/>
27472 <colspec colwidth="6*" align="right"/>
27475 <entry><option>syslog_duplication</option></entry>
27476 <entry>Use: <emphasis>main</emphasis></entry>
27477 <entry>Type: <emphasis>boolean</emphasis></entry>
27478 <entry>Default: <emphasis>true</emphasis></entry>
27484 <indexterm role="concept">
27485 <primary>syslog</primary>
27486 <secondary>duplicate log lines; suppressing</secondary>
27488 When Exim is logging to syslog, it writes the log lines for its three
27489 separate logs at different syslog priorities so that they can in principle
27490 be separated on the logging hosts. Some installations do not require this
27491 separation, and in those cases, the duplication of certain log lines is a
27492 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
27493 particular log line is written to syslog. For lines that normally go to
27494 both the main log and the reject log, the reject log version (possibly
27495 containing message header lines) is written, at LOG_NOTICE priority.
27496 Lines that normally go to both the main and the panic log are written at
27497 the LOG_ALERT priority.
27500 <indexterm role="option">
27501 <primary><option>syslog_facility</option></primary>
27504 <informaltable frame="all">
27505 <tgroup cols="4" colsep="0" rowsep="0">
27506 <colspec colwidth="8*" align="left"/>
27507 <colspec colwidth="6*" align="center"/>
27508 <colspec colwidth="6*" align="center"/>
27509 <colspec colwidth="6*" align="right"/>
27512 <entry><option>syslog_facility</option></entry>
27513 <entry>Use: <emphasis>main</emphasis></entry>
27514 <entry>Type: <emphasis>string</emphasis></entry>
27515 <entry>Default: <emphasis>unset</emphasis></entry>
27521 <indexterm role="concept">
27522 <primary>syslog</primary>
27523 <secondary>facility; setting</secondary>
27525 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
27526 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
27527 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
27528 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
27529 details of Exim’s logging.
27532 <indexterm role="option">
27533 <primary><option>syslog_processname</option></primary>
27536 <informaltable frame="all">
27537 <tgroup cols="4" colsep="0" rowsep="0">
27538 <colspec colwidth="8*" align="left"/>
27539 <colspec colwidth="6*" align="center"/>
27540 <colspec colwidth="6*" align="center"/>
27541 <colspec colwidth="6*" align="right"/>
27544 <entry><option>syslog_processname</option></entry>
27545 <entry>Use: <emphasis>main</emphasis></entry>
27546 <entry>Type: <emphasis>string</emphasis></entry>
27547 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
27553 <indexterm role="concept">
27554 <primary>syslog</primary>
27555 <secondary>process name; setting</secondary>
27557 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
27558 syslog. The value must be no longer than 32 characters. See chapter
27559 <xref linkend="CHAPlog"/> for details of Exim’s logging.
27562 <indexterm role="option">
27563 <primary><option>syslog_timestamp</option></primary>
27566 <informaltable frame="all">
27567 <tgroup cols="4" colsep="0" rowsep="0">
27568 <colspec colwidth="8*" align="left"/>
27569 <colspec colwidth="6*" align="center"/>
27570 <colspec colwidth="6*" align="center"/>
27571 <colspec colwidth="6*" align="right"/>
27574 <entry><option>syslog_timestamp</option></entry>
27575 <entry>Use: <emphasis>main</emphasis></entry>
27576 <entry>Type: <emphasis>boolean</emphasis></entry>
27577 <entry>Default: <emphasis>true</emphasis></entry>
27583 <indexterm role="concept">
27584 <primary>syslog</primary>
27585 <secondary>timestamps</secondary>
27587 If <option>syslog_timestamp</option> is set false, the timestamps on Exim’s log lines are
27588 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
27589 details of Exim’s logging.
27592 <indexterm role="option">
27593 <primary><option>system_filter</option></primary>
27596 <informaltable frame="all">
27597 <tgroup cols="4" colsep="0" rowsep="0">
27598 <colspec colwidth="8*" align="left"/>
27599 <colspec colwidth="6*" align="center"/>
27600 <colspec colwidth="6*" align="center"/>
27601 <colspec colwidth="6*" align="right"/>
27604 <entry><option>system_filter</option></entry>
27605 <entry>Use: <emphasis>main</emphasis></entry>
27606 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27607 <entry>Default: <emphasis>unset</emphasis></entry>
27613 <indexterm role="concept">
27614 <primary>filter</primary>
27615 <secondary>system filter</secondary>
27617 <indexterm role="concept">
27618 <primary>system filter</primary>
27619 <secondary>specifying</secondary>
27621 <indexterm role="concept">
27622 <primary>Sieve filter</primary>
27623 <secondary>not available for system filter</secondary>
27625 This option specifies an Exim filter file that is applied to all messages at
27626 the start of each delivery attempt, before any routing is done. System filters
27627 must be Exim filters; they cannot be Sieve filters. If the system filter
27628 generates any deliveries to files or pipes, or any new mail messages, the
27629 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
27630 which transports are to be used. Details of this facility are given in chapter
27631 <xref linkend="CHAPsystemfilter"/>.
27634 <indexterm role="option">
27635 <primary><option>system_filter_directory_transport</option></primary>
27638 <informaltable frame="all">
27639 <tgroup cols="4" colsep="0" rowsep="0">
27640 <colspec colwidth="8*" align="left"/>
27641 <colspec colwidth="6*" align="center"/>
27642 <colspec colwidth="6*" align="center"/>
27643 <colspec colwidth="6*" align="right"/>
27646 <entry><option>system_filter_directory_transport</option></entry>
27647 <entry>Use: <emphasis>main</emphasis></entry>
27648 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27649 <entry>Default: <emphasis>unset</emphasis></entry>
27655 <indexterm role="variable">
27656 <primary><varname>$address_file</varname></primary>
27658 This sets the name of the transport driver that is to be used when the
27659 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
27660 implying delivery of each message into a separate file in some directory.
27661 During the delivery, the variable <varname>$address_file</varname> contains the path name.
27664 <indexterm role="option">
27665 <primary><option>system_filter_file_transport</option></primary>
27668 <informaltable frame="all">
27669 <tgroup cols="4" colsep="0" rowsep="0">
27670 <colspec colwidth="8*" align="left"/>
27671 <colspec colwidth="6*" align="center"/>
27672 <colspec colwidth="6*" align="center"/>
27673 <colspec colwidth="6*" align="right"/>
27676 <entry><option>system_filter_file_transport</option></entry>
27677 <entry>Use: <emphasis>main</emphasis></entry>
27678 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27679 <entry>Default: <emphasis>unset</emphasis></entry>
27685 <indexterm role="concept">
27686 <primary>file</primary>
27687 <secondary>transport for system filter</secondary>
27689 This sets the name of the transport driver that is to be used when the <option>save</option>
27690 command in a system message filter specifies a path not ending in <quote>/</quote>. During
27691 the delivery, the variable <varname>$address_file</varname> contains the path name.
27694 <indexterm role="option">
27695 <primary><option>system_filter_group</option></primary>
27698 <informaltable frame="all">
27699 <tgroup cols="4" colsep="0" rowsep="0">
27700 <colspec colwidth="8*" align="left"/>
27701 <colspec colwidth="6*" align="center"/>
27702 <colspec colwidth="6*" align="center"/>
27703 <colspec colwidth="6*" align="right"/>
27706 <entry><option>system_filter_group</option></entry>
27707 <entry>Use: <emphasis>main</emphasis></entry>
27708 <entry>Type: <emphasis>string</emphasis></entry>
27709 <entry>Default: <emphasis>unset</emphasis></entry>
27715 <indexterm role="concept">
27716 <primary>gid (group id)</primary>
27717 <secondary>system filter</secondary>
27719 This option is used only when <option>system_filter_user</option> is also set. It sets the
27720 gid under which the system filter is run, overriding any gid that is associated
27721 with the user. The value may be numerical or symbolic.
27724 <indexterm role="option">
27725 <primary><option>system_filter_pipe_transport</option></primary>
27728 <informaltable frame="all">
27729 <tgroup cols="4" colsep="0" rowsep="0">
27730 <colspec colwidth="8*" align="left"/>
27731 <colspec colwidth="6*" align="center"/>
27732 <colspec colwidth="6*" align="center"/>
27733 <colspec colwidth="6*" align="right"/>
27736 <entry><option>system_filter_pipe_transport</option></entry>
27737 <entry>Use: <emphasis>main</emphasis></entry>
27738 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27739 <entry>Default: <emphasis>unset</emphasis></entry>
27745 <indexterm role="concept">
27746 <primary><command>pipe</command> transport</primary>
27747 <secondary>for system filter</secondary>
27749 <indexterm role="variable">
27750 <primary><varname>$address_pipe</varname></primary>
27752 This specifies the transport driver that is to be used when a <option>pipe</option> command
27753 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
27754 contains the pipe command.
27757 <indexterm role="option">
27758 <primary><option>system_filter_reply_transport</option></primary>
27761 <informaltable frame="all">
27762 <tgroup cols="4" colsep="0" rowsep="0">
27763 <colspec colwidth="8*" align="left"/>
27764 <colspec colwidth="6*" align="center"/>
27765 <colspec colwidth="6*" align="center"/>
27766 <colspec colwidth="6*" align="right"/>
27769 <entry><option>system_filter_reply_transport</option></entry>
27770 <entry>Use: <emphasis>main</emphasis></entry>
27771 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27772 <entry>Default: <emphasis>unset</emphasis></entry>
27778 <indexterm role="concept">
27779 <primary><command>autoreply</command> transport</primary>
27780 <secondary>for system filter</secondary>
27782 This specifies the transport driver that is to be used when a <option>mail</option> command
27783 is used in a system filter.
27786 <indexterm role="option">
27787 <primary><option>system_filter_user</option></primary>
27790 <informaltable frame="all">
27791 <tgroup cols="4" colsep="0" rowsep="0">
27792 <colspec colwidth="8*" align="left"/>
27793 <colspec colwidth="6*" align="center"/>
27794 <colspec colwidth="6*" align="center"/>
27795 <colspec colwidth="6*" align="right"/>
27798 <entry><option>system_filter_user</option></entry>
27799 <entry>Use: <emphasis>main</emphasis></entry>
27800 <entry>Type: <emphasis>string</emphasis></entry>
27801 <entry>Default: <emphasis>unset</emphasis></entry>
27807 <indexterm role="concept">
27808 <primary>uid (user id)</primary>
27809 <secondary>system filter</secondary>
27811 If this option is not set, the system filter is run in the main Exim delivery
27812 process, as root. When the option is set, the system filter runs in a separate
27813 process, as the given user. Unless the string consists entirely of digits, it
27814 is looked up in the password data. Failure to find the named user causes a
27815 configuration error. The gid is either taken from the password data, or
27816 specified by <option>system_filter_group</option>. When the uid is specified numerically,
27817 <option>system_filter_group</option> is required to be set.
27820 If the system filter generates any pipe, file, or reply deliveries, the uid
27821 under which the filter is run is used when transporting them, unless a
27822 transport option overrides. Normally you should set <option>system_filter_user</option> if
27823 your system filter generates these kinds of delivery.
27826 <indexterm role="option">
27827 <primary><option>tcp_nodelay</option></primary>
27830 <informaltable frame="all">
27831 <tgroup cols="4" colsep="0" rowsep="0">
27832 <colspec colwidth="8*" align="left"/>
27833 <colspec colwidth="6*" align="center"/>
27834 <colspec colwidth="6*" align="center"/>
27835 <colspec colwidth="6*" align="right"/>
27838 <entry><option>tcp_nodelay</option></entry>
27839 <entry>Use: <emphasis>main</emphasis></entry>
27840 <entry>Type: <emphasis>boolean</emphasis></entry>
27841 <entry>Default: <emphasis>true</emphasis></entry>
27847 <indexterm role="concept">
27848 <primary>daemon</primary>
27849 <secondary>TCP_NODELAY on sockets</secondary>
27851 <indexterm role="concept">
27852 <primary>Nagle algorithm</primary>
27854 <indexterm role="concept">
27855 <primary>TCP_NODELAY on listening sockets</primary>
27857 If this option is set false, it stops the Exim daemon setting the
27858 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
27859 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
27860 performance in interactive (character-by-character) situations. Turning it off
27861 should improve Exim’s performance a bit, so that is what happens by default.
27862 However, it appears that some broken clients cannot cope, and time out. Hence
27863 this option. It affects only those sockets that are set up for listening by the
27864 daemon. Sockets created by the smtp transport for delivering mail always set
27868 <indexterm role="option">
27869 <primary><option>timeout_frozen_after</option></primary>
27872 <informaltable frame="all">
27873 <tgroup cols="4" colsep="0" rowsep="0">
27874 <colspec colwidth="8*" align="left"/>
27875 <colspec colwidth="6*" align="center"/>
27876 <colspec colwidth="6*" align="center"/>
27877 <colspec colwidth="6*" align="right"/>
27880 <entry><option>timeout_frozen_after</option></entry>
27881 <entry>Use: <emphasis>main</emphasis></entry>
27882 <entry>Type: <emphasis>time</emphasis></entry>
27883 <entry>Default: <emphasis>0s</emphasis></entry>
27889 <indexterm role="concept">
27890 <primary>frozen messages</primary>
27891 <secondary>timing out</secondary>
27893 <indexterm role="concept">
27894 <primary>timeout</primary>
27895 <secondary>frozen messages</secondary>
27897 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
27898 message of any kind that has been on the queue for longer than the given time
27899 is automatically cancelled at the next queue run. If the frozen message is a
27900 bounce message, it is just discarded; otherwise, a bounce is sent to the
27901 sender, in a similar manner to cancellation by the <option>-Mg</option> command line option.
27902 If you want to timeout frozen bounce messages earlier than other kinds of
27903 frozen message, see <option>ignore_bounce_errors_after</option>.
27906 <emphasis role="bold">Note:</emphasis> the default value of zero means no timeouts; with this setting,
27907 frozen messages remain on the queue forever (except for any frozen bounce
27908 messages that are released by <option>ignore_bounce_errors_after</option>).
27911 <indexterm role="option">
27912 <primary><option>timezone</option></primary>
27915 <informaltable frame="all">
27916 <tgroup cols="4" colsep="0" rowsep="0">
27917 <colspec colwidth="8*" align="left"/>
27918 <colspec colwidth="6*" align="center"/>
27919 <colspec colwidth="6*" align="center"/>
27920 <colspec colwidth="6*" align="right"/>
27923 <entry><option>timezone</option></entry>
27924 <entry>Use: <emphasis>main</emphasis></entry>
27925 <entry>Type: <emphasis>string</emphasis></entry>
27926 <entry>Default: <emphasis>unset</emphasis></entry>
27932 <indexterm role="concept">
27933 <primary>timezone, setting</primary>
27935 The value of <option>timezone</option> is used to set the environment variable TZ while
27936 running Exim (if it is different on entry). This ensures that all timestamps
27937 created by Exim are in the required timezone. If you want all your timestamps
27938 to be in UTC (aka GMT) you should set
27940 <literallayout class="monospaced">
27944 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
27945 or, if that is not set, from the value of the TZ environment variable when Exim
27946 is built. If <option>timezone</option> is set to the empty string, either at build or run
27947 time, any existing TZ variable is removed from the environment when Exim
27948 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
27949 unfortunately not all, operating systems.
27952 <indexterm role="option">
27953 <primary><option>tls_advertise_hosts</option></primary>
27956 <informaltable frame="all">
27957 <tgroup cols="4" colsep="0" rowsep="0">
27958 <colspec colwidth="8*" align="left"/>
27959 <colspec colwidth="6*" align="center"/>
27960 <colspec colwidth="6*" align="center"/>
27961 <colspec colwidth="6*" align="right"/>
27964 <entry><option>tls_advertise_hosts</option></entry>
27965 <entry>Use: <emphasis>main</emphasis></entry>
27966 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
27967 <entry>Default: <emphasis>unset</emphasis></entry>
27973 <indexterm role="concept">
27974 <primary>TLS</primary>
27975 <secondary>advertising</secondary>
27977 <indexterm role="concept">
27978 <primary>encryption</primary>
27979 <secondary>on SMTP connection</secondary>
27981 <indexterm role="concept">
27982 <primary>SMTP</primary>
27983 <secondary>encrypted connection</secondary>
27985 When Exim is built with support for TLS encrypted connections, the availability
27986 of the STARTTLS command to set up an encrypted session is advertised in
27987 response to EHLO only to those client hosts that match this option. See
27988 chapter <xref linkend="CHAPTLS"/> for details of Exim’s support for TLS.
27991 <indexterm role="option">
27992 <primary><option>tls_certificate</option></primary>
27995 <informaltable frame="all">
27996 <tgroup cols="4" colsep="0" rowsep="0">
27997 <colspec colwidth="8*" align="left"/>
27998 <colspec colwidth="6*" align="center"/>
27999 <colspec colwidth="6*" align="center"/>
28000 <colspec colwidth="6*" align="right"/>
28003 <entry><option>tls_certificate</option></entry>
28004 <entry>Use: <emphasis>main</emphasis></entry>
28005 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28006 <entry>Default: <emphasis>unset</emphasis></entry>
28012 <indexterm role="concept">
28013 <primary>TLS</primary>
28014 <secondary>server certificate; location of</secondary>
28016 <indexterm role="concept">
28017 <primary>certificate</primary>
28018 <secondary>server, location of</secondary>
28020 The value of this option is expanded, and must then be the absolute path to a
28021 file which contains the server’s certificates. The server’s private key is also
28022 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
28023 <xref linkend="CHAPTLS"/> for further details.
28026 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
28027 receiving incoming messages as a server. If you want to supply certificates for
28028 use when sending messages as a client, you must set the <option>tls_certificate</option>
28029 option in the relevant <command>smtp</command> transport.
28032 <indexterm role="option">
28033 <primary><option>tls_crl</option></primary>
28036 <informaltable frame="all">
28037 <tgroup cols="4" colsep="0" rowsep="0">
28038 <colspec colwidth="8*" align="left"/>
28039 <colspec colwidth="6*" align="center"/>
28040 <colspec colwidth="6*" align="center"/>
28041 <colspec colwidth="6*" align="right"/>
28044 <entry><option>tls_crl</option></entry>
28045 <entry>Use: <emphasis>main</emphasis></entry>
28046 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28047 <entry>Default: <emphasis>unset</emphasis></entry>
28053 <indexterm role="concept">
28054 <primary>TLS</primary>
28055 <secondary>server certificate revocation list</secondary>
28057 <indexterm role="concept">
28058 <primary>certificate</primary>
28059 <secondary>revocation list for server</secondary>
28061 This option specifies a certificate revocation list. The expanded value must
28062 be the name of a file that contains a CRL in PEM format.
28065 <indexterm role="option">
28066 <primary><option>tls_dhparam</option></primary>
28069 <informaltable frame="all">
28070 <tgroup cols="4" colsep="0" rowsep="0">
28071 <colspec colwidth="8*" align="left"/>
28072 <colspec colwidth="6*" align="center"/>
28073 <colspec colwidth="6*" align="center"/>
28074 <colspec colwidth="6*" align="right"/>
28077 <entry><option>tls_dhparam</option></entry>
28078 <entry>Use: <emphasis>main</emphasis></entry>
28079 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28080 <entry>Default: <emphasis>unset</emphasis></entry>
28086 <indexterm role="concept">
28087 <primary>TLS</primary>
28088 <secondary>D-H parameters for server</secondary>
28090 The value of this option is expanded, and must then be the absolute path to
28091 a file which contains the server’s DH parameter values.
28092 This is used only for OpenSSL. When Exim is linked with GnuTLS, this option is
28093 ignored. See section <xref linkend="SECTopenvsgnu"/> for further details.
28096 <indexterm role="option">
28097 <primary><option>tls_on_connect_ports</option></primary>
28100 <informaltable frame="all">
28101 <tgroup cols="4" colsep="0" rowsep="0">
28102 <colspec colwidth="8*" align="left"/>
28103 <colspec colwidth="6*" align="center"/>
28104 <colspec colwidth="6*" align="center"/>
28105 <colspec colwidth="6*" align="right"/>
28108 <entry><option>tls_on_connect_ports</option></entry>
28109 <entry>Use: <emphasis>main</emphasis></entry>
28110 <entry>Type: <emphasis>string list</emphasis></entry>
28111 <entry>Default: <emphasis>unset</emphasis></entry>
28117 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
28118 operate the obsolete SSMTP (SMTPS) protocol, where a TLS session is immediately
28119 set up without waiting for the client to issue a STARTTLS command. For
28120 further details, see section <xref linkend="SECTsupobssmt"/>.
28123 <indexterm role="option">
28124 <primary><option>tls_privatekey</option></primary>
28127 <informaltable frame="all">
28128 <tgroup cols="4" colsep="0" rowsep="0">
28129 <colspec colwidth="8*" align="left"/>
28130 <colspec colwidth="6*" align="center"/>
28131 <colspec colwidth="6*" align="center"/>
28132 <colspec colwidth="6*" align="right"/>
28135 <entry><option>tls_privatekey</option></entry>
28136 <entry>Use: <emphasis>main</emphasis></entry>
28137 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28138 <entry>Default: <emphasis>unset</emphasis></entry>
28144 <indexterm role="concept">
28145 <primary>TLS</primary>
28146 <secondary>server private key; location of</secondary>
28148 The value of this option is expanded, and must then be the absolute path to a
28149 file which contains the server’s private key. If this option is unset, or if
28150 the expansion is forced to fail, or the result is an empty string, the private
28151 key is assumed to be in the same file as the server’s certificates. See chapter
28152 <xref linkend="CHAPTLS"/> for further details.
28155 <indexterm role="option">
28156 <primary><option>tls_remember_esmtp</option></primary>
28159 <informaltable frame="all">
28160 <tgroup cols="4" colsep="0" rowsep="0">
28161 <colspec colwidth="8*" align="left"/>
28162 <colspec colwidth="6*" align="center"/>
28163 <colspec colwidth="6*" align="center"/>
28164 <colspec colwidth="6*" align="right"/>
28167 <entry><option>tls_remember_esmtp</option></entry>
28168 <entry>Use: <emphasis>main</emphasis></entry>
28169 <entry>Type: <emphasis>boolean</emphasis></entry>
28170 <entry>Default: <emphasis>false</emphasis></entry>
28176 <indexterm role="concept">
28177 <primary>TLS</primary>
28178 <secondary>esmtp state; remembering</secondary>
28180 <indexterm role="concept">
28181 <primary>TLS</primary>
28182 <secondary>broken clients</secondary>
28184 If this option is set true, Exim violates the RFCs by remembering that it is in
28185 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
28186 support for broken clients that fail to send a new EHLO after starting a
28190 <indexterm role="option">
28191 <primary><option>tls_require_ciphers</option></primary>
28194 <informaltable frame="all">
28195 <tgroup cols="4" colsep="0" rowsep="0">
28196 <colspec colwidth="8*" align="left"/>
28197 <colspec colwidth="6*" align="center"/>
28198 <colspec colwidth="6*" align="center"/>
28199 <colspec colwidth="6*" align="right"/>
28202 <entry><option>tls_require_ciphers</option></entry>
28203 <entry>Use: <emphasis>main</emphasis></entry>
28204 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28205 <entry>Default: <emphasis>unset</emphasis></entry>
28211 <indexterm role="concept">
28212 <primary>TLS</primary>
28213 <secondary>requiring specific ciphers</secondary>
28215 <indexterm role="concept">
28216 <primary>cipher</primary>
28217 <secondary>requiring specific</secondary>
28219 This option controls which ciphers can be used for incoming TLS connections.
28220 The <command>smtp</command> transport has an option of the same name for controlling outgoing
28221 connections. This option is expanded for each connection, so can be varied for
28222 different clients if required. The value of this option must be a list of
28223 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
28224 in somewhat different ways. If GnuTLS is being used, the client controls the
28225 preference order of the available ciphers. Details are given in sections
28226 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
28229 <indexterm role="option">
28230 <primary><option>tls_try_verify_hosts</option></primary>
28233 <informaltable frame="all">
28234 <tgroup cols="4" colsep="0" rowsep="0">
28235 <colspec colwidth="8*" align="left"/>
28236 <colspec colwidth="6*" align="center"/>
28237 <colspec colwidth="6*" align="center"/>
28238 <colspec colwidth="6*" align="right"/>
28241 <entry><option>tls_try_verify_hosts</option></entry>
28242 <entry>Use: <emphasis>main</emphasis></entry>
28243 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
28244 <entry>Default: <emphasis>unset</emphasis></entry>
28250 <indexterm role="concept">
28251 <primary>TLS</primary>
28252 <secondary>client certificate verification</secondary>
28254 <indexterm role="concept">
28255 <primary>certificate</primary>
28256 <secondary>verification of client</secondary>
28258 See <option>tls_verify_hosts</option> below.
28261 <indexterm role="option">
28262 <primary><option>tls_verify_certificates</option></primary>
28265 <informaltable frame="all">
28266 <tgroup cols="4" colsep="0" rowsep="0">
28267 <colspec colwidth="8*" align="left"/>
28268 <colspec colwidth="6*" align="center"/>
28269 <colspec colwidth="6*" align="center"/>
28270 <colspec colwidth="6*" align="right"/>
28273 <entry><option>tls_verify_certificates</option></entry>
28274 <entry>Use: <emphasis>main</emphasis></entry>
28275 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28276 <entry>Default: <emphasis>unset</emphasis></entry>
28282 <indexterm role="concept">
28283 <primary>TLS</primary>
28284 <secondary>client certificate verification</secondary>
28286 <indexterm role="concept">
28287 <primary>certificate</primary>
28288 <secondary>verification of client</secondary>
28290 The value of this option is expanded, and must then be the absolute path to
28291 a file containing permitted certificates for clients that
28292 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>. Alternatively, if you
28293 are using OpenSSL, you can set <option>tls_verify_certificates</option> to the name of a
28294 directory containing certificate files. This does not work with GnuTLS; the
28295 option must be set to the name of a single file if you are using GnuTLS.
28298 <indexterm role="option">
28299 <primary><option>tls_verify_hosts</option></primary>
28302 <informaltable frame="all">
28303 <tgroup cols="4" colsep="0" rowsep="0">
28304 <colspec colwidth="8*" align="left"/>
28305 <colspec colwidth="6*" align="center"/>
28306 <colspec colwidth="6*" align="center"/>
28307 <colspec colwidth="6*" align="right"/>
28310 <entry><option>tls_verify_hosts</option></entry>
28311 <entry>Use: <emphasis>main</emphasis></entry>
28312 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
28313 <entry>Default: <emphasis>unset</emphasis></entry>
28319 <indexterm role="concept">
28320 <primary>TLS</primary>
28321 <secondary>client certificate verification</secondary>
28323 <indexterm role="concept">
28324 <primary>certificate</primary>
28325 <secondary>verification of client</secondary>
28327 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
28328 certificates from clients. The expected certificates are defined by
28329 <option>tls_verify_certificates</option>, which must be set. A configuration error occurs if
28330 either <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> is set and
28331 <option>tls_verify_certificates</option> is not set.
28334 Any client that matches <option>tls_verify_hosts</option> is constrained by
28335 <option>tls_verify_certificates</option>. When the client initiates a TLS session, it must
28336 present one of the listed certificates. If it does not, the connection is
28337 aborted. <emphasis role="bold">Warning</emphasis>: Including a host in <option>tls_verify_hosts</option> does not require
28338 the host to use TLS. It can still send SMTP commands through unencrypted
28339 connections. Forcing a client to use TLS has to be done separately using an
28340 ACL to reject inappropriate commands when the connection is not encrypted.
28343 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
28344 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
28345 certificate and checks it against <option>tls_verify_certificates</option>, but does not
28346 abort the connection if there is no certificate or if it does not match. This
28347 state can be detected in an ACL, which makes it possible to implement policies
28348 such as <quote>accept for relay only if a verified certificate has been received,
28349 but accept for local delivery if encrypted, even without a verified
28350 certificate</quote>.
28353 Client hosts that match neither of these lists are not asked to present
28357 <indexterm role="option">
28358 <primary><option>trusted_groups</option></primary>
28361 <informaltable frame="all">
28362 <tgroup cols="4" colsep="0" rowsep="0">
28363 <colspec colwidth="8*" align="left"/>
28364 <colspec colwidth="6*" align="center"/>
28365 <colspec colwidth="6*" align="center"/>
28366 <colspec colwidth="6*" align="right"/>
28369 <entry><option>trusted_groups</option></entry>
28370 <entry>Use: <emphasis>main</emphasis></entry>
28371 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
28372 <entry>Default: <emphasis>unset</emphasis></entry>
28378 <indexterm role="concept">
28379 <primary>trusted groups</primary>
28381 <indexterm role="concept">
28382 <primary>groups</primary>
28383 <secondary>trusted</secondary>
28385 This option is expanded just once, at the start of Exim’s processing. If this
28386 option is set, any process that is running in one of the listed groups, or
28387 which has one of them as a supplementary group, is trusted. The groups can be
28388 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
28389 details of what trusted callers are permitted to do. If neither
28390 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
28394 <indexterm role="option">
28395 <primary><option>trusted_users</option></primary>
28398 <informaltable frame="all">
28399 <tgroup cols="4" colsep="0" rowsep="0">
28400 <colspec colwidth="8*" align="left"/>
28401 <colspec colwidth="6*" align="center"/>
28402 <colspec colwidth="6*" align="center"/>
28403 <colspec colwidth="6*" align="right"/>
28406 <entry><option>trusted_users</option></entry>
28407 <entry>Use: <emphasis>main</emphasis></entry>
28408 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
28409 <entry>Default: <emphasis>unset</emphasis></entry>
28415 <indexterm role="concept">
28416 <primary>trusted users</primary>
28418 <indexterm role="concept">
28419 <primary>user</primary>
28420 <secondary>trusted</secondary>
28422 This option is expanded just once, at the start of Exim’s processing. If this
28423 option is set, any process that is running as one of the listed users is
28424 trusted. The users can be specified numerically or by name. See section
28425 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
28426 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
28427 Exim user are trusted.
28430 <indexterm role="option">
28431 <primary><option>unknown_login</option></primary>
28434 <informaltable frame="all">
28435 <tgroup cols="4" colsep="0" rowsep="0">
28436 <colspec colwidth="8*" align="left"/>
28437 <colspec colwidth="6*" align="center"/>
28438 <colspec colwidth="6*" align="center"/>
28439 <colspec colwidth="6*" align="right"/>
28442 <entry><option>unknown_login</option></entry>
28443 <entry>Use: <emphasis>main</emphasis></entry>
28444 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28445 <entry>Default: <emphasis>unset</emphasis></entry>
28451 <indexterm role="concept">
28452 <primary>uid (user id)</primary>
28453 <secondary>unknown caller</secondary>
28455 <indexterm role="variable">
28456 <primary><varname>$caller_uid</varname></primary>
28458 This is a specialized feature for use in unusual configurations. By default, if
28459 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
28460 gives up. The <option>unknown_login</option> option can be used to set a login name to be
28461 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
28462 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
28463 is used for the user’s real name (gecos field), unless this has been set by the
28464 <option>-F</option> option.
28467 <indexterm role="option">
28468 <primary><option>unknown_username</option></primary>
28471 <informaltable frame="all">
28472 <tgroup cols="4" colsep="0" rowsep="0">
28473 <colspec colwidth="8*" align="left"/>
28474 <colspec colwidth="6*" align="center"/>
28475 <colspec colwidth="6*" align="center"/>
28476 <colspec colwidth="6*" align="right"/>
28479 <entry><option>unknown_username</option></entry>
28480 <entry>Use: <emphasis>main</emphasis></entry>
28481 <entry>Type: <emphasis>string</emphasis></entry>
28482 <entry>Default: <emphasis>unset</emphasis></entry>
28488 See <option>unknown_login</option>.
28491 <indexterm role="option">
28492 <primary><option>untrusted_set_sender</option></primary>
28495 <informaltable frame="all">
28496 <tgroup cols="4" colsep="0" rowsep="0">
28497 <colspec colwidth="8*" align="left"/>
28498 <colspec colwidth="6*" align="center"/>
28499 <colspec colwidth="6*" align="center"/>
28500 <colspec colwidth="6*" align="right"/>
28503 <entry><option>untrusted_set_sender</option></entry>
28504 <entry>Use: <emphasis>main</emphasis></entry>
28505 <entry>Type: <emphasis>address list</emphasis>†<emphasis></emphasis></entry>
28506 <entry>Default: <emphasis>unset</emphasis></entry>
28512 <indexterm role="concept">
28513 <primary>trusted users</primary>
28515 <indexterm role="concept">
28516 <primary>sender</primary>
28517 <secondary>setting by untrusted user</secondary>
28519 <indexterm role="concept">
28520 <primary>untrusted user setting sender</primary>
28522 <indexterm role="concept">
28523 <primary>user</primary>
28524 <secondary>untrusted setting sender</secondary>
28526 <indexterm role="concept">
28527 <primary>envelope sender</primary>
28529 When an untrusted user submits a message to Exim using the standard input, Exim
28530 normally creates an envelope sender address from the user’s login and the
28531 default qualification domain. Data from the <option>-f</option> option (for setting envelope
28532 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
28533 is used) is ignored.
28536 However, untrusted users are permitted to set an empty envelope sender address,
28537 to declare that a message should never generate any bounces. For example:
28539 <literallayout class="monospaced">
28540 exim -f '<>' user@domain.example
28543 <indexterm role="variable">
28544 <primary><varname>$sender_ident</varname></primary>
28546 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
28547 other envelope sender addresses in a controlled way. When it is set, untrusted
28548 users are allowed to set envelope sender addresses that match any of the
28549 patterns in the list. Like all address lists, the string is expanded. The
28550 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
28551 users to setting senders that start with their login ids
28552 followed by a hyphen
28553 by a setting like this:
28555 <literallayout class="monospaced">
28556 untrusted_set_sender = ^$sender_ident-
28559 If you want to allow untrusted users to set envelope sender addresses without
28560 restriction, you can use
28562 <literallayout class="monospaced">
28563 untrusted_set_sender = *
28566 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
28567 only to the setting of the envelope sender. It does not permit untrusted users
28568 to use the other options which trusted user can use to override message
28569 parameters. Furthermore, it does not stop Exim from removing an existing
28570 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
28571 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
28572 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
28573 described in section <xref linkend="SECTthesenhea"/>.
28576 The log line for a message’s arrival shows the envelope sender following
28577 <quote><=</quote>. For local messages, the user’s login always follows, after <quote>U=</quote>. In
28578 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
28579 envelope sender address, the user’s login is shown in parentheses after the
28583 <indexterm role="option">
28584 <primary><option>uucp_from_pattern</option></primary>
28587 <informaltable frame="all">
28588 <tgroup cols="4" colsep="0" rowsep="0">
28589 <colspec colwidth="8*" align="left"/>
28590 <colspec colwidth="6*" align="center"/>
28591 <colspec colwidth="6*" align="center"/>
28592 <colspec colwidth="6*" align="right"/>
28595 <entry><option>uucp_from_pattern</option></entry>
28596 <entry>Use: <emphasis>main</emphasis></entry>
28597 <entry>Type: <emphasis>string</emphasis></entry>
28598 <entry>Default: <emphasis>see below</emphasis></entry>
28604 <indexterm role="concept">
28605 <primary><quote>From</quote> line</primary>
28607 <indexterm role="concept">
28608 <primary>UUCP</primary>
28609 <secondary><quote>From</quote> line</secondary>
28611 Some applications that pass messages to an MTA via a command line interface use
28612 an initial line starting with <quote>From </quote> to pass the envelope sender. In
28613 particular, this is used by UUCP software. Exim recognizes such a line by means
28614 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
28615 matches, the sender address is constructed by expanding the contents of
28616 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
28617 default pattern recognizes lines in the following two forms:
28619 <literallayout class="monospaced">
28620 From ph10 Fri Jan 5 12:35 GMT 1996
28621 From ph10 Fri, 7 Jan 97 14:00:00 GMT
28624 The pattern can be seen by running
28626 <literallayout class="monospaced">
28627 exim -bP uucp_from_pattern
28630 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
28631 year in the second case. The first word after <quote>From </quote> is matched in the
28632 regular expression by a parenthesized subpattern. The default value for
28633 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
28634 (<quote>ph10</quote> in the example above) as the message’s sender. See also
28635 <option>ignore_fromline_hosts</option>.
28638 <indexterm role="option">
28639 <primary><option>uucp_from_sender</option></primary>
28642 <informaltable frame="all">
28643 <tgroup cols="4" colsep="0" rowsep="0">
28644 <colspec colwidth="8*" align="left"/>
28645 <colspec colwidth="6*" align="center"/>
28646 <colspec colwidth="6*" align="center"/>
28647 <colspec colwidth="6*" align="right"/>
28650 <entry><option>uucp_from_sender</option></entry>
28651 <entry>Use: <emphasis>main</emphasis></entry>
28652 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28653 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
28659 See <option>uucp_from_pattern</option> above.
28662 <indexterm role="option">
28663 <primary><option>warn_message_file</option></primary>
28666 <informaltable frame="all">
28667 <tgroup cols="4" colsep="0" rowsep="0">
28668 <colspec colwidth="8*" align="left"/>
28669 <colspec colwidth="6*" align="center"/>
28670 <colspec colwidth="6*" align="center"/>
28671 <colspec colwidth="6*" align="right"/>
28674 <entry><option>warn_message_file</option></entry>
28675 <entry>Use: <emphasis>main</emphasis></entry>
28676 <entry>Type: <emphasis>string</emphasis></entry>
28677 <entry>Default: <emphasis>unset</emphasis></entry>
28683 <indexterm role="concept">
28684 <primary>warning of delay</primary>
28685 <secondary>customizing the message</secondary>
28687 <indexterm role="concept">
28688 <primary>customizing</primary>
28689 <secondary>warning message</secondary>
28691 This option defines a template file containing paragraphs of text to be used
28692 for constructing the warning message which is sent by Exim when a message has
28693 been on the queue for a specified amount of time, as specified by
28694 <option>delay_warning</option>. Details of the file’s contents are given in chapter
28695 <xref linkend="CHAPemsgcust"/>. See also <option>bounce_message_file</option>.
28698 <indexterm role="option">
28699 <primary><option>write_rejectlog</option></primary>
28702 <informaltable frame="all">
28703 <tgroup cols="4" colsep="0" rowsep="0">
28704 <colspec colwidth="8*" align="left"/>
28705 <colspec colwidth="6*" align="center"/>
28706 <colspec colwidth="6*" align="center"/>
28707 <colspec colwidth="6*" align="right"/>
28710 <entry><option>write_rejectlog</option></entry>
28711 <entry>Use: <emphasis>main</emphasis></entry>
28712 <entry>Type: <emphasis>boolean</emphasis></entry>
28713 <entry>Default: <emphasis>true</emphasis></entry>
28719 <indexterm role="concept">
28720 <primary>reject log</primary>
28721 <secondary>disabling</secondary>
28723 If this option is set false, Exim no longer writes anything to the reject log.
28724 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
28725 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
28726 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
28731 <chapter id="CHAProutergeneric">
28732 <title>Generic options for routers</title>
28734 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
28735 <primary>options</primary>
28736 <secondary>generic; for routers</secondary>
28738 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
28739 <primary>generic options</primary>
28740 <secondary>router</secondary>
28742 This chapter describes the generic options that apply to all routers.
28743 Those that are preconditions are marked with ‡ in the <quote>use</quote> field.
28746 For a general description of how a router operates, see sections
28747 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
28748 which the preconditions are tested. The order of expansion of the options that
28749 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
28750 <option>headers_remove</option>, <option>transport</option>.
28753 <indexterm role="option">
28754 <primary><option>address_data</option></primary>
28757 <informaltable frame="all">
28758 <tgroup cols="4" colsep="0" rowsep="0">
28759 <colspec colwidth="8*" align="left"/>
28760 <colspec colwidth="6*" align="center"/>
28761 <colspec colwidth="6*" align="center"/>
28762 <colspec colwidth="6*" align="right"/>
28765 <entry><option>address_data</option></entry>
28766 <entry>Use: <emphasis>routers</emphasis></entry>
28767 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28768 <entry>Default: <emphasis>unset</emphasis></entry>
28774 <indexterm role="concept">
28775 <primary>router</primary>
28776 <secondary>data attached to address</secondary>
28778 The string is expanded just before the router is run, that is, after all the
28779 precondition tests have succeeded. If the expansion is forced to fail, the
28780 router declines, the value of <option>address_data</option> remains unchanged, and the
28781 <option>more</option> option controls what happens next. Other expansion failures cause
28782 delivery of the address to be deferred.
28785 <indexterm role="variable">
28786 <primary><varname>$address_data</varname></primary>
28788 When the expansion succeeds, the value is retained with the address, and can be
28789 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
28790 routers, and the eventual transport.
28793 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
28794 that runs a user’s filter file, the contents of <varname>$address_data</varname> are accessible
28795 in the filter. This is not normally a problem, because such data is usually
28796 either not confidential or it <quote>belongs</quote> to the current user, but if you do
28797 put confidential data into <varname>$address_data</varname> you need to remember this point.
28800 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
28801 with the address, though it can be changed by another <option>address_data</option> setting
28802 on a subsequent router. If a router generates child addresses, the value of
28803 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
28804 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
28807 The idea of <option>address_data</option> is that you can use it to look up a lot of data
28808 for the address once, and then pick out parts of the data later. For example,
28809 you could use a single LDAP lookup to return a string of the form
28811 <literallayout class="monospaced">
28812 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
28815 In the transport you could pick out the mailbox by a setting such as
28817 <literallayout class="monospaced">
28818 file = ${extract{mailbox}{$address_data}}
28821 This makes the configuration file less messy, and also reduces the number of
28822 lookups (though Exim does cache lookups).
28825 <indexterm role="variable">
28826 <primary><varname>$sender_address_data</varname></primary>
28828 <indexterm role="variable">
28829 <primary><varname>$address_data</varname></primary>
28831 The <option>address_data</option> facility is also useful as a means of passing information
28832 from one router to another, and from a router to a transport. In addition, if
28833 <varname>$address_data</varname> is set by a router when verifying a recipient address from an
28834 ACL, it remains available for use in the rest of the ACL statement. After
28835 verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
28838 <indexterm role="option">
28839 <primary><option>address_test</option></primary>
28842 <informaltable frame="all">
28843 <tgroup cols="4" colsep="0" rowsep="0">
28844 <colspec colwidth="8*" align="left"/>
28845 <colspec colwidth="6*" align="center"/>
28846 <colspec colwidth="6*" align="center"/>
28847 <colspec colwidth="6*" align="right"/>
28850 <entry><option>address_test</option></entry>
28851 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
28852 <entry>Type: <emphasis>boolean</emphasis></entry>
28853 <entry>Default: <emphasis>true</emphasis></entry>
28859 <indexterm role="option">
28860 <primary><option>-bt</option></primary>
28862 <indexterm role="concept">
28863 <primary>router</primary>
28864 <secondary>skipping when address testing</secondary>
28866 If this option is set false, the router is skipped when routing is being tested
28867 by means of the <option>-bt</option> command line option. This can be a convenience when
28868 your first router sends messages to an external scanner, because it saves you
28869 having to set the <quote>already scanned</quote> indicator when testing real address
28873 <indexterm role="option">
28874 <primary><option>cannot_route_message</option></primary>
28877 <informaltable frame="all">
28878 <tgroup cols="4" colsep="0" rowsep="0">
28879 <colspec colwidth="8*" align="left"/>
28880 <colspec colwidth="6*" align="center"/>
28881 <colspec colwidth="6*" align="center"/>
28882 <colspec colwidth="6*" align="right"/>
28885 <entry><option>cannot_route_message</option></entry>
28886 <entry>Use: <emphasis>routers</emphasis></entry>
28887 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28888 <entry>Default: <emphasis>unset</emphasis></entry>
28894 <indexterm role="concept">
28895 <primary>router</primary>
28896 <secondary>customizing <quote>cannot route</quote> message</secondary>
28898 <indexterm role="concept">
28899 <primary>customizing</primary>
28900 <secondary><quote>cannot route</quote> message</secondary>
28902 This option specifies a text message that is used when an address cannot be
28903 routed because Exim has run out of routers. The default message is
28904 <quote>Unrouteable address</quote>. This option is useful only on routers that have
28905 <option>more</option> set false, or on the very last router in a configuration, because the
28906 value that is used is taken from the last router that is considered. This
28907 includes a router that is skipped because its preconditions are not met, as
28908 well as a router that declines. For example, using the default configuration,
28911 <literallayout class="monospaced">
28912 cannot_route_message = Remote domain not found in DNS
28915 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
28918 <literallayout class="monospaced">
28919 cannot_route_message = Unknown local user
28922 on the final router that checks for local users. If string expansion fails for
28923 this option, the default message is used. Unless the expansion failure was
28924 explicitly forced, a message about the failure is written to the main and panic
28925 logs, in addition to the normal message about the routing failure.
28928 <indexterm role="option">
28929 <primary><option>caseful_local_part</option></primary>
28932 <informaltable frame="all">
28933 <tgroup cols="4" colsep="0" rowsep="0">
28934 <colspec colwidth="8*" align="left"/>
28935 <colspec colwidth="6*" align="center"/>
28936 <colspec colwidth="6*" align="center"/>
28937 <colspec colwidth="6*" align="right"/>
28940 <entry><option>caseful_local_part</option></entry>
28941 <entry>Use: <emphasis>routers</emphasis></entry>
28942 <entry>Type: <emphasis>boolean</emphasis></entry>
28943 <entry>Default: <emphasis>false</emphasis></entry>
28949 <indexterm role="concept">
28950 <primary>case of local parts</primary>
28952 <indexterm role="concept">
28953 <primary>router</primary>
28954 <secondary>case of local parts</secondary>
28956 By default, routers handle the local parts of addresses in a case-insensitive
28957 manner, though the actual case is preserved for transmission with the message.
28958 If you want the case of letters to be significant in a router, you must set
28959 this option true. For individual router options that contain address or local
28960 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
28961 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
28965 <indexterm role="variable">
28966 <primary><varname>$local_part</varname></primary>
28968 <indexterm role="variable">
28969 <primary><varname>$original_local_part</varname></primary>
28971 <indexterm role="variable">
28972 <primary><varname>$parent_local_part</varname></primary>
28974 The value of the <varname>$local_part</varname> variable is forced to lower case while a
28975 router is running unless <option>caseful_local_part</option> is set. When a router assigns
28976 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
28977 is the same as it was in the router. Similarly, when a router generates child
28978 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
28979 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
28982 This option applies to the processing of an address by a router. When a
28983 recipient address is being processed in an ACL, there is a separate <option>control</option>
28984 modifier that can be used to specify case-sensitive processing within the ACL
28985 (see section <xref linkend="SECTcontrols"/>).
28988 <indexterm role="option">
28989 <primary><option>check_local_user</option></primary>
28992 <informaltable frame="all">
28993 <tgroup cols="4" colsep="0" rowsep="0">
28994 <colspec colwidth="8*" align="left"/>
28995 <colspec colwidth="6*" align="center"/>
28996 <colspec colwidth="6*" align="center"/>
28997 <colspec colwidth="6*" align="right"/>
29000 <entry><option>check_local_user</option></entry>
29001 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29002 <entry>Type: <emphasis>boolean</emphasis></entry>
29003 <entry>Default: <emphasis>false</emphasis></entry>
29009 <indexterm role="concept">
29010 <primary>local user, checking in router</primary>
29012 <indexterm role="concept">
29013 <primary>router</primary>
29014 <secondary>checking for local user</secondary>
29016 <indexterm role="concept">
29017 <primary><filename>/etc/passwd</filename></primary>
29019 <indexterm role="variable">
29020 <primary><varname>$home</varname></primary>
29022 When this option is true, Exim checks that the local part of the recipient
29023 address (with affixes removed if relevant) is the name of an account on the
29024 local system. The check is done by calling the <function>getpwnam()</function> function rather
29025 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
29026 holding password data (such as NIS) are supported. If the local part is a local
29027 user, <varname>$home</varname> is set from the password data, and can be tested in other
29028 preconditions that are evaluated after this one (the order of evaluation is
29029 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
29030 overridden by <option>router_home_directory</option>. If the local part is not a local user,
29031 the router is skipped.
29034 If you want to check that the local part is either the name of a local user
29035 or matches something else, you cannot combine <option>check_local_user</option> with a
29036 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
29037 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
29038 setting to achieve this. For example:
29040 <literallayout class="monospaced">
29041 local_parts = passwd;$local_part : lsearch;/etc/other/users
29044 Note, however, that the side effects of <option>check_local_user</option> (such as setting
29045 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
29046 <option>local_parts</option> (or any other) precondition.
29049 <indexterm role="option">
29050 <primary><option>condition</option></primary>
29053 <informaltable frame="all">
29054 <tgroup cols="4" colsep="0" rowsep="0">
29055 <colspec colwidth="8*" align="left"/>
29056 <colspec colwidth="6*" align="center"/>
29057 <colspec colwidth="6*" align="center"/>
29058 <colspec colwidth="6*" align="right"/>
29061 <entry><option>condition</option></entry>
29062 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29063 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29064 <entry>Default: <emphasis>unset</emphasis></entry>
29070 <indexterm role="concept">
29071 <primary>router</primary>
29072 <secondary>customized precondition</secondary>
29074 This option specifies a general precondition test that has to succeed for the
29075 router to be called. The <option>condition</option> option is the last precondition to be
29076 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
29077 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
29078 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
29079 router is skipped, and the address is offered to the next one.
29082 If the result is any other value, the router is run (as this is the last
29083 precondition to be evaluated, all the other preconditions must be true).
29086 This option is unique in that multiple <option>condition</option> options may be present.
29087 All <option>condition</option> options must succeed.
29090 The <option>condition</option> option provides a means of applying custom conditions to the
29091 running of routers. Note that in the case of a simple conditional expansion,
29092 the default expansion values are exactly what is wanted. For example:
29094 <literallayout class="monospaced">
29095 condition = ${if >{$message_age}{600}}
29098 Because of the default behaviour of the string expansion, this is equivalent to
29100 <literallayout class="monospaced">
29101 condition = ${if >{$message_age}{600}{true}{}}
29104 A multiple condition example, which succeeds:
29106 <literallayout class="monospaced">
29107 condition = ${if >{$message_age}{600}}
29108 condition = ${if !eq{${lc:$local_part}}{postmaster}}
29112 If the expansion fails (other than forced failure) delivery is deferred. Some
29113 of the other precondition options are common special cases that could in fact
29114 be specified using <option>condition</option>.
29117 <indexterm role="option">
29118 <primary><option>debug_print</option></primary>
29121 <informaltable frame="all">
29122 <tgroup cols="4" colsep="0" rowsep="0">
29123 <colspec colwidth="8*" align="left"/>
29124 <colspec colwidth="6*" align="center"/>
29125 <colspec colwidth="6*" align="center"/>
29126 <colspec colwidth="6*" align="right"/>
29129 <entry><option>debug_print</option></entry>
29130 <entry>Use: <emphasis>routers</emphasis></entry>
29131 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29132 <entry>Default: <emphasis>unset</emphasis></entry>
29138 <indexterm role="concept">
29139 <primary>testing</primary>
29140 <secondary>variables in drivers</secondary>
29142 If this option is set and debugging is enabled (see the <option>-d</option> command line
29143 option), the string is expanded and included in the debugging output.
29144 If expansion of the string fails, the error message is written to the debugging
29145 output, and Exim carries on processing.
29146 This option is provided to help with checking out the values of variables and
29147 so on when debugging router configurations. For example, if a <option>condition</option>
29148 option appears not to be working, <option>debug_print</option> can be used to output the
29149 variables it references. The output happens after checks for <option>domains</option>,
29150 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
29151 are tested. A newline is added to the text if it does not end with one.
29154 <indexterm role="option">
29155 <primary><option>disable_logging</option></primary>
29158 <informaltable frame="all">
29159 <tgroup cols="4" colsep="0" rowsep="0">
29160 <colspec colwidth="8*" align="left"/>
29161 <colspec colwidth="6*" align="center"/>
29162 <colspec colwidth="6*" align="center"/>
29163 <colspec colwidth="6*" align="right"/>
29166 <entry><option>disable_logging</option></entry>
29167 <entry>Use: <emphasis>routers</emphasis></entry>
29168 <entry>Type: <emphasis>boolean</emphasis></entry>
29169 <entry>Default: <emphasis>false</emphasis></entry>
29175 If this option is set true, nothing is logged for any routing errors
29176 or for any deliveries caused by this router. You should not set this option
29177 unless you really, really know what you are doing. See also the generic
29178 transport option of the same name.
29181 <indexterm role="option">
29182 <primary><option>domains</option></primary>
29185 <informaltable frame="all">
29186 <tgroup cols="4" colsep="0" rowsep="0">
29187 <colspec colwidth="8*" align="left"/>
29188 <colspec colwidth="6*" align="center"/>
29189 <colspec colwidth="6*" align="center"/>
29190 <colspec colwidth="6*" align="right"/>
29193 <entry><option>domains</option></entry>
29194 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29195 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
29196 <entry>Default: <emphasis>unset</emphasis></entry>
29202 <indexterm role="concept">
29203 <primary>router</primary>
29204 <secondary>restricting to specific domains</secondary>
29206 <indexterm role="variable">
29207 <primary><varname>$domain_data</varname></primary>
29209 If this option is set, the router is skipped unless the current domain matches
29210 the list. If the match is achieved by means of a file lookup, the data that the
29211 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
29212 expansions of the driver’s private options. See section <xref linkend="SECTrouprecon"/> for
29213 a list of the order in which preconditions are evaluated.
29216 <indexterm role="option">
29217 <primary><option>driver</option></primary>
29220 <informaltable frame="all">
29221 <tgroup cols="4" colsep="0" rowsep="0">
29222 <colspec colwidth="8*" align="left"/>
29223 <colspec colwidth="6*" align="center"/>
29224 <colspec colwidth="6*" align="center"/>
29225 <colspec colwidth="6*" align="right"/>
29228 <entry><option>driver</option></entry>
29229 <entry>Use: <emphasis>routers</emphasis></entry>
29230 <entry>Type: <emphasis>string</emphasis></entry>
29231 <entry>Default: <emphasis>unset</emphasis></entry>
29237 This option must always be set. It specifies which of the available routers is
29241 <indexterm role="option">
29242 <primary><option>errors_to</option></primary>
29245 <informaltable frame="all">
29246 <tgroup cols="4" colsep="0" rowsep="0">
29247 <colspec colwidth="8*" align="left"/>
29248 <colspec colwidth="6*" align="center"/>
29249 <colspec colwidth="6*" align="center"/>
29250 <colspec colwidth="6*" align="right"/>
29253 <entry><option>errors_to</option></entry>
29254 <entry>Use: <emphasis>routers</emphasis></entry>
29255 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29256 <entry>Default: <emphasis>unset</emphasis></entry>
29262 <indexterm role="concept">
29263 <primary>envelope sender</primary>
29265 <indexterm role="concept">
29266 <primary>router</primary>
29267 <secondary>changing address for errors</secondary>
29269 If a router successfully handles an address, it may assign the address to a
29270 transport for delivery or it may generate child addresses. In both cases, if
29271 there is a delivery problem during later processing, the resulting bounce
29272 message is sent to the address that results from expanding this string,
29273 provided that the address verifies successfully. The <option>errors_to</option> option is
29274 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
29277 The <option>errors_to</option> setting associated with an address can be overridden if it
29278 subsequently passes through other routers that have their own <option>errors_to</option>
29279 settings, or if the message is delivered by a transport with a <option>return_path</option>
29283 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
29284 the expansion fails to verify, the errors address associated with the incoming
29285 address is used. At top level, this is the envelope sender. A non-forced
29286 expansion failure causes delivery to be deferred.
29289 If an address for which <option>errors_to</option> has been set ends up being delivered over
29290 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
29291 any bounces that are generated by other MTAs on the delivery route are also
29292 sent there. You can set <option>errors_to</option> to the empty string by either of these
29295 <literallayout class="monospaced">
29300 An expansion item that yields an empty string has the same effect. If you do
29301 this, a locally detected delivery error for addresses processed by this router
29302 no longer gives rise to a bounce message; the error is discarded. If the
29303 address is delivered to a remote host, the return path is set to <literal><></literal>, unless
29304 overridden by the <option>return_path</option> option on the transport.
29307 <indexterm role="variable">
29308 <primary><varname>$address_data</varname></primary>
29310 If for some reason you want to discard local errors, but use a non-empty
29311 MAIL command for remote delivery, you can preserve the original return
29312 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
29313 setting <option>return_path</option>.
29316 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
29317 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
29318 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
29321 <indexterm role="option">
29322 <primary><option>expn</option></primary>
29325 <informaltable frame="all">
29326 <tgroup cols="4" colsep="0" rowsep="0">
29327 <colspec colwidth="8*" align="left"/>
29328 <colspec colwidth="6*" align="center"/>
29329 <colspec colwidth="6*" align="center"/>
29330 <colspec colwidth="6*" align="right"/>
29333 <entry><option>expn</option></entry>
29334 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29335 <entry>Type: <emphasis>boolean</emphasis></entry>
29336 <entry>Default: <emphasis>true</emphasis></entry>
29342 <indexterm role="concept">
29343 <primary>address</primary>
29344 <secondary>testing</secondary>
29346 <indexterm role="concept">
29347 <primary>testing</primary>
29348 <secondary>addresses</secondary>
29350 <indexterm role="concept">
29351 <primary>EXPN</primary>
29352 <secondary>router skipping</secondary>
29354 <indexterm role="concept">
29355 <primary>router</primary>
29356 <secondary>skipping for EXPN</secondary>
29358 If this option is turned off, the router is skipped when testing an address
29359 as a result of processing an SMTP EXPN command. You might, for example,
29360 want to turn it off on a router for users’ <filename>.forward</filename> files, while leaving it
29361 on for the system alias file.
29362 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
29366 The use of the SMTP EXPN command is controlled by an ACL (see chapter
29367 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
29368 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
29371 <indexterm role="option">
29372 <primary><option>fail_verify</option></primary>
29375 <informaltable frame="all">
29376 <tgroup cols="4" colsep="0" rowsep="0">
29377 <colspec colwidth="8*" align="left"/>
29378 <colspec colwidth="6*" align="center"/>
29379 <colspec colwidth="6*" align="center"/>
29380 <colspec colwidth="6*" align="right"/>
29383 <entry><option>fail_verify</option></entry>
29384 <entry>Use: <emphasis>routers</emphasis></entry>
29385 <entry>Type: <emphasis>boolean</emphasis></entry>
29386 <entry>Default: <emphasis>false</emphasis></entry>
29392 <indexterm role="concept">
29393 <primary>router</primary>
29394 <secondary>forcing verification failure</secondary>
29396 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
29397 <option>fail_verify_recipient</option> to the same value.
29400 <indexterm role="option">
29401 <primary><option>fail_verify_recipient</option></primary>
29404 <informaltable frame="all">
29405 <tgroup cols="4" colsep="0" rowsep="0">
29406 <colspec colwidth="8*" align="left"/>
29407 <colspec colwidth="6*" align="center"/>
29408 <colspec colwidth="6*" align="center"/>
29409 <colspec colwidth="6*" align="right"/>
29412 <entry><option>fail_verify_recipient</option></entry>
29413 <entry>Use: <emphasis>routers</emphasis></entry>
29414 <entry>Type: <emphasis>boolean</emphasis></entry>
29415 <entry>Default: <emphasis>false</emphasis></entry>
29421 If this option is true and an address is accepted by this router when
29422 verifying a recipient, verification fails.
29425 <indexterm role="option">
29426 <primary><option>fail_verify_sender</option></primary>
29429 <informaltable frame="all">
29430 <tgroup cols="4" colsep="0" rowsep="0">
29431 <colspec colwidth="8*" align="left"/>
29432 <colspec colwidth="6*" align="center"/>
29433 <colspec colwidth="6*" align="center"/>
29434 <colspec colwidth="6*" align="right"/>
29437 <entry><option>fail_verify_sender</option></entry>
29438 <entry>Use: <emphasis>routers</emphasis></entry>
29439 <entry>Type: <emphasis>boolean</emphasis></entry>
29440 <entry>Default: <emphasis>false</emphasis></entry>
29446 If this option is true and an address is accepted by this router when
29447 verifying a sender, verification fails.
29450 <indexterm role="option">
29451 <primary><option>fallback_hosts</option></primary>
29454 <informaltable frame="all">
29455 <tgroup cols="4" colsep="0" rowsep="0">
29456 <colspec colwidth="8*" align="left"/>
29457 <colspec colwidth="6*" align="center"/>
29458 <colspec colwidth="6*" align="center"/>
29459 <colspec colwidth="6*" align="right"/>
29462 <entry><option>fallback_hosts</option></entry>
29463 <entry>Use: <emphasis>routers</emphasis></entry>
29464 <entry>Type: <emphasis>string list</emphasis></entry>
29465 <entry>Default: <emphasis>unset</emphasis></entry>
29471 <indexterm role="concept">
29472 <primary>router</primary>
29473 <secondary>fallback hosts</secondary>
29475 <indexterm role="concept">
29476 <primary>fallback</primary>
29477 <secondary>hosts specified on router</secondary>
29479 String expansion is not applied to this option. The argument must be a
29480 colon-separated list of host names or IP addresses. The list separator can be
29481 changed (see section <xref linkend="SECTlistconstruct"/>), and a port can be specified with
29482 each name or address. In fact, the format of each item is exactly the same as
29483 defined for the list of hosts in a <command>manualroute</command> router (see section
29484 <xref linkend="SECTformatonehostitem"/>).
29487 If a router queues an address for a remote transport, this host list is
29488 associated with the address, and used instead of the transport’s fallback host
29489 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
29490 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
29491 transport for further details.
29494 <indexterm role="option">
29495 <primary><option>group</option></primary>
29498 <informaltable frame="all">
29499 <tgroup cols="4" colsep="0" rowsep="0">
29500 <colspec colwidth="8*" align="left"/>
29501 <colspec colwidth="6*" align="center"/>
29502 <colspec colwidth="6*" align="center"/>
29503 <colspec colwidth="6*" align="right"/>
29506 <entry><option>group</option></entry>
29507 <entry>Use: <emphasis>routers</emphasis></entry>
29508 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29509 <entry>Default: <emphasis>see below</emphasis></entry>
29515 <indexterm role="concept">
29516 <primary>gid (group id)</primary>
29517 <secondary>local delivery</secondary>
29519 <indexterm role="concept">
29520 <primary>local transports</primary>
29521 <secondary>uid and gid</secondary>
29523 <indexterm role="concept">
29524 <primary>transport</primary>
29525 <secondary>local</secondary>
29527 <indexterm role="concept">
29528 <primary>router</primary>
29529 <secondary>setting group</secondary>
29531 When a router queues an address for a transport, and the transport does not
29532 specify a group, the group given here is used when running the delivery
29534 The group may be specified numerically or by name. If expansion fails, the
29535 error is logged and delivery is deferred.
29536 The default is unset, unless <option>check_local_user</option> is set, when the default
29537 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
29538 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
29541 <indexterm role="option">
29542 <primary><option>headers_add</option></primary>
29545 <informaltable frame="all">
29546 <tgroup cols="4" colsep="0" rowsep="0">
29547 <colspec colwidth="8*" align="left"/>
29548 <colspec colwidth="6*" align="center"/>
29549 <colspec colwidth="6*" align="center"/>
29550 <colspec colwidth="6*" align="right"/>
29553 <entry><option>headers_add</option></entry>
29554 <entry>Use: <emphasis>routers</emphasis></entry>
29555 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29556 <entry>Default: <emphasis>unset</emphasis></entry>
29562 <indexterm role="concept">
29563 <primary>header lines</primary>
29564 <secondary>adding</secondary>
29566 <indexterm role="concept">
29567 <primary>router</primary>
29568 <secondary>adding header lines</secondary>
29570 This option specifies a string of text that is expanded at routing time, and
29571 associated with any addresses that are accepted by the router. However, this
29572 option has no effect when an address is just being verified. The way in which
29573 the text is used to add header lines at transport time is described in section
29574 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
29575 message is in the process of being transported. This means that references to
29576 header lines in string expansions in the transport’s configuration do not
29577 <quote>see</quote> the added header lines.
29580 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
29581 <option>headers_remove</option> and <option>transport</option>. If the expanded string is empty, or if
29582 the expansion is forced to fail, the option has no effect. Other expansion
29583 failures are treated as configuration errors.
29586 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
29587 router that has the <option>one_time</option> option set.
29590 <indexterm role="concept">
29591 <primary>duplicate addresses</primary>
29593 <indexterm role="option">
29594 <primary><option>unseen</option></primary>
29596 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
29597 additions are deleted when the address is passed on to subsequent routers.
29598 For a <option>redirect</option> router, if a generated address is the same as the incoming
29599 address, this can lead to duplicate addresses with different header
29600 modifications. Exim does not do duplicate deliveries (except, in certain
29601 circumstances, to pipes -- see section <xref linkend="SECTdupaddr"/>), but it is undefined
29602 which of the duplicates is discarded, so this ambiguous situation should be
29603 avoided. The <option>repeat_use</option> option of the <option>redirect</option> router may be of help.
29606 <indexterm role="option">
29607 <primary><option>headers_remove</option></primary>
29610 <informaltable frame="all">
29611 <tgroup cols="4" colsep="0" rowsep="0">
29612 <colspec colwidth="8*" align="left"/>
29613 <colspec colwidth="6*" align="center"/>
29614 <colspec colwidth="6*" align="center"/>
29615 <colspec colwidth="6*" align="right"/>
29618 <entry><option>headers_remove</option></entry>
29619 <entry>Use: <emphasis>routers</emphasis></entry>
29620 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29621 <entry>Default: <emphasis>unset</emphasis></entry>
29627 <indexterm role="concept">
29628 <primary>header lines</primary>
29629 <secondary>removing</secondary>
29631 <indexterm role="concept">
29632 <primary>router</primary>
29633 <secondary>removing header lines</secondary>
29635 This option specifies a string of text that is expanded at routing time, and
29636 associated with any addresses that are accepted by the router. However, this
29637 option has no effect when an address is just being verified. The way in which
29638 the text is used to remove header lines at transport time is described in
29639 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
29640 the message is in the process of being transported. This means that references
29641 to header lines in string expansions in the transport’s configuration still
29642 <quote>see</quote> the original header lines.
29645 The <option>headers_remove</option> option is expanded after <option>errors_to</option> and
29646 <option>headers_add</option>, but before <option>transport</option>. If the expansion is forced to fail,
29647 the option has no effect. Other expansion failures are treated as configuration
29651 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
29652 router that has the <option>one_time</option> option set.
29655 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
29656 removal requests are deleted when the address is passed on to subsequent
29657 routers, and this can lead to problems with duplicates -- see the similar
29658 warning for <option>headers_add</option> above.
29661 <indexterm role="option">
29662 <primary><option>ignore_target_hosts</option></primary>
29665 <informaltable frame="all">
29666 <tgroup cols="4" colsep="0" rowsep="0">
29667 <colspec colwidth="8*" align="left"/>
29668 <colspec colwidth="6*" align="center"/>
29669 <colspec colwidth="6*" align="center"/>
29670 <colspec colwidth="6*" align="right"/>
29673 <entry><option>ignore_target_hosts</option></entry>
29674 <entry>Use: <emphasis>routers</emphasis></entry>
29675 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
29676 <entry>Default: <emphasis>unset</emphasis></entry>
29682 <indexterm role="concept">
29683 <primary>IP address</primary>
29684 <secondary>discarding</secondary>
29686 <indexterm role="concept">
29687 <primary>router</primary>
29688 <secondary>discarding IP addresses</secondary>
29690 Although this option is a host list, it should normally contain IP address
29691 entries rather than names. If any host that is looked up by the router has an
29692 IP address that matches an item in this list, Exim behaves as if that IP
29693 address did not exist. This option allows you to cope with rogue DNS entries
29696 <literallayout class="monospaced">
29697 remote.domain.example. A 127.0.0.1
29702 <literallayout class="monospaced">
29703 ignore_target_hosts = 127.0.0.1
29706 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
29707 discarded in this way, the router declines. In a conventional configuration, an
29708 attempt to mail to such a domain would normally provoke the <quote>unrouteable
29709 domain</quote> error, and an attempt to verify an address in the domain would fail.
29710 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
29711 router declines if presented with one of the listed addresses.
29714 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
29715 means of the first or the second of the following settings, respectively:
29717 <literallayout class="monospaced">
29718 ignore_target_hosts = 0.0.0.0/0
29719 ignore_target_hosts = <; 0::0/0
29722 The pattern in the first line matches all IPv4 addresses, whereas the pattern
29723 in the second line matches all IPv6 addresses.
29726 This option may also be useful for ignoring link-local and site-local IPv6
29727 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
29728 is expanded before use as a list, it is possible to make it dependent on the
29729 domain that is being routed.
29732 <indexterm role="variable">
29733 <primary><varname>$host_address</varname></primary>
29735 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
29739 <indexterm role="option">
29740 <primary><option>initgroups</option></primary>
29743 <informaltable frame="all">
29744 <tgroup cols="4" colsep="0" rowsep="0">
29745 <colspec colwidth="8*" align="left"/>
29746 <colspec colwidth="6*" align="center"/>
29747 <colspec colwidth="6*" align="center"/>
29748 <colspec colwidth="6*" align="right"/>
29751 <entry><option>initgroups</option></entry>
29752 <entry>Use: <emphasis>routers</emphasis></entry>
29753 <entry>Type: <emphasis>boolean</emphasis></entry>
29754 <entry>Default: <emphasis>false</emphasis></entry>
29760 <indexterm role="concept">
29761 <primary>additional groups</primary>
29763 <indexterm role="concept">
29764 <primary>groups</primary>
29765 <secondary>additional</secondary>
29767 <indexterm role="concept">
29768 <primary>local transports</primary>
29769 <secondary>uid and gid</secondary>
29771 <indexterm role="concept">
29772 <primary>transport</primary>
29773 <secondary>local</secondary>
29775 If the router queues an address for a transport, and this option is true, and
29776 the uid supplied by the router is not overridden by the transport, the
29777 <function>initgroups()</function> function is called when running the transport to ensure that
29778 any additional groups associated with the uid are set up. See also <option>group</option>
29779 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
29782 <indexterm role="option">
29783 <primary><option>local_part_prefix</option></primary>
29786 <informaltable frame="all">
29787 <tgroup cols="4" colsep="0" rowsep="0">
29788 <colspec colwidth="8*" align="left"/>
29789 <colspec colwidth="6*" align="center"/>
29790 <colspec colwidth="6*" align="center"/>
29791 <colspec colwidth="6*" align="right"/>
29794 <entry><option>local_part_prefix</option></entry>
29795 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29796 <entry>Type: <emphasis>string list</emphasis></entry>
29797 <entry>Default: <emphasis>unset</emphasis></entry>
29803 <indexterm role="concept">
29804 <primary>router</primary>
29805 <secondary>prefix for local part</secondary>
29807 <indexterm role="concept">
29808 <primary>prefix</primary>
29809 <secondary>for local part, used in router</secondary>
29811 If this option is set, the router is skipped unless the local part starts with
29812 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
29813 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
29817 The list is scanned from left to right, and the first prefix that matches is
29818 used. A limited form of wildcard is available; if the prefix begins with an
29819 asterisk, it matches the longest possible sequence of arbitrary characters at
29820 the start of the local part. An asterisk should therefore always be followed by
29821 some character that does not occur in normal local parts.
29822 <indexterm role="concept">
29823 <primary>multiple mailboxes</primary>
29825 <indexterm role="concept">
29826 <primary>mailbox</primary>
29827 <secondary>multiple</secondary>
29829 Wildcarding can be used to set up multiple user mailboxes, as described in
29830 section <xref linkend="SECTmulbox"/>.
29833 <indexterm role="variable">
29834 <primary><varname>$local_part</varname></primary>
29836 <indexterm role="variable">
29837 <primary><varname>$local_part_prefix</varname></primary>
29839 During the testing of the <option>local_parts</option> option, and while the router is
29840 running, the prefix is removed from the local part, and is available in the
29841 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
29842 the router accepts the address, this remains true during subsequent delivery by
29843 a transport. In particular, the local part that is transmitted in the RCPT
29844 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
29845 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
29846 the relevant transport.
29849 When an address is being verified, <option>local_part_prefix</option> affects only the
29850 behaviour of the router. If the callout feature of verification is in use, this
29851 means that the full address, including the prefix, will be used during the
29855 The prefix facility is commonly used to handle local parts of the form
29856 <option>owner-something</option>. Another common use is to support local parts of the form
29857 <option>real-username</option> to bypass a user’s <filename>.forward</filename> file – helpful when trying
29858 to tell a user their forwarding is broken – by placing a router like this one
29859 immediately before the router that handles <filename>.forward</filename> files:
29861 <literallayout class="monospaced">
29864 local_part_prefix = real-
29866 transport = local_delivery
29869 For security, it would probably be a good idea to restrict the use of this
29870 router to locally-generated messages, using a condition such as this:
29872 <literallayout class="monospaced">
29873 condition = ${if match {$sender_host_address}\
29874 {\N^(|127\.0\.0\.1)$\N}}
29877 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
29878 both conditions must be met if not optional. Care must be taken if wildcards
29879 are used in both a prefix and a suffix on the same router. Different
29880 separator characters must be used to avoid ambiguity.
29883 <indexterm role="option">
29884 <primary><option>local_part_prefix_optional</option></primary>
29887 <informaltable frame="all">
29888 <tgroup cols="4" colsep="0" rowsep="0">
29889 <colspec colwidth="8*" align="left"/>
29890 <colspec colwidth="6*" align="center"/>
29891 <colspec colwidth="6*" align="center"/>
29892 <colspec colwidth="6*" align="right"/>
29895 <entry><option>local_part_prefix_optional</option></entry>
29896 <entry>Use: <emphasis>routers</emphasis></entry>
29897 <entry>Type: <emphasis>boolean</emphasis></entry>
29898 <entry>Default: <emphasis>false</emphasis></entry>
29904 See <option>local_part_prefix</option> above.
29907 <indexterm role="option">
29908 <primary><option>local_part_suffix</option></primary>
29911 <informaltable frame="all">
29912 <tgroup cols="4" colsep="0" rowsep="0">
29913 <colspec colwidth="8*" align="left"/>
29914 <colspec colwidth="6*" align="center"/>
29915 <colspec colwidth="6*" align="center"/>
29916 <colspec colwidth="6*" align="right"/>
29919 <entry><option>local_part_suffix</option></entry>
29920 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29921 <entry>Type: <emphasis>string list</emphasis></entry>
29922 <entry>Default: <emphasis>unset</emphasis></entry>
29928 <indexterm role="concept">
29929 <primary>router</primary>
29930 <secondary>suffix for local part</secondary>
29932 <indexterm role="concept">
29933 <primary>suffix for local part</primary>
29934 <secondary>used in router</secondary>
29936 This option operates in the same way as <option>local_part_prefix</option>, except that the
29937 local part must end (rather than start) with the given string, the
29938 <option>local_part_suffix_optional</option> option determines whether the suffix is
29939 mandatory, and the wildcard * character, if present, must be the last
29940 character of the suffix. This option facility is commonly used to handle local
29941 parts of the form <option>something-request</option> and multiple user mailboxes of the form
29942 <option>username-foo</option>.
29945 <indexterm role="option">
29946 <primary><option>local_part_suffix_optional</option></primary>
29949 <informaltable frame="all">
29950 <tgroup cols="4" colsep="0" rowsep="0">
29951 <colspec colwidth="8*" align="left"/>
29952 <colspec colwidth="6*" align="center"/>
29953 <colspec colwidth="6*" align="center"/>
29954 <colspec colwidth="6*" align="right"/>
29957 <entry><option>local_part_suffix_optional</option></entry>
29958 <entry>Use: <emphasis>routers</emphasis></entry>
29959 <entry>Type: <emphasis>boolean</emphasis></entry>
29960 <entry>Default: <emphasis>false</emphasis></entry>
29966 See <option>local_part_suffix</option> above.
29969 <indexterm role="option">
29970 <primary><option>local_parts</option></primary>
29973 <informaltable frame="all">
29974 <tgroup cols="4" colsep="0" rowsep="0">
29975 <colspec colwidth="8*" align="left"/>
29976 <colspec colwidth="6*" align="center"/>
29977 <colspec colwidth="6*" align="center"/>
29978 <colspec colwidth="6*" align="right"/>
29981 <entry><option>local_parts</option></entry>
29982 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29983 <entry>Type: <emphasis>local part list</emphasis>†<emphasis></emphasis></entry>
29984 <entry>Default: <emphasis>unset</emphasis></entry>
29990 <indexterm role="concept">
29991 <primary>router</primary>
29992 <secondary>restricting to specific local parts</secondary>
29994 <indexterm role="concept">
29995 <primary>local part</primary>
29996 <secondary>checking in router</secondary>
29998 The router is run only if the local part of the address matches the list.
29999 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30001 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
30002 string is expanded, it is possible to make it depend on the domain, for
30005 <literallayout class="monospaced">
30006 local_parts = dbm;/usr/local/specials/$domain
30009 <indexterm role="variable">
30010 <primary><varname>$local_part_data</varname></primary>
30012 If the match is achieved by a lookup, the data that the lookup returned
30013 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
30014 expansions of the router’s private options. You might use this option, for
30015 example, if you have a large number of local virtual domains, and you want to
30016 send all postmaster mail to the same place without having to set up an alias in
30017 each virtual domain:
30019 <literallayout class="monospaced">
30022 local_parts = postmaster
30023 data = postmaster@real.domain.example
30026 <indexterm role="option">
30027 <primary><option>log_as_local</option></primary>
30030 <informaltable frame="all">
30031 <tgroup cols="4" colsep="0" rowsep="0">
30032 <colspec colwidth="8*" align="left"/>
30033 <colspec colwidth="6*" align="center"/>
30034 <colspec colwidth="6*" align="center"/>
30035 <colspec colwidth="6*" align="right"/>
30038 <entry><option>log_as_local</option></entry>
30039 <entry>Use: <emphasis>routers</emphasis></entry>
30040 <entry>Type: <emphasis>boolean</emphasis></entry>
30041 <entry>Default: <emphasis>see below</emphasis></entry>
30047 <indexterm role="concept">
30048 <primary>log</primary>
30049 <secondary>delivery line</secondary>
30051 <indexterm role="concept">
30052 <primary>delivery</primary>
30053 <secondary>log line format</secondary>
30055 Exim has two logging styles for delivery, the idea being to make local
30056 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
30057 recipient address is given just as the local part, without a domain. The use of
30058 this style is controlled by this option. It defaults to true for the <command>accept</command>
30059 router, and false for all the others. This option applies only when a
30060 router assigns an address to a transport. It has no effect on routers that
30061 redirect addresses.
30064 <indexterm role="option">
30065 <primary><option>more</option></primary>
30068 <informaltable frame="all">
30069 <tgroup cols="4" colsep="0" rowsep="0">
30070 <colspec colwidth="8*" align="left"/>
30071 <colspec colwidth="6*" align="center"/>
30072 <colspec colwidth="6*" align="center"/>
30073 <colspec colwidth="6*" align="right"/>
30076 <entry><option>more</option></entry>
30077 <entry>Use: <emphasis>routers</emphasis></entry>
30078 <entry>Type: <emphasis>boolean</emphasis>†<emphasis></emphasis></entry>
30079 <entry>Default: <emphasis>true</emphasis></entry>
30085 The result of string expansion for this option must be a valid boolean value,
30086 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
30087 result causes an error, and delivery is deferred. If the expansion is forced to
30088 fail, the default value for the option (true) is used. Other failures cause
30089 delivery to be deferred.
30092 If this option is set false, and the router declines to handle the address, no
30093 further routers are tried, routing fails, and the address is bounced.
30094 <indexterm role="option">
30095 <primary><option>self</option></primary>
30097 However, if the router explicitly passes an address to the following router by
30098 means of the setting
30100 <literallayout class="monospaced">
30104 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
30105 does not affect the behaviour if one of the precondition tests fails. In that
30106 case, the address is always passed to the next router.
30109 Note that <option>address_data</option> is not considered to be a precondition. If its
30110 expansion is forced to fail, the router declines, and the value of <option>more</option>
30111 controls what happens next.
30114 <indexterm role="option">
30115 <primary><option>pass_on_timeout</option></primary>
30118 <informaltable frame="all">
30119 <tgroup cols="4" colsep="0" rowsep="0">
30120 <colspec colwidth="8*" align="left"/>
30121 <colspec colwidth="6*" align="center"/>
30122 <colspec colwidth="6*" align="center"/>
30123 <colspec colwidth="6*" align="right"/>
30126 <entry><option>pass_on_timeout</option></entry>
30127 <entry>Use: <emphasis>routers</emphasis></entry>
30128 <entry>Type: <emphasis>boolean</emphasis></entry>
30129 <entry>Default: <emphasis>false</emphasis></entry>
30135 <indexterm role="concept">
30136 <primary>timeout</primary>
30137 <secondary>of router</secondary>
30139 <indexterm role="concept">
30140 <primary>router</primary>
30141 <secondary>timeout</secondary>
30143 If a router times out during a host lookup, it normally causes deferral of the
30144 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
30145 router, overriding <option>no_more</option>. This may be helpful for systems that are
30146 intermittently connected to the Internet, or those that want to pass to a smart
30147 host any messages that cannot immediately be delivered.
30150 There are occasional other temporary errors that can occur while doing DNS
30151 lookups. They are treated in the same way as a timeout, and this option
30152 applies to all of them.
30155 <indexterm role="option">
30156 <primary><option>pass_router</option></primary>
30159 <informaltable frame="all">
30160 <tgroup cols="4" colsep="0" rowsep="0">
30161 <colspec colwidth="8*" align="left"/>
30162 <colspec colwidth="6*" align="center"/>
30163 <colspec colwidth="6*" align="center"/>
30164 <colspec colwidth="6*" align="right"/>
30167 <entry><option>pass_router</option></entry>
30168 <entry>Use: <emphasis>routers</emphasis></entry>
30169 <entry>Type: <emphasis>string</emphasis></entry>
30170 <entry>Default: <emphasis>unset</emphasis></entry>
30176 <indexterm role="concept">
30177 <primary>router</primary>
30178 <secondary>go to after <quote>pass</quote></secondary>
30180 Routers that recognize the generic <option>self</option> option (<command>dnslookup</command>,
30181 <command>ipliteral</command>, and <command>manualroute</command>) are able to return <quote>pass</quote>, forcing
30182 routing to continue, and overriding a false setting of <option>more</option>. When one of
30183 these routers returns <quote>pass</quote>, the address is normally handed on to the next
30184 router in sequence. This can be changed by setting <option>pass_router</option> to the name
30185 of another router. However (unlike <option>redirect_router</option>) the named router must
30186 be below the current router, to avoid loops. Note that this option applies only
30187 to the special case of <quote>pass</quote>. It does not apply when a router returns
30188 <quote>decline</quote> because it cannot handle an address.
30191 <indexterm role="option">
30192 <primary><option>redirect_router</option></primary>
30195 <informaltable frame="all">
30196 <tgroup cols="4" colsep="0" rowsep="0">
30197 <colspec colwidth="8*" align="left"/>
30198 <colspec colwidth="6*" align="center"/>
30199 <colspec colwidth="6*" align="center"/>
30200 <colspec colwidth="6*" align="right"/>
30203 <entry><option>redirect_router</option></entry>
30204 <entry>Use: <emphasis>routers</emphasis></entry>
30205 <entry>Type: <emphasis>string</emphasis></entry>
30206 <entry>Default: <emphasis>unset</emphasis></entry>
30212 <indexterm role="concept">
30213 <primary>router</primary>
30214 <secondary>start at after redirection</secondary>
30216 Sometimes an administrator knows that it is pointless to reprocess addresses
30217 generated from alias or forward files with the same router again. For
30218 example, if an alias file translates real names into login ids there is no
30219 point searching the alias file a second time, especially if it is a large file.
30222 The <option>redirect_router</option> option can be set to the name of any router instance.
30223 It causes the routing of any generated addresses to start at the named router
30224 instead of at the first router. This option has no effect if the router in
30225 which it is set does not generate new addresses.
30228 <indexterm role="option">
30229 <primary><option>require_files</option></primary>
30232 <informaltable frame="all">
30233 <tgroup cols="4" colsep="0" rowsep="0">
30234 <colspec colwidth="8*" align="left"/>
30235 <colspec colwidth="6*" align="center"/>
30236 <colspec colwidth="6*" align="center"/>
30237 <colspec colwidth="6*" align="right"/>
30240 <entry><option>require_files</option></entry>
30241 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
30242 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
30243 <entry>Default: <emphasis>unset</emphasis></entry>
30249 <indexterm role="concept">
30250 <primary>file</primary>
30251 <secondary>requiring for router</secondary>
30253 <indexterm role="concept">
30254 <primary>router</primary>
30255 <secondary>requiring file existence</secondary>
30257 This option provides a general mechanism for predicating the running of a
30258 router on the existence or non-existence of certain files or directories.
30259 Before running a router, as one of its precondition tests, Exim works its way
30260 through the <option>require_files</option> list, expanding each item separately.
30263 Because the list is split before expansion, any colons in expansion items must
30264 be doubled, or the facility for using a different list separator must be used.
30265 If any expansion is forced to fail, the item is ignored. Other expansion
30266 failures cause routing of the address to be deferred.
30269 If any expanded string is empty, it is ignored. Otherwise, except as described
30270 below, each string must be a fully qualified file path, optionally preceded by
30271 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
30272 existence of the files or directories. The router is skipped if any paths not
30273 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
30276 <indexterm role="concept">
30277 <primary>NFS</primary>
30279 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
30280 the message is deferred. This can happen when NFS-mounted filesystems are
30284 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
30285 options, so you cannot use it to check for the existence of a file in which to
30286 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
30287 full list of the order in which preconditions are evaluated.) However, as
30288 these options are all expanded, you can use the <option>exists</option> expansion condition
30289 to make such tests. The <option>require_files</option> option is intended for checking files
30290 that the router may be going to use internally, or which are needed by a
30291 transport (for example <filename>.procmailrc</filename>).
30294 During delivery, the <function>stat()</function> function is run as root, but there is a
30295 facility for some checking of the accessibility of a file by another user.
30296 This is not a proper permissions check, but just a <quote>rough</quote> check that
30297 operates as follows:
30300 If an item in a <option>require_files</option> list does not contain any forward slash
30301 characters, it is taken to be the user (and optional group, separated by a
30302 comma) to be checked for subsequent files in the list. If no group is specified
30303 but the user is specified symbolically, the gid associated with the uid is
30306 <literallayout class="monospaced">
30307 require_files = mail:/some/file
30308 require_files = $local_part:$home/.procmailrc
30311 If a user or group name in a <option>require_files</option> list does not exist, the
30312 <option>require_files</option> condition fails.
30315 Exim performs the check by scanning along the components of the file path, and
30316 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
30317 directories, and <quote>r</quote> access on the final file. Note that this means that file
30318 access control lists, if the operating system has them, are ignored.
30321 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
30322 incoming SMTP message, Exim is not running as root, but under its own uid. This
30323 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
30324 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
30325 user is not permitted to read one of the directories on the file’s path.
30328 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
30329 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
30330 without root access. In this case, if a check for access by a particular user
30331 is requested, Exim creates a subprocess that runs as that user, and tries the
30332 check again in that process.
30335 The default action for handling an unresolved EACCES is to consider it to
30336 be caused by a configuration error, and routing is deferred because the
30337 existence or non-existence of the file cannot be determined. However, in some
30338 circumstances it may be desirable to treat this condition as if the file did
30339 not exist. If the file name (or the exclamation mark that precedes the file
30340 name for non-existence) is preceded by a plus sign, the EACCES error is treated
30341 as if the file did not exist. For example:
30343 <literallayout class="monospaced">
30344 require_files = +/some/file
30347 If the router is not an essential part of verification (for example, it
30348 handles users’ <filename>.forward</filename> files), another solution is to set the <option>verify</option>
30349 option false so that the router is skipped when verifying.
30352 <indexterm role="option">
30353 <primary><option>retry_use_local_part</option></primary>
30356 <informaltable frame="all">
30357 <tgroup cols="4" colsep="0" rowsep="0">
30358 <colspec colwidth="8*" align="left"/>
30359 <colspec colwidth="6*" align="center"/>
30360 <colspec colwidth="6*" align="center"/>
30361 <colspec colwidth="6*" align="right"/>
30364 <entry><option>retry_use_local_part</option></entry>
30365 <entry>Use: <emphasis>routers</emphasis></entry>
30366 <entry>Type: <emphasis>boolean</emphasis></entry>
30367 <entry>Default: <emphasis>see below</emphasis></entry>
30373 <indexterm role="concept">
30374 <primary>hints database</primary>
30375 <secondary>retry keys</secondary>
30377 <indexterm role="concept">
30378 <primary>local part</primary>
30379 <secondary>in retry keys</secondary>
30381 When a delivery suffers a temporary routing failure, a retry record is created
30382 in Exim’s hints database. For addresses whose routing depends only on the
30383 domain, the key for the retry record should not involve the local part, but for
30384 other addresses, both the domain and the local part should be included.
30385 Usually, remote routing is of the former kind, and local routing is of the
30389 This option controls whether the local part is used to form the key for retry
30390 hints for addresses that suffer temporary errors while being handled by this
30391 router. The default value is true for any router that has <option>check_local_user</option>
30392 set, and false otherwise. Note that this option does not apply to hints keys
30393 for transport delays; they are controlled by a generic transport option of the
30397 The setting of <option>retry_use_local_part</option> applies only to the router on which it
30398 appears. If the router generates child addresses, they are routed
30399 independently; this setting does not become attached to them.
30402 <indexterm role="option">
30403 <primary><option>router_home_directory</option></primary>
30406 <informaltable frame="all">
30407 <tgroup cols="4" colsep="0" rowsep="0">
30408 <colspec colwidth="8*" align="left"/>
30409 <colspec colwidth="6*" align="center"/>
30410 <colspec colwidth="6*" align="center"/>
30411 <colspec colwidth="6*" align="right"/>
30414 <entry><option>router_home_directory</option></entry>
30415 <entry>Use: <emphasis>routers</emphasis></entry>
30416 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
30417 <entry>Default: <emphasis>unset</emphasis></entry>
30423 <indexterm role="concept">
30424 <primary>router</primary>
30425 <secondary>home directory for</secondary>
30427 <indexterm role="concept">
30428 <primary>home directory</primary>
30429 <secondary>for router</secondary>
30431 <indexterm role="variable">
30432 <primary><varname>$home</varname></primary>
30434 This option sets a home directory for use while the router is running. (Compare
30435 <option>transport_home_directory</option>, which sets a home directory for later
30436 transporting.) In particular, if used on a <command>redirect</command> router, this option
30437 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
30438 forced expansion failure causes the option to be ignored – other failures
30439 cause the router to defer.
30442 Expansion of <option>router_home_directory</option> happens immediately after the
30443 <option>check_local_user</option> test (if configured), before any further expansions take
30445 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30447 While the router is running, <option>router_home_directory</option> overrides the value of
30448 <varname>$home</varname> that came from <option>check_local_user</option>.
30451 When a router accepts an address and assigns it to a local transport (including
30452 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
30453 delivery), the home directory setting for the transport is taken from the first
30454 of these values that is set:
30459 The <option>home_directory</option> option on the transport;
30464 The <option>transport_home_directory</option> option on the router;
30469 The password data if <option>check_local_user</option> is set on the router;
30474 The <option>router_home_directory</option> option on the router.
30479 In other words, <option>router_home_directory</option> overrides the password data for the
30480 router, but not for the transport.
30483 <indexterm role="option">
30484 <primary><option>self</option></primary>
30487 <informaltable frame="all">
30488 <tgroup cols="4" colsep="0" rowsep="0">
30489 <colspec colwidth="8*" align="left"/>
30490 <colspec colwidth="6*" align="center"/>
30491 <colspec colwidth="6*" align="center"/>
30492 <colspec colwidth="6*" align="right"/>
30495 <entry><option>self</option></entry>
30496 <entry>Use: <emphasis>routers</emphasis></entry>
30497 <entry>Type: <emphasis>string</emphasis></entry>
30498 <entry>Default: <emphasis>freeze</emphasis></entry>
30504 <indexterm role="concept">
30505 <primary>MX record</primary>
30506 <secondary>pointing to local host</secondary>
30508 <indexterm role="concept">
30509 <primary>local host</primary>
30510 <secondary>MX pointing to</secondary>
30512 This option applies to those routers that use a recipient address to find a
30513 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
30514 and <command>manualroute</command> routers.
30515 Certain configurations of the <command>queryprogram</command> router can also specify a list
30517 Usually such routers are configured to send the message to a remote host via an
30518 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
30519 host on the list turns out to be the local host.
30520 The way in which Exim checks for the local host is described in section
30521 <xref linkend="SECTreclocipadd"/>.
30524 Normally this situation indicates either an error in Exim’s configuration (for
30525 example, the router should be configured not to process this domain), or an
30526 error in the DNS (for example, the MX should not point to this host). For this
30527 reason, the default action is to log the incident, defer the address, and
30528 freeze the message. The following alternatives are provided for use in special
30533 <term><option>defer</option></term>
30536 Delivery of the message is tried again later, but the message is not frozen.
30538 </listitem></varlistentry>
30540 <term><option>reroute</option>: <<emphasis>domain</emphasis>></term>
30543 The domain is changed to the given domain, and the address is passed back to
30544 be reprocessed by the routers. No rewriting of headers takes place. This
30545 behaviour is essentially a redirection.
30547 </listitem></varlistentry>
30549 <term><option>reroute: rewrite:</option> <<emphasis>domain</emphasis>></term>
30552 The domain is changed to the given domain, and the address is passed back to be
30553 reprocessed by the routers. Any headers that contain the original domain are
30556 </listitem></varlistentry>
30558 <term><option>pass</option></term>
30561 <indexterm role="option">
30562 <primary><option>more</option></primary>
30564 <indexterm role="variable">
30565 <primary><varname>$self_hostname</varname></primary>
30567 The router passes the address to the next router, or to the router named in the
30568 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
30569 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
30570 name of the local host that the router encountered. This can be used to
30571 distinguish between different cases for hosts with multiple names. The
30574 <literallayout class="monospaced">
30579 ensures that only those addresses that routed to the local host are passed on.
30580 Without <option>no_more</option>, addresses that were declined for other reasons would also
30581 be passed to the next router.
30583 </listitem></varlistentry>
30585 <term><option>fail</option></term>
30588 Delivery fails and an error report is generated.
30590 </listitem></varlistentry>
30592 <term><option>send</option></term>
30595 <indexterm role="concept">
30596 <primary>local host</primary>
30597 <secondary>sending to</secondary>
30599 The anomaly is ignored and the address is queued for the transport. This
30600 setting should be used with extreme caution. For an <command>smtp</command> transport, it
30601 makes sense only in cases where the program that is listening on the SMTP port
30602 is not this version of Exim. That is, it must be some other MTA, or Exim with a
30603 different configuration file that handles the domain in another way.
30605 </listitem></varlistentry>
30608 <indexterm role="option">
30609 <primary><option>senders</option></primary>
30612 <informaltable frame="all">
30613 <tgroup cols="4" colsep="0" rowsep="0">
30614 <colspec colwidth="8*" align="left"/>
30615 <colspec colwidth="6*" align="center"/>
30616 <colspec colwidth="6*" align="center"/>
30617 <colspec colwidth="6*" align="right"/>
30620 <entry><option>senders</option></entry>
30621 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
30622 <entry>Type: <emphasis>address list</emphasis>†<emphasis></emphasis></entry>
30623 <entry>Default: <emphasis>unset</emphasis></entry>
30629 <indexterm role="concept">
30630 <primary>router</primary>
30631 <secondary>checking senders</secondary>
30633 If this option is set, the router is skipped unless the message’s sender
30634 address matches something on the list.
30635 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30639 There are issues concerning verification when the running of routers is
30640 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
30641 setting, it sets the sender to the null string. When using the <option>-bt</option> option
30642 to check a configuration file, it is necessary also to use the <option>-f</option> option to
30643 set an appropriate sender. For incoming mail, the sender is unset when
30644 verifying the sender, but is available when verifying any recipients. If the
30645 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
30649 <indexterm role="option">
30650 <primary><option>translate_ip_address</option></primary>
30653 <informaltable frame="all">
30654 <tgroup cols="4" colsep="0" rowsep="0">
30655 <colspec colwidth="8*" align="left"/>
30656 <colspec colwidth="6*" align="center"/>
30657 <colspec colwidth="6*" align="center"/>
30658 <colspec colwidth="6*" align="right"/>
30661 <entry><option>translate_ip_address</option></entry>
30662 <entry>Use: <emphasis>routers</emphasis></entry>
30663 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
30664 <entry>Default: <emphasis>unset</emphasis></entry>
30670 <indexterm role="concept">
30671 <primary>IP address</primary>
30672 <secondary>translating</secondary>
30674 <indexterm role="concept">
30675 <primary>packet radio</primary>
30677 <indexterm role="concept">
30678 <primary>router</primary>
30679 <secondary>IP address translation</secondary>
30681 There exist some rare networking situations (for example, packet radio) where
30682 it is helpful to be able to translate IP addresses generated by normal routing
30683 mechanisms into other IP addresses, thus performing a kind of manual IP
30684 routing. This should be done only if the normal IP routing of the TCP/IP stack
30685 is inadequate or broken. Because this is an extremely uncommon requirement, the
30686 code to support this option is not included in the Exim binary unless
30687 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
30690 <indexterm role="variable">
30691 <primary><varname>$host_address</varname></primary>
30693 The <option>translate_ip_address</option> string is expanded for every IP address generated
30694 by the router, with the generated address set in <varname>$host_address</varname>. If the
30695 expansion is forced to fail, no action is taken.
30696 For any other expansion error, delivery of the message is deferred.
30697 If the result of the expansion is an IP address, that replaces the original
30698 address; otherwise the result is assumed to be a host name – this is looked
30699 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
30700 produce one or more replacement IP addresses. For example, to subvert all IP
30701 addresses in some specific networks, this could be added to a router:
30703 <literallayout class="monospaced">
30704 translate_ip_address = \
30705 ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
30709 The file would contain lines like
30711 <literallayout class="monospaced">
30712 10.2.3.128/26 some.host
30713 10.8.4.34/26 10.44.8.15
30716 You should not make use of this facility unless you really understand what you
30720 <indexterm role="option">
30721 <primary><option>transport</option></primary>
30724 <informaltable frame="all">
30725 <tgroup cols="4" colsep="0" rowsep="0">
30726 <colspec colwidth="8*" align="left"/>
30727 <colspec colwidth="6*" align="center"/>
30728 <colspec colwidth="6*" align="center"/>
30729 <colspec colwidth="6*" align="right"/>
30732 <entry><option>transport</option></entry>
30733 <entry>Use: <emphasis>routers</emphasis></entry>
30734 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
30735 <entry>Default: <emphasis>unset</emphasis></entry>
30741 This option specifies the transport to be used when a router accepts an address
30742 and sets it up for delivery. A transport is never needed if a router is used
30743 only for verification. The value of the option is expanded at routing time,
30744 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
30745 and result must be the name of one of the configured transports. If it is not,
30746 delivery is deferred.
30749 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
30750 have some private options that set up transports for pipe and file deliveries
30751 (see chapter <xref linkend="CHAPredirect"/>).
30754 <indexterm role="option">
30755 <primary><option>transport_current_directory</option></primary>
30758 <informaltable frame="all">
30759 <tgroup cols="4" colsep="0" rowsep="0">
30760 <colspec colwidth="8*" align="left"/>
30761 <colspec colwidth="6*" align="center"/>
30762 <colspec colwidth="6*" align="center"/>
30763 <colspec colwidth="6*" align="right"/>
30766 <entry><option>transport_current_directory</option></entry>
30767 <entry>Use: <emphasis>routers</emphasis></entry>
30768 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
30769 <entry>Default: <emphasis>unset</emphasis></entry>
30775 <indexterm role="concept">
30776 <primary>current directory for local transport</primary>
30778 This option associates a current directory with any address that is routed
30779 to a local transport. This can happen either because a transport is
30780 explicitly configured for the router, or because it generates a delivery to a
30781 file or a pipe. During the delivery process (that is, at transport time), this
30782 option string is expanded and is set as the current directory, unless
30783 overridden by a setting on the transport.
30784 If the expansion fails for any reason, including forced failure, an error is
30785 logged, and delivery is deferred.
30786 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
30790 <indexterm role="option">
30791 <primary><option>transport_home_directory</option></primary>
30794 <informaltable frame="all">
30795 <tgroup cols="4" colsep="0" rowsep="0">
30796 <colspec colwidth="8*" align="left"/>
30797 <colspec colwidth="6*" align="center"/>
30798 <colspec colwidth="6*" align="center"/>
30799 <colspec colwidth="6*" align="right"/>
30802 <entry><option>transport_home_directory</option></entry>
30803 <entry>Use: <emphasis>routers</emphasis></entry>
30804 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
30805 <entry>Default: <emphasis>see below</emphasis></entry>
30811 <indexterm role="concept">
30812 <primary>home directory</primary>
30813 <secondary>for local transport</secondary>
30815 This option associates a home directory with any address that is routed to a
30816 local transport. This can happen either because a transport is explicitly
30817 configured for the router, or because it generates a delivery to a file or a
30818 pipe. During the delivery process (that is, at transport time), the option
30819 string is expanded and is set as the home directory, unless overridden by a
30820 setting of <option>home_directory</option> on the transport.
30821 If the expansion fails for any reason, including forced failure, an error is
30822 logged, and delivery is deferred.
30825 If the transport does not specify a home directory, and
30826 <option>transport_home_directory</option> is not set for the router, the home directory for
30827 the transport is taken from the password data if <option>check_local_user</option> is set for
30828 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
30829 is set; if not, no home directory is set for the transport.
30832 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
30836 <indexterm role="option">
30837 <primary><option>unseen</option></primary>
30840 <informaltable frame="all">
30841 <tgroup cols="4" colsep="0" rowsep="0">
30842 <colspec colwidth="8*" align="left"/>
30843 <colspec colwidth="6*" align="center"/>
30844 <colspec colwidth="6*" align="center"/>
30845 <colspec colwidth="6*" align="right"/>
30848 <entry><option>unseen</option></entry>
30849 <entry>Use: <emphasis>routers</emphasis></entry>
30850 <entry>Type: <emphasis>boolean</emphasis>†<emphasis></emphasis></entry>
30851 <entry>Default: <emphasis>false</emphasis></entry>
30857 <indexterm role="concept">
30858 <primary>router</primary>
30859 <secondary>carrying on after success</secondary>
30861 The result of string expansion for this option must be a valid boolean value,
30862 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
30863 result causes an error, and delivery is deferred. If the expansion is forced to
30864 fail, the default value for the option (false) is used. Other failures cause
30865 delivery to be deferred.
30868 When this option is set true, routing does not cease if the router accepts the
30869 address. Instead, a copy of the incoming address is passed to the next router,
30870 overriding a false setting of <option>more</option>. There is little point in setting
30871 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
30872 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
30873 sometimes true and sometimes false).
30876 <indexterm role="concept">
30877 <primary>copy of message (<option>unseen</option> option)</primary>
30879 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
30880 qualifier in filter files. It can be used to cause copies of messages to be
30881 delivered to some other destination, while also carrying out a normal delivery.
30882 In effect, the current address is made into a <quote>parent</quote> that has two children
30883 – one that is delivered as specified by this router, and a clone that goes on
30884 to be routed further. For this reason, <option>unseen</option> may not be combined with the
30885 <option>one_time</option> option in a <command>redirect</command> router.
30888 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
30889 this router or by previous routers affect the <quote>unseen</quote> copy of the message
30890 only. The clone that continues to be processed by further routers starts with
30891 no added headers and none specified for removal. For a <option>redirect</option> router, if
30892 a generated address is the same as the incoming address, this can lead to
30893 duplicate addresses with different header modifications. Exim does not do
30894 duplicate deliveries (except, in certain circumstances, to pipes -- see section
30895 <xref linkend="SECTdupaddr"/>), but it is undefined which of the duplicates is discarded,
30896 so this ambiguous situation should be avoided. The <option>repeat_use</option> option of the
30897 <option>redirect</option> router may be of help.
30900 Unlike the handling of header modifications, any data that was set by the
30901 <option>address_data</option> option in the current or previous routers <emphasis>is</emphasis> passed on to
30902 subsequent routers.
30905 <indexterm role="option">
30906 <primary><option>user</option></primary>
30909 <informaltable frame="all">
30910 <tgroup cols="4" colsep="0" rowsep="0">
30911 <colspec colwidth="8*" align="left"/>
30912 <colspec colwidth="6*" align="center"/>
30913 <colspec colwidth="6*" align="center"/>
30914 <colspec colwidth="6*" align="right"/>
30917 <entry><option>user</option></entry>
30918 <entry>Use: <emphasis>routers</emphasis></entry>
30919 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
30920 <entry>Default: <emphasis>see below</emphasis></entry>
30926 <indexterm role="concept">
30927 <primary>uid (user id)</primary>
30928 <secondary>local delivery</secondary>
30930 <indexterm role="concept">
30931 <primary>local transports</primary>
30932 <secondary>uid and gid</secondary>
30934 <indexterm role="concept">
30935 <primary>transport</primary>
30936 <secondary>local</secondary>
30938 <indexterm role="concept">
30939 <primary>router</primary>
30940 <secondary>user for filter processing</secondary>
30942 <indexterm role="concept">
30943 <primary>filter</primary>
30944 <secondary>user for processing</secondary>
30946 When a router queues an address for a transport, and the transport does not
30947 specify a user, the user given here is used when running the delivery process.
30948 The user may be specified numerically or by name. If expansion fails, the
30949 error is logged and delivery is deferred.
30950 This user is also used by the <command>redirect</command> router when running a filter file.
30951 The default is unset, except when <option>check_local_user</option> is set. In this case,
30952 the default is taken from the password information. If the user is specified as
30953 a name, and <option>group</option> is not set, the group associated with the user is used.
30954 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
30955 <xref linkend="CHAPenvironment"/>.
30958 <indexterm role="option">
30959 <primary><option>verify</option></primary>
30962 <informaltable frame="all">
30963 <tgroup cols="4" colsep="0" rowsep="0">
30964 <colspec colwidth="8*" align="left"/>
30965 <colspec colwidth="6*" align="center"/>
30966 <colspec colwidth="6*" align="center"/>
30967 <colspec colwidth="6*" align="right"/>
30970 <entry><option>verify</option></entry>
30971 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
30972 <entry>Type: <emphasis>boolean</emphasis></entry>
30973 <entry>Default: <emphasis>true</emphasis></entry>
30979 Setting this option has the effect of setting <option>verify_sender</option> and
30980 <option>verify_recipient</option> to the same value.
30983 <indexterm role="option">
30984 <primary><option>verify_only</option></primary>
30987 <informaltable frame="all">
30988 <tgroup cols="4" colsep="0" rowsep="0">
30989 <colspec colwidth="8*" align="left"/>
30990 <colspec colwidth="6*" align="center"/>
30991 <colspec colwidth="6*" align="center"/>
30992 <colspec colwidth="6*" align="right"/>
30995 <entry><option>verify_only</option></entry>
30996 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
30997 <entry>Type: <emphasis>boolean</emphasis></entry>
30998 <entry>Default: <emphasis>false</emphasis></entry>
31004 <indexterm role="concept">
31005 <primary>EXPN</primary>
31006 <secondary>with <option>verify_only</option></secondary>
31008 <indexterm role="option">
31009 <primary><option>-bv</option></primary>
31011 <indexterm role="concept">
31012 <primary>router</primary>
31013 <secondary>used only when verifying</secondary>
31015 If this option is set, the router is used only when verifying an address or
31016 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
31017 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
31018 restricted to verifying only senders or recipients by means of
31019 <option>verify_sender</option> and <option>verify_recipient</option>.
31022 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
31023 SMTP message, Exim is not running as root, but under its own uid. If the router
31024 accesses any files, you need to make sure that they are accessible to the Exim
31028 <indexterm role="option">
31029 <primary><option>verify_recipient</option></primary>
31032 <informaltable frame="all">
31033 <tgroup cols="4" colsep="0" rowsep="0">
31034 <colspec colwidth="8*" align="left"/>
31035 <colspec colwidth="6*" align="center"/>
31036 <colspec colwidth="6*" align="center"/>
31037 <colspec colwidth="6*" align="right"/>
31040 <entry><option>verify_recipient</option></entry>
31041 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
31042 <entry>Type: <emphasis>boolean</emphasis></entry>
31043 <entry>Default: <emphasis>true</emphasis></entry>
31049 If this option is false, the router is skipped when verifying recipient
31051 or testing recipient verification using <option>-bv</option>.
31052 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
31056 <indexterm role="option">
31057 <primary><option>verify_sender</option></primary>
31060 <informaltable frame="all">
31061 <tgroup cols="4" colsep="0" rowsep="0">
31062 <colspec colwidth="8*" align="left"/>
31063 <colspec colwidth="6*" align="center"/>
31064 <colspec colwidth="6*" align="center"/>
31065 <colspec colwidth="6*" align="right"/>
31068 <entry><option>verify_sender</option></entry>
31069 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
31070 <entry>Type: <emphasis>boolean</emphasis></entry>
31071 <entry>Default: <emphasis>true</emphasis></entry>
31077 If this option is false, the router is skipped when verifying sender addresses
31078 or testing sender verification using <option>-bvs</option>.
31079 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
31081 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
31082 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
31086 <chapter id="CHID4">
31087 <title>The accept router</title>
31089 <indexterm role="concept">
31090 <primary><command>accept</command> router</primary>
31092 <indexterm role="concept">
31093 <primary>routers</primary>
31094 <secondary><command>accept</command></secondary>
31096 The <command>accept</command> router has no private options of its own. Unless it is being
31097 used purely for verification (see <option>verify_only</option>) a transport is required to
31098 be defined by the generic <option>transport</option> option. If the preconditions that are
31099 specified by generic options are met, the router accepts the address and queues
31100 it for the given transport. The most common use of this router is for setting
31101 up deliveries to local mailboxes. For example:
31103 <literallayout class="monospaced">
31106 domains = mydomain.example
31108 transport = local_delivery
31111 The <option>domains</option> condition in this example checks the domain of the address, and
31112 <option>check_local_user</option> checks that the local part is the login of a local user.
31113 When both preconditions are met, the <command>accept</command> router runs, and queues the
31114 address for the <command>local_delivery</command> transport.
31118 <chapter id="CHAPdnslookup">
31119 <title>The dnslookup router</title>
31121 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
31122 <primary><command>dnslookup</command> router</primary>
31124 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
31125 <primary>routers</primary>
31126 <secondary><command>dnslookup</command></secondary>
31128 The <command>dnslookup</command> router looks up the hosts that handle mail for the
31129 recipient’s domain in the DNS. A transport must always be set for this router,
31130 unless <option>verify_only</option> is set.
31133 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
31134 SRV records. If none are found, or if SRV support is not configured,
31135 MX records are looked up. If no MX records exist, address records are sought.
31136 However, <option>mx_domains</option> can be set to disable the direct use of address
31140 MX records of equal priority are sorted by Exim into a random order. Exim then
31141 looks for address records for the host names obtained from MX or SRV records.
31142 When a host has more than one IP address, they are sorted into a random order,
31143 except that IPv6 addresses are always sorted before IPv4 addresses. If all the
31144 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
31145 generic option, the router declines.
31148 Unless they have the highest priority (lowest MX value), MX records that point
31149 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
31150 are discarded, together with any other MX records of equal or lower priority.
31153 <indexterm role="concept">
31154 <primary>MX record</primary>
31155 <secondary>pointing to local host</secondary>
31157 <indexterm role="concept">
31158 <primary>local host</primary>
31159 <secondary>MX pointing to</secondary>
31161 <indexterm role="option">
31162 <primary><option>self</option></primary>
31163 <secondary>in <command>dnslookup</command> router</secondary>
31165 If the host pointed to by the highest priority MX record, or looked up as an
31166 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
31167 happens is controlled by the generic <option>self</option> option.
31169 <section id="SECTprowitdnsloo">
31170 <title>Problems with DNS lookups</title>
31172 There have been problems with DNS servers when SRV records are looked up.
31173 Some mis-behaving servers return a DNS error or timeout when a non-existent
31174 SRV record is sought. Similar problems have in the past been reported for
31175 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
31176 problem, but it is heavy-handed because it is a global option.
31179 For this reason, there are two options, <option>srv_fail_domains</option> and
31180 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
31181 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
31182 an attempt to look up an SRV or MX record causes one of these results, and the
31183 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
31184 such record</quote>. In the case of an SRV lookup, this means that the router
31185 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
31186 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
31187 case routing fails.
31190 <section id="SECID118">
31191 <title>Private options for dnslookup</title>
31193 <indexterm role="concept">
31194 <primary>options</primary>
31195 <secondary><command>dnslookup</command> router</secondary>
31197 The private options for the <command>dnslookup</command> router are as follows:
31200 <indexterm role="option">
31201 <primary><option>check_secondary_mx</option></primary>
31204 <informaltable frame="all">
31205 <tgroup cols="4" colsep="0" rowsep="0">
31206 <colspec colwidth="8*" align="left"/>
31207 <colspec colwidth="6*" align="center"/>
31208 <colspec colwidth="6*" align="center"/>
31209 <colspec colwidth="6*" align="right"/>
31212 <entry><option>check_secondary_mx</option></entry>
31213 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31214 <entry>Type: <emphasis>boolean</emphasis></entry>
31215 <entry>Default: <emphasis>false</emphasis></entry>
31221 <indexterm role="concept">
31222 <primary>MX record</primary>
31223 <secondary>checking for secondary</secondary>
31225 If this option is set, the router declines unless the local host is found in
31226 (and removed from) the list of hosts obtained by MX lookup. This can be used to
31227 process domains for which the local host is a secondary mail exchanger
31228 differently to other domains. The way in which Exim decides whether a host is
31229 the local host is described in section <xref linkend="SECTreclocipadd"/>.
31232 <indexterm role="option">
31233 <primary><option>check_srv</option></primary>
31236 <informaltable frame="all">
31237 <tgroup cols="4" colsep="0" rowsep="0">
31238 <colspec colwidth="8*" align="left"/>
31239 <colspec colwidth="6*" align="center"/>
31240 <colspec colwidth="6*" align="center"/>
31241 <colspec colwidth="6*" align="right"/>
31244 <entry><option>check_srv</option></entry>
31245 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31246 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
31247 <entry>Default: <emphasis>unset</emphasis></entry>
31253 <indexterm role="concept">
31254 <primary>SRV record</primary>
31255 <secondary>enabling use of</secondary>
31257 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
31258 addition to MX and address records. The support is disabled by default. To
31259 enable SRV support, set the <option>check_srv</option> option to the name of the service
31260 required. For example,
31262 <literallayout class="monospaced">
31266 looks for SRV records that refer to the normal smtp service. The option is
31267 expanded, so the service name can vary from message to message or address
31268 to address. This might be helpful if SRV records are being used for a
31269 submission service. If the expansion is forced to fail, the <option>check_srv</option>
31270 option is ignored, and the router proceeds to look for MX records in the
31274 When the expansion succeeds, the router searches first for SRV records for
31275 the given service (it assumes TCP protocol). A single SRV record with a
31276 host name that consists of just a single dot indicates <quote>no such service for
31277 this domain</quote>; if this is encountered, the router declines. If other kinds of
31278 SRV record are found, they are used to construct a host list for delivery
31279 according to the rules of RFC 2782. MX records are not sought in this case.
31282 When no SRV records are found, MX records (and address records) are sought in
31283 the traditional way. In other words, SRV records take precedence over MX
31284 records, just as MX records take precedence over address records. Note that
31285 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
31286 defined it. It is apparently believed that MX records are sufficient for email
31287 and that SRV records should not be used for this purpose. However, SRV records
31288 have an additional <quote>weight</quote> feature which some people might find useful when
31289 trying to split an SMTP load between hosts of different power.
31292 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim’s behaviour
31293 when there is a DNS lookup error.
31296 <indexterm role="option">
31297 <primary><option>mx_domains</option></primary>
31300 <informaltable frame="all">
31301 <tgroup cols="4" colsep="0" rowsep="0">
31302 <colspec colwidth="8*" align="left"/>
31303 <colspec colwidth="6*" align="center"/>
31304 <colspec colwidth="6*" align="center"/>
31305 <colspec colwidth="6*" align="right"/>
31308 <entry><option>mx_domains</option></entry>
31309 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31310 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
31311 <entry>Default: <emphasis>unset</emphasis></entry>
31317 <indexterm role="concept">
31318 <primary>MX record</primary>
31319 <secondary>required to exist</secondary>
31321 <indexterm role="concept">
31322 <primary>SRV record</primary>
31323 <secondary>required to exist</secondary>
31325 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
31326 record in order to be recognized. (The name of this option could be improved.)
31327 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
31328 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
31331 <literallayout class="monospaced">
31332 mx_domains = ! *.discworld.fict.example : *.fict.example
31335 This specifies that messages addressed to a domain that matches the list but
31336 has no MX record should be bounced immediately instead of being routed using
31337 the address record.
31340 <indexterm role="option">
31341 <primary><option>mx_fail_domains</option></primary>
31344 <informaltable frame="all">
31345 <tgroup cols="4" colsep="0" rowsep="0">
31346 <colspec colwidth="8*" align="left"/>
31347 <colspec colwidth="6*" align="center"/>
31348 <colspec colwidth="6*" align="center"/>
31349 <colspec colwidth="6*" align="right"/>
31352 <entry><option>mx_fail_domains</option></entry>
31353 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31354 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
31355 <entry>Default: <emphasis>unset</emphasis></entry>
31361 If the DNS lookup for MX records for one of the domains in this list causes a
31362 DNS lookup error, Exim behaves as if no MX records were found. See section
31363 <xref linkend="SECTprowitdnsloo"/> for more discussion.
31366 <indexterm role="option">
31367 <primary><option>qualify_single</option></primary>
31370 <informaltable frame="all">
31371 <tgroup cols="4" colsep="0" rowsep="0">
31372 <colspec colwidth="8*" align="left"/>
31373 <colspec colwidth="6*" align="center"/>
31374 <colspec colwidth="6*" align="center"/>
31375 <colspec colwidth="6*" align="right"/>
31378 <entry><option>qualify_single</option></entry>
31379 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31380 <entry>Type: <emphasis>boolean</emphasis></entry>
31381 <entry>Default: <emphasis>true</emphasis></entry>
31387 <indexterm role="concept">
31388 <primary>DNS</primary>
31389 <secondary>resolver options</secondary>
31391 <indexterm role="concept">
31392 <primary>DNS</primary>
31393 <secondary>qualifying single-component names</secondary>
31395 When this option is true, the resolver option RES_DEFNAMES is set for DNS
31396 lookups. Typically, but not standardly, this causes the resolver to qualify
31397 single-component names with the default domain. For example, on a machine
31398 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
31399 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
31400 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
31401 <emphasis>resolv.conf</emphasis>.
31404 <indexterm role="option">
31405 <primary><option>rewrite_headers</option></primary>
31408 <informaltable frame="all">
31409 <tgroup cols="4" colsep="0" rowsep="0">
31410 <colspec colwidth="8*" align="left"/>
31411 <colspec colwidth="6*" align="center"/>
31412 <colspec colwidth="6*" align="center"/>
31413 <colspec colwidth="6*" align="right"/>
31416 <entry><option>rewrite_headers</option></entry>
31417 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31418 <entry>Type: <emphasis>boolean</emphasis></entry>
31419 <entry>Default: <emphasis>true</emphasis></entry>
31425 <indexterm role="concept">
31426 <primary>rewriting</primary>
31427 <secondary>header lines</secondary>
31429 <indexterm role="concept">
31430 <primary>header lines</primary>
31431 <secondary>rewriting</secondary>
31433 If the domain name in the address that is being processed is not fully
31434 qualified, it may be expanded to its full form by a DNS lookup. For example, if
31435 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
31436 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
31437 occur as a result of setting the <option>widen_domains</option> option. If
31438 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
31439 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
31440 header lines of the message are rewritten with the full domain name.
31443 This option should be turned off only when it is known that no message is
31444 ever going to be sent outside an environment where the abbreviation makes
31448 When an MX record is looked up in the DNS and matches a wildcard record, name
31449 servers normally return a record containing the name that has been looked up,
31450 making it impossible to detect whether a wildcard was present or not. However,
31451 some name servers have recently been seen to return the wildcard entry. If the
31452 name returned by a DNS lookup begins with an asterisk, it is not used for
31456 <indexterm role="option">
31457 <primary><option>same_domain_copy_routing</option></primary>
31460 <informaltable frame="all">
31461 <tgroup cols="4" colsep="0" rowsep="0">
31462 <colspec colwidth="8*" align="left"/>
31463 <colspec colwidth="6*" align="center"/>
31464 <colspec colwidth="6*" align="center"/>
31465 <colspec colwidth="6*" align="right"/>
31468 <entry><option>same_domain_copy_routing</option></entry>
31469 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31470 <entry>Type: <emphasis>boolean</emphasis></entry>
31471 <entry>Default: <emphasis>false</emphasis></entry>
31477 <indexterm role="concept">
31478 <primary>address</primary>
31479 <secondary>copying routing</secondary>
31481 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
31482 to the same list of hosts. However, this cannot be presumed, because the router
31483 options and preconditions may refer to the local part of the address. By
31484 default, therefore, Exim routes each address in a message independently. DNS
31485 servers run caches, so repeated DNS lookups are not normally expensive, and in
31486 any case, personal messages rarely have more than a few recipients.
31489 If you are running mailing lists with large numbers of subscribers at the same
31490 domain, and you are using a <command>dnslookup</command> router which is independent of the
31491 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
31492 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
31493 routes an address to a remote transport, any other unrouted addresses in the
31494 message that have the same domain are automatically given the same routing
31495 without processing them independently,
31496 provided the following conditions are met:
31501 No router that processed the address specified <option>headers_add</option> or
31502 <option>headers_remove</option>.
31507 The router did not change the address in any way, for example, by <quote>widening</quote>
31513 <indexterm role="option">
31514 <primary><option>search_parents</option></primary>
31517 <informaltable frame="all">
31518 <tgroup cols="4" colsep="0" rowsep="0">
31519 <colspec colwidth="8*" align="left"/>
31520 <colspec colwidth="6*" align="center"/>
31521 <colspec colwidth="6*" align="center"/>
31522 <colspec colwidth="6*" align="right"/>
31525 <entry><option>search_parents</option></entry>
31526 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31527 <entry>Type: <emphasis>boolean</emphasis></entry>
31528 <entry>Default: <emphasis>false</emphasis></entry>
31534 <indexterm role="concept">
31535 <primary>DNS</primary>
31536 <secondary>resolver options</secondary>
31538 When this option is true, the resolver option RES_DNSRCH is set for DNS
31539 lookups. This is different from the <option>qualify_single</option> option in that it
31540 applies to domains containing dots. Typically, but not standardly, it causes
31541 the resolver to search for the name in the current domain and in parent
31542 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
31543 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
31544 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
31545 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
31548 Setting this option true can cause problems in domains that have a wildcard MX
31549 record, because any domain that does not have its own MX record matches the
31553 <indexterm role="option">
31554 <primary><option>srv_fail_domains</option></primary>
31557 <informaltable frame="all">
31558 <tgroup cols="4" colsep="0" rowsep="0">
31559 <colspec colwidth="8*" align="left"/>
31560 <colspec colwidth="6*" align="center"/>
31561 <colspec colwidth="6*" align="center"/>
31562 <colspec colwidth="6*" align="right"/>
31565 <entry><option>srv_fail_domains</option></entry>
31566 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31567 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
31568 <entry>Default: <emphasis>unset</emphasis></entry>
31574 If the DNS lookup for SRV records for one of the domains in this list causes a
31575 DNS lookup error, Exim behaves as if no SRV records were found. See section
31576 <xref linkend="SECTprowitdnsloo"/> for more discussion.
31579 <indexterm role="option">
31580 <primary><option>widen_domains</option></primary>
31583 <informaltable frame="all">
31584 <tgroup cols="4" colsep="0" rowsep="0">
31585 <colspec colwidth="8*" align="left"/>
31586 <colspec colwidth="6*" align="center"/>
31587 <colspec colwidth="6*" align="center"/>
31588 <colspec colwidth="6*" align="right"/>
31591 <entry><option>widen_domains</option></entry>
31592 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31593 <entry>Type: <emphasis>string list</emphasis></entry>
31594 <entry>Default: <emphasis>unset</emphasis></entry>
31600 <indexterm role="concept">
31601 <primary>domain</primary>
31602 <secondary>partial; widening</secondary>
31604 If a DNS lookup fails and this option is set, each of its strings in turn is
31605 added onto the end of the domain, and the lookup is tried again. For example,
31608 <literallayout class="monospaced">
31609 widen_domains = fict.example:ref.example
31612 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
31613 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
31614 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
31615 and <option>search_parents</option> options can cause some widening to be undertaken inside
31616 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
31617 when verifying, unless <option>rewrite_headers</option> is false (not the default).
31620 <section id="SECID119">
31621 <title>Effect of qualify_single and search_parents</title>
31623 When a domain from an envelope recipient is changed by the resolver as a result
31624 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
31625 corresponding address in the message’s header lines unless <option>rewrite_headers</option>
31626 is set false. Exim then re-routes the address, using the full domain.
31629 These two options affect only the DNS lookup that takes place inside the router
31630 for the domain of the address that is being routed. They do not affect lookups
31631 such as that implied by
31633 <literallayout class="monospaced">
31637 that may happen while processing a router precondition before the router is
31638 entered. No widening ever takes place for these lookups.
31639 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
31640 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
31645 <chapter id="CHID5">
31646 <title>The ipliteral router</title>
31648 <indexterm role="concept">
31649 <primary><command>ipliteral</command> router</primary>
31651 <indexterm role="concept">
31652 <primary>domain literal</primary>
31653 <secondary>routing</secondary>
31655 <indexterm role="concept">
31656 <primary>routers</primary>
31657 <secondary><command>ipliteral</command></secondary>
31659 This router has no private options. Unless it is being used purely for
31660 verification (see <option>verify_only</option>) a transport is required to be defined by the
31661 generic <option>transport</option> option. The router accepts the address if its domain part
31662 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
31663 router handles the address
31665 <literallayout class="monospaced">
31669 by setting up delivery to the host with that IP address. IPv4 domain literals
31670 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
31671 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
31673 <literallayout class="monospaced">
31674 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
31677 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
31678 grounds that sooner or later somebody will try it.
31681 <indexterm role="option">
31682 <primary><option>self</option></primary>
31683 <secondary>in <command>ipliteral</command> router</secondary>
31685 If the IP address matches something in <option>ignore_target_hosts</option>, the router
31686 declines. If an IP literal turns out to refer to the local host, the generic
31687 <option>self</option> option determines what happens.
31690 The RFCs require support for domain literals; however, their use is
31691 controversial in today’s Internet. If you want to use this router, you must
31692 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
31693 Exim will not recognize the domain literal syntax in addresses.
31697 <chapter id="CHID6">
31698 <title>The iplookup router</title>
31700 <indexterm role="concept">
31701 <primary><command>iplookup</command> router</primary>
31703 <indexterm role="concept">
31704 <primary>routers</primary>
31705 <secondary><command>iplookup</command></secondary>
31707 The <command>iplookup</command> router was written to fulfil a specific requirement in
31708 Cambridge University (which in fact no longer exists). For this reason, it is
31709 not included in the binary of Exim by default. If you want to include it, you
31712 <literallayout class="monospaced">
31713 ROUTER_IPLOOKUP=yes
31716 in your <filename>Local/Makefile</filename> configuration file.
31719 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
31720 connection to one or more specific hosts. The host can then return the same or
31721 a different address – in effect rewriting the recipient address in the
31722 message’s envelope. The new address is then passed on to subsequent routers. If
31723 this process fails, the address can be passed on to other routers, or delivery
31724 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
31725 must not be specified for it.
31728 <indexterm role="concept">
31729 <primary>options</primary>
31730 <secondary><command>iplookup</command> router</secondary>
31732 <indexterm role="option">
31733 <primary><option>hosts</option></primary>
31736 <informaltable frame="all">
31737 <tgroup cols="4" colsep="0" rowsep="0">
31738 <colspec colwidth="8*" align="left"/>
31739 <colspec colwidth="6*" align="center"/>
31740 <colspec colwidth="6*" align="center"/>
31741 <colspec colwidth="6*" align="right"/>
31744 <entry><option>hosts</option></entry>
31745 <entry>Use: <emphasis>iplookup</emphasis></entry>
31746 <entry>Type: <emphasis>string</emphasis></entry>
31747 <entry>Default: <emphasis>unset</emphasis></entry>
31753 This option must be supplied. Its value is a colon-separated list of host
31754 names. The hosts are looked up using <function>gethostbyname()</function>
31755 (or <function>getipnodebyname()</function> when available)
31756 and are tried in order until one responds to the query. If none respond, what
31757 happens is controlled by <option>optional</option>.
31760 <indexterm role="option">
31761 <primary><option>optional</option></primary>
31764 <informaltable frame="all">
31765 <tgroup cols="4" colsep="0" rowsep="0">
31766 <colspec colwidth="8*" align="left"/>
31767 <colspec colwidth="6*" align="center"/>
31768 <colspec colwidth="6*" align="center"/>
31769 <colspec colwidth="6*" align="right"/>
31772 <entry><option>optional</option></entry>
31773 <entry>Use: <emphasis>iplookup</emphasis></entry>
31774 <entry>Type: <emphasis>boolean</emphasis></entry>
31775 <entry>Default: <emphasis>false</emphasis></entry>
31781 If <option>optional</option> is true, if no response is obtained from any host, the address
31782 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
31783 delivery to the address is deferred.
31786 <indexterm role="option">
31787 <primary><option>port</option></primary>
31790 <informaltable frame="all">
31791 <tgroup cols="4" colsep="0" rowsep="0">
31792 <colspec colwidth="8*" align="left"/>
31793 <colspec colwidth="6*" align="center"/>
31794 <colspec colwidth="6*" align="center"/>
31795 <colspec colwidth="6*" align="right"/>
31798 <entry><option>port</option></entry>
31799 <entry>Use: <emphasis>iplookup</emphasis></entry>
31800 <entry>Type: <emphasis>integer</emphasis></entry>
31801 <entry>Default: <emphasis>0</emphasis></entry>
31807 <indexterm role="concept">
31808 <primary>port</primary>
31809 <secondary><command>iplookup</command> router</secondary>
31811 This option must be supplied. It specifies the port number for the TCP or UDP
31815 <indexterm role="option">
31816 <primary><option>protocol</option></primary>
31819 <informaltable frame="all">
31820 <tgroup cols="4" colsep="0" rowsep="0">
31821 <colspec colwidth="8*" align="left"/>
31822 <colspec colwidth="6*" align="center"/>
31823 <colspec colwidth="6*" align="center"/>
31824 <colspec colwidth="6*" align="right"/>
31827 <entry><option>protocol</option></entry>
31828 <entry>Use: <emphasis>iplookup</emphasis></entry>
31829 <entry>Type: <emphasis>string</emphasis></entry>
31830 <entry>Default: <emphasis>udp</emphasis></entry>
31836 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
31837 protocols is to be used.
31840 <indexterm role="option">
31841 <primary><option>query</option></primary>
31844 <informaltable frame="all">
31845 <tgroup cols="4" colsep="0" rowsep="0">
31846 <colspec colwidth="8*" align="left"/>
31847 <colspec colwidth="6*" align="center"/>
31848 <colspec colwidth="6*" align="center"/>
31849 <colspec colwidth="6*" align="right"/>
31852 <entry><option>query</option></entry>
31853 <entry>Use: <emphasis>iplookup</emphasis></entry>
31854 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
31855 <entry>Default: <emphasis>see below</emphasis></entry>
31861 This defines the content of the query that is sent to the remote hosts. The
31864 <literallayout class="monospaced">
31865 $local_part@$domain $local_part@$domain
31868 The repetition serves as a way of checking that a response is to the correct
31869 query in the default case (see <option>response_pattern</option> below).
31872 <indexterm role="option">
31873 <primary><option>reroute</option></primary>
31876 <informaltable frame="all">
31877 <tgroup cols="4" colsep="0" rowsep="0">
31878 <colspec colwidth="8*" align="left"/>
31879 <colspec colwidth="6*" align="center"/>
31880 <colspec colwidth="6*" align="center"/>
31881 <colspec colwidth="6*" align="right"/>
31884 <entry><option>reroute</option></entry>
31885 <entry>Use: <emphasis>iplookup</emphasis></entry>
31886 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
31887 <entry>Default: <emphasis>unset</emphasis></entry>
31893 If this option is not set, the rerouted address is precisely the byte string
31894 returned by the remote host, up to the first white space, if any. If set, the
31895 string is expanded to form the rerouted address. It can include parts matched
31896 in the response by <option>response_pattern</option> by means of numeric variables such as
31897 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
31898 whether or not a pattern is in use. In all cases, the rerouted address must end
31899 up in the form <emphasis>local_part@domain</emphasis>.
31902 <indexterm role="option">
31903 <primary><option>response_pattern</option></primary>
31906 <informaltable frame="all">
31907 <tgroup cols="4" colsep="0" rowsep="0">
31908 <colspec colwidth="8*" align="left"/>
31909 <colspec colwidth="6*" align="center"/>
31910 <colspec colwidth="6*" align="center"/>
31911 <colspec colwidth="6*" align="right"/>
31914 <entry><option>response_pattern</option></entry>
31915 <entry>Use: <emphasis>iplookup</emphasis></entry>
31916 <entry>Type: <emphasis>string</emphasis></entry>
31917 <entry>Default: <emphasis>unset</emphasis></entry>
31923 This option can be set to a regular expression that is applied to the string
31924 returned from the remote host. If the pattern does not match the response, the
31925 router declines. If <option>response_pattern</option> is not set, no checking of the
31926 response is done, unless the query was defaulted, in which case there is a
31927 check that the text returned after the first white space is the original
31928 address. This checks that the answer that has been received is in response to
31929 the correct question. For example, if the response is just a new domain, the
31930 following could be used:
31932 <literallayout class="monospaced">
31933 response_pattern = ^([^@]+)$
31934 reroute = $local_part@$1
31937 <indexterm role="option">
31938 <primary><option>timeout</option></primary>
31941 <informaltable frame="all">
31942 <tgroup cols="4" colsep="0" rowsep="0">
31943 <colspec colwidth="8*" align="left"/>
31944 <colspec colwidth="6*" align="center"/>
31945 <colspec colwidth="6*" align="center"/>
31946 <colspec colwidth="6*" align="right"/>
31949 <entry><option>timeout</option></entry>
31950 <entry>Use: <emphasis>iplookup</emphasis></entry>
31951 <entry>Type: <emphasis>time</emphasis></entry>
31952 <entry>Default: <emphasis>5s</emphasis></entry>
31958 This specifies the amount of time to wait for a response from the remote
31959 machine. The same timeout is used for the <function>connect()</function> function for a TCP
31960 call. It does not apply to UDP.
31964 <chapter id="CHID7">
31965 <title>The manualroute router</title>
31967 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
31968 <primary><command>manualroute</command> router</primary>
31970 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
31971 <primary>routers</primary>
31972 <secondary><command>manualroute</command></secondary>
31974 <indexterm role="concept">
31975 <primary>domain</primary>
31976 <secondary>manually routing</secondary>
31978 The <command>manualroute</command> router is so-called because it provides a way of manually
31979 routing an address according to its domain. It is mainly used when you want to
31980 route addresses to remote hosts according to your own rules, bypassing the
31981 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
31982 route to local transports, a facility that may be useful if you want to save
31983 messages for dial-in hosts in local files.
31986 The <command>manualroute</command> router compares a list of domain patterns with the domain
31987 it is trying to route. If there is no match, the router declines. Each pattern
31988 has associated with it a list of hosts and some other optional data, which may
31989 include a transport. The combination of a pattern and its data is called a
31990 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
31991 generic <option>transport</option> option must specify a transport, unless the router is
31992 being used purely for verification (see <option>verify_only</option>).
31995 <indexterm role="variable">
31996 <primary><varname>$host</varname></primary>
31998 In the case of verification, matching the domain pattern is sufficient for the
31999 router to accept the address. When actually routing an address for delivery,
32000 an address that matches a domain pattern is queued for the associated
32001 transport. If the transport is not a local one, a host list must be associated
32002 with the pattern; IP addresses are looked up for the hosts, and these are
32003 passed to the transport along with the mail address. For local transports, a
32004 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
32008 The list of routing rules can be provided as an inline string in
32009 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
32010 or database by setting <option>route_data</option>. Only one of these settings may appear in
32011 any one instance of <command>manualroute</command>. The format of routing rules is described
32012 below, following the list of private options.
32014 <section id="SECTprioptman">
32015 <title>Private options for manualroute</title>
32017 <indexterm role="concept">
32018 <primary>options</primary>
32019 <secondary><command>manualroute</command> router</secondary>
32021 The private options for the <command>manualroute</command> router are as follows:
32024 <indexterm role="option">
32025 <primary><option>host_all_ignored</option></primary>
32028 <informaltable frame="all">
32029 <tgroup cols="4" colsep="0" rowsep="0">
32030 <colspec colwidth="8*" align="left"/>
32031 <colspec colwidth="6*" align="center"/>
32032 <colspec colwidth="6*" align="center"/>
32033 <colspec colwidth="6*" align="right"/>
32036 <entry><option>host_all_ignored</option></entry>
32037 <entry>Use: <emphasis>manualroute</emphasis></entry>
32038 <entry>Type: <emphasis>string</emphasis></entry>
32039 <entry>Default: <emphasis>defer</emphasis></entry>
32045 See <option>host_find_failed</option>.
32048 <indexterm role="option">
32049 <primary><option>host_find_failed</option></primary>
32052 <informaltable frame="all">
32053 <tgroup cols="4" colsep="0" rowsep="0">
32054 <colspec colwidth="8*" align="left"/>
32055 <colspec colwidth="6*" align="center"/>
32056 <colspec colwidth="6*" align="center"/>
32057 <colspec colwidth="6*" align="right"/>
32060 <entry><option>host_find_failed</option></entry>
32061 <entry>Use: <emphasis>manualroute</emphasis></entry>
32062 <entry>Type: <emphasis>string</emphasis></entry>
32063 <entry>Default: <emphasis>freeze</emphasis></entry>
32069 This option controls what happens when <command>manualroute</command> tries to find an IP
32070 address for a host, and the host does not exist. The option can be set to one
32071 of the following values:
32073 <literallayout class="monospaced">
32082 The default (<quote>freeze</quote>) assumes that this state is a serious configuration
32083 error. The difference between <quote>pass</quote> and <quote>decline</quote> is that the former
32084 forces the address to be passed to the next router (or the router defined by
32085 <option>pass_router</option>),
32086 <indexterm role="option">
32087 <primary><option>more</option></primary>
32089 overriding <option>no_more</option>, whereas the latter passes the address to the next
32090 router only if <option>more</option> is true.
32093 The value <quote>ignore</quote> causes Exim to completely ignore a host whose IP address
32094 cannot be found. If all the hosts in the list are ignored, the behaviour is
32095 controlled by the <option>host_all_ignored</option> option. This takes the same values
32096 as <option>host_find_failed</option>, except that it cannot be set to <quote>ignore</quote>.
32099 The <option>host_find_failed</option> option applies only to a definite <quote>does not exist</quote>
32100 state; if a host lookup gets a temporary error, delivery is deferred unless the
32101 generic <option>pass_on_timeout</option> option is set.
32104 <indexterm role="option">
32105 <primary><option>hosts_randomize</option></primary>
32108 <informaltable frame="all">
32109 <tgroup cols="4" colsep="0" rowsep="0">
32110 <colspec colwidth="8*" align="left"/>
32111 <colspec colwidth="6*" align="center"/>
32112 <colspec colwidth="6*" align="center"/>
32113 <colspec colwidth="6*" align="right"/>
32116 <entry><option>hosts_randomize</option></entry>
32117 <entry>Use: <emphasis>manualroute</emphasis></entry>
32118 <entry>Type: <emphasis>boolean</emphasis></entry>
32119 <entry>Default: <emphasis>false</emphasis></entry>
32125 <indexterm role="concept">
32126 <primary>randomized host list</primary>
32128 <indexterm role="concept">
32129 <primary>host</primary>
32130 <secondary>list of; randomized</secondary>
32132 If this option is set, the order of the items in a host list in a routing rule
32133 is randomized each time the list is used, unless an option in the routing rule
32134 overrides (see below). Randomizing the order of a host list can be used to do
32135 crude load sharing. However, if more than one mail address is routed by the
32136 same router to the same host list, the host lists are considered to be the same
32137 (even though they may be randomized into different orders) for the purpose of
32138 deciding whether to batch the deliveries into a single SMTP transaction.
32141 When <option>hosts_randomize</option> is true, a host list may be split
32142 into groups whose order is separately randomized. This makes it possible to
32143 set up MX-like behaviour. The boundaries between groups are indicated by an
32144 item that is just <literal>+</literal> in the host list. For example:
32146 <literallayout class="monospaced">
32147 route_list = * host1:host2:host3:+:host4:host5
32150 The order of the first three hosts and the order of the last two hosts is
32151 randomized for each use, but the first three always end up before the last two.
32152 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
32153 randomized host list is passed to an <command>smtp</command> transport that also has
32154 <option>hosts_randomize set</option>, the list is not re-randomized.
32157 <indexterm role="option">
32158 <primary><option>route_data</option></primary>
32161 <informaltable frame="all">
32162 <tgroup cols="4" colsep="0" rowsep="0">
32163 <colspec colwidth="8*" align="left"/>
32164 <colspec colwidth="6*" align="center"/>
32165 <colspec colwidth="6*" align="center"/>
32166 <colspec colwidth="6*" align="right"/>
32169 <entry><option>route_data</option></entry>
32170 <entry>Use: <emphasis>manualroute</emphasis></entry>
32171 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
32172 <entry>Default: <emphasis>unset</emphasis></entry>
32178 If this option is set, it must expand to yield the data part of a routing rule.
32179 Typically, the expansion string includes a lookup based on the domain. For
32182 <literallayout class="monospaced">
32183 route_data = ${lookup{$domain}dbm{/etc/routes}}
32186 If the expansion is forced to fail, or the result is an empty string, the
32187 router declines. Other kinds of expansion failure cause delivery to be
32191 <indexterm role="option">
32192 <primary><option>route_list</option></primary>
32195 <informaltable frame="all">
32196 <tgroup cols="4" colsep="0" rowsep="0">
32197 <colspec colwidth="8*" align="left"/>
32198 <colspec colwidth="6*" align="center"/>
32199 <colspec colwidth="6*" align="center"/>
32200 <colspec colwidth="6*" align="right"/>
32203 <entry><option>route_list</option></entry>
32204 <entry>Use: <emphasis>manualroute</emphasis></entry>
32205 <entry>Type: <emphasis>string list</emphasis></entry>
32206 <entry>Default: <emphasis>unset</emphasis></entry>
32212 This string is a list of routing rules, in the form defined below. Note that,
32213 unlike most string lists, the items are separated by semicolons. This is so
32214 that they may contain colon-separated host lists.
32217 <indexterm role="option">
32218 <primary><option>same_domain_copy_routing</option></primary>
32221 <informaltable frame="all">
32222 <tgroup cols="4" colsep="0" rowsep="0">
32223 <colspec colwidth="8*" align="left"/>
32224 <colspec colwidth="6*" align="center"/>
32225 <colspec colwidth="6*" align="center"/>
32226 <colspec colwidth="6*" align="right"/>
32229 <entry><option>same_domain_copy_routing</option></entry>
32230 <entry>Use: <emphasis>manualroute</emphasis></entry>
32231 <entry>Type: <emphasis>boolean</emphasis></entry>
32232 <entry>Default: <emphasis>false</emphasis></entry>
32238 <indexterm role="concept">
32239 <primary>address</primary>
32240 <secondary>copying routing</secondary>
32242 Addresses with the same domain are normally routed by the <command>manualroute</command>
32243 router to the same list of hosts. However, this cannot be presumed, because the
32244 router options and preconditions may refer to the local part of the address. By
32245 default, therefore, Exim routes each address in a message independently. DNS
32246 servers run caches, so repeated DNS lookups are not normally expensive, and in
32247 any case, personal messages rarely have more than a few recipients.
32250 If you are running mailing lists with large numbers of subscribers at the same
32251 domain, and you are using a <command>manualroute</command> router which is independent of the
32252 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
32253 lookups for identical domains in one message. In this case, when
32254 <command>manualroute</command> routes an address to a remote transport, any other unrouted
32255 addresses in the message that have the same domain are automatically given the
32256 same routing without processing them independently. However, this is only done
32257 if <option>headers_add</option> and <option>headers_remove</option> are unset.
32260 <section id="SECID120">
32261 <title>Routing rules in route_list</title>
32263 The value of <option>route_list</option> is a string consisting of a sequence of routing
32264 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
32265 entered as two semicolons. Alternatively, the list separator can be changed as
32266 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
32267 Empty rules are ignored. The format of each rule is
32270 <<emphasis>domain pattern</emphasis>> <<emphasis>list of hosts</emphasis>> <<emphasis>options</emphasis>>
32273 The following example contains two rules, each with a simple domain pattern and
32276 <literallayout class="monospaced">
32278 dict.ref.example mail-1.ref.example:mail-2.ref.example ; \
32279 thes.ref.example mail-3.ref.example:mail-4.ref.example
32282 The three parts of a rule are separated by white space. The pattern and the
32283 list of hosts can be enclosed in quotes if necessary, and if they are, the
32284 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
32285 single domain pattern, which is the only mandatory item in the rule. The
32286 pattern is in the same format as one item in a domain list (see section
32287 <xref linkend="SECTdomainlist"/>),
32288 except that it may not be the name of an interpolated file.
32289 That is, it may be wildcarded, or a regular expression, or a file or database
32290 lookup (with semicolons doubled, because of the use of semicolon as a separator
32291 in a <option>route_list</option>).
32294 The rules in <option>route_list</option> are searched in order until one of the patterns
32295 matches the domain that is being routed. The list of hosts and then options are
32296 then used as described below. If there is no match, the router declines. When
32297 <option>route_list</option> is set, <option>route_data</option> must not be set.
32300 <section id="SECID121">
32301 <title>Routing rules in route_data</title>
32303 The use of <option>route_list</option> is convenient when there are only a small number of
32304 routing rules. For larger numbers, it is easier to use a file or database to
32305 hold the routing information, and use the <option>route_data</option> option instead.
32306 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
32307 Most commonly, <option>route_data</option> is set as a string that contains an
32308 expansion lookup. For example, suppose we place two routing rules in a file
32311 <literallayout class="monospaced">
32312 dict.ref.example: mail-1.ref.example:mail-2.ref.example
32313 thes.ref.example: mail-3.ref.example:mail-4.ref.example
32316 This data can be accessed by setting
32318 <literallayout class="monospaced">
32319 route_data = ${lookup{$domain}lsearch{/the/file/name}}
32322 Failure of the lookup results in an empty string, causing the router to
32323 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
32324 requirement is that the result of expanding the string is a list of hosts,
32325 possibly followed by options, separated by white space. The list of hosts must
32326 be enclosed in quotes if it contains white space.
32329 <section id="SECID122">
32330 <title>Format of the list of hosts</title>
32332 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
32333 always separately expanded before use. If the expansion fails, the router
32334 declines. The result of the expansion must be a colon-separated list of names
32335 and/or IP addresses, optionally also including ports. The format of each item
32336 in the list is described in the next section. The list separator can be changed
32337 as described in section <xref linkend="SECTlistconstruct"/>.
32340 If the list of hosts was obtained from a <option>route_list</option> item, the following
32341 variables are set during its expansion:
32346 <indexterm role="concept">
32347 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
32348 <secondary>in <command>manualroute</command> router</secondary>
32350 If the domain was matched against a regular expression, the numeric variables
32351 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
32353 <literallayout class="monospaced">
32354 route_list = ^domain(\d+) host-$1.text.example
32359 <varname>$0</varname> is always set to the entire domain.
32364 <varname>$1</varname> is also set when partial matching is done in a file lookup.
32369 <indexterm role="variable">
32370 <primary><varname>$value</varname></primary>
32372 If the pattern that matched the domain was a lookup item, the data that was
32373 looked up is available in the expansion variable <varname>$value</varname>. For example:
32375 <literallayout class="monospaced">
32376 route_list = lsearch;;/some/file.routes $value
32381 Note the doubling of the semicolon in the pattern that is necessary because
32382 semicolon is the default route list separator.
32385 <section id="SECTformatonehostitem">
32386 <title>Format of one host item</title>
32388 Each item in the list of hosts is either a host name or an IP address,
32389 optionally with an attached port number. When no port is given, an IP address
32390 is not enclosed in brackets. When a port is specified, it overrides the port
32391 specification on the transport. The port is separated from the name or address
32392 by a colon. This leads to some complications:
32397 Because colon is the default separator for the list of hosts, either
32398 the colon that specifies a port must be doubled, or the list separator must
32399 be changed. The following two examples have the same effect:
32401 <literallayout class="monospaced">
32402 route_list = * "host1.tld::1225 : host2.tld::1226"
32403 route_list = * "<+ host1.tld:1225 + host2.tld:1226"
32408 When IPv6 addresses are involved, it gets worse, because they contain
32409 colons of their own. To make this case easier, it is permitted to
32410 enclose an IP address (either v4 or v6) in square brackets if a port
32411 number follows. For example:
32413 <literallayout class="monospaced">
32414 route_list = * "</ [10.1.1.1]:1225 / [::1]:1226"
32419 <section id="SECThostshowused">
32420 <title>How the list of hosts is used</title>
32422 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
32423 the hosts is tried, in the order specified, when carrying out the SMTP
32424 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
32425 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
32429 Hosts may be listed by name or by IP address. An unadorned name in the list of
32430 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
32431 interpreted as an indirection to a sublist of hosts obtained by looking up MX
32432 records in the DNS. For example:
32434 <literallayout class="monospaced">
32435 route_list = * x.y.z:p.q.r/MX:e.f.g
32438 If this feature is used with a port specifier, the port must come last. For
32441 <literallayout class="monospaced">
32442 route_list = * dom1.tld/mx::1225
32445 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
32446 randomized before any lookups are done. Exim then scans the list; for any name
32447 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
32448 be an interface on the local host and the item is not the first in the list,
32449 Exim discards it and any subsequent items. If it is the first item, what
32450 happens is controlled by the
32451 <indexterm role="option">
32452 <primary><option>self</option></primary>
32453 <secondary>in <command>manualroute</command> router</secondary>
32455 <option>self</option> option of the router.
32458 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
32459 hosts obtained by looking up MX records for the name. This is always a DNS
32460 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
32461 below) are not relevant here. The order of these hosts is determined by the
32462 preference values in the MX records, according to the usual rules. Because
32463 randomizing happens before the MX lookup, it does not affect the order that is
32464 defined by MX preferences.
32467 If the local host is present in the sublist obtained from MX records, but is
32468 not the most preferred host in that list, it and any equally or less
32469 preferred hosts are removed before the sublist is inserted into the main list.
32472 If the local host is the most preferred host in the MX list, what happens
32473 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
32474 is not the first item (that is, there are previous hosts in the main list),
32475 Exim discards this name and any subsequent items in the main list.
32478 If the MX item is first in the list of hosts, and the local host is the
32479 most preferred host, what happens is controlled by the <option>self</option> option of the
32483 DNS failures when lookup up the MX records are treated in the same way as DNS
32484 failures when looking up IP addresses: <option>pass_on_timeout</option> and
32485 <option>host_find_failed</option> are used when relevant.
32488 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
32489 whether obtained from an MX lookup or not.
32492 <section id="SECThowoptused">
32493 <title>How the options are used</title>
32495 The options are a sequence of words; in practice no more than three are ever
32496 present. One of the words can be the name of a transport; this overrides the
32497 <option>transport</option> option on the router for this particular routing rule only. The
32498 other words (if present) control randomization of the list of hosts on a
32499 per-rule basis, and how the IP addresses of the hosts are to be found when
32500 routing to a remote transport. These options are as follows:
32505 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
32506 setting of <option>hosts_randomize</option> for this routing rule only.
32511 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
32512 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
32517 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
32518 find IP addresses. This function may ultimately cause a DNS lookup, but it may
32519 also look in <filename>/etc/hosts</filename> or other sources of information.
32524 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
32525 no address records are found. If there is a temporary DNS error (such as a
32526 timeout), delivery is deferred.
32533 <literallayout class="monospaced">
32534 route_list = domain1 host1:host2:host3 randomize bydns;\
32535 domain2 host4:host5
32538 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
32539 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
32540 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
32541 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
32545 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
32546 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
32547 instead of TRY_AGAIN. That is why the default action is to try a DNS
32548 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
32552 If no IP address for a host can be found, what happens is controlled by the
32553 <option>host_find_failed</option> option.
32556 <indexterm role="variable">
32557 <primary><varname>$host</varname></primary>
32559 When an address is routed to a local transport, IP addresses are not looked up.
32560 The host list is passed to the transport in the <varname>$host</varname> variable.
32563 <section id="SECID123">
32564 <title>Manualroute examples</title>
32566 In some of the examples that follow, the presence of the <option>remote_smtp</option>
32567 transport, as defined in the default configuration file, is assumed:
32572 <indexterm role="concept">
32573 <primary>smart host</primary>
32574 <secondary>example router</secondary>
32576 The <command>manualroute</command> router can be used to forward all external mail to a
32577 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
32578 named domain list that contains your local domains, for example:
32580 <literallayout class="monospaced">
32581 domainlist local_domains = my.domain.example
32584 You can arrange for all other domains to be routed to a smart host by making
32585 your first router something like this:
32587 <literallayout class="monospaced">
32589 driver = manualroute
32590 domains = !+local_domains
32591 transport = remote_smtp
32592 route_list = * smarthost.ref.example
32595 This causes all non-local addresses to be sent to the single host
32596 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
32597 they are tried in order
32598 (but you can use <option>hosts_randomize</option> to vary the order each time).
32599 Another way of configuring the same thing is this:
32601 <literallayout class="monospaced">
32603 driver = manualroute
32604 transport = remote_smtp
32605 route_list = !+local_domains smarthost.ref.example
32608 There is no difference in behaviour between these two routers as they stand.
32609 However, they behave differently if <option>no_more</option> is added to them. In the first
32610 example, the router is skipped if the domain does not match the <option>domains</option>
32611 precondition; the following router is always tried. If the router runs, it
32612 always matches the domain and so can never decline. Therefore, <option>no_more</option>
32613 would have no effect. In the second case, the router is never skipped; it
32614 always runs. However, if it doesn’t match the domain, it declines. In this case
32615 <option>no_more</option> would prevent subsequent routers from running.
32620 <indexterm role="concept">
32621 <primary>mail hub example</primary>
32623 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
32624 records in the DNS and delivers it via its own private routing mechanism. Often
32625 the final destinations are behind a firewall, with the mail hub being the one
32626 machine that can connect to machines both inside and outside the firewall. The
32627 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
32628 to the correct hosts. For a small number of domains, the routing can be inline,
32629 using the <option>route_list</option> option, but for a larger number a file or database
32630 lookup is easier to manage.
32633 If the domain names are in fact the names of the machines to which the mail is
32634 to be sent by the mail hub, the configuration can be quite simple. For
32637 <literallayout class="monospaced">
32639 driver = manualroute
32640 transport = remote_smtp
32641 route_list = *.rhodes.tvs.example $domain
32644 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
32645 whose names are the same as the mail domains. A similar approach can be taken
32646 if the host name can be obtained from the domain name by a string manipulation
32647 that the expansion facilities can handle. Otherwise, a lookup based on the
32648 domain can be used to find the host:
32650 <literallayout class="monospaced">
32652 driver = manualroute
32653 transport = remote_smtp
32654 route_data = ${lookup {$domain} cdb {/internal/host/routes}}
32657 The result of the lookup must be the name or IP address of the host (or
32658 hosts) to which the address is to be routed. If the lookup fails, the route
32659 data is empty, causing the router to decline. The address then passes to the
32665 <indexterm role="concept">
32666 <primary>batched SMTP output example</primary>
32668 <indexterm role="concept">
32669 <primary>SMTP</primary>
32670 <secondary>batched outgoing; example</secondary>
32672 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
32673 SMTP format for onward transportation by some other means. This is one way of
32674 storing mail for a dial-up host when it is not connected. The route list entry
32675 can be as simple as a single domain name in a configuration like this:
32677 <literallayout class="monospaced">
32679 driver = manualroute
32680 transport = batchsmtp_appendfile
32681 route_list = saved.domain.example
32684 though often a pattern is used to pick up more than one domain. If there are
32685 several domains or groups of domains with different transport requirements,
32686 different transports can be listed in the routing information:
32688 <literallayout class="monospaced">
32690 driver = manualroute
32692 *.saved.domain1.example $domain batch_appendfile; \
32693 *.saved.domain2.example \
32694 ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
32698 <indexterm role="variable">
32699 <primary><varname>$domain</varname></primary>
32701 <indexterm role="variable">
32702 <primary><varname>$host</varname></primary>
32704 The first of these just passes the domain in the <varname>$host</varname> variable, which
32705 doesn’t achieve much (since it is also in <varname>$domain</varname>), but the second does a
32706 file lookup to find a value to pass, causing the router to decline to handle
32707 the address if the lookup fails.
32712 <indexterm role="concept">
32713 <primary>UUCP</primary>
32714 <secondary>example of router for</secondary>
32716 Routing mail directly to UUCP software is a specific case of the use of
32717 <command>manualroute</command> in a gateway to another mail environment. This is an example of
32718 one way it can be done:
32720 <literallayout class="monospaced">
32725 command = /usr/local/bin/uux -r - \
32726 ${substr_-5:$host}!rmail ${local_part}
32727 return_fail_output = true
32732 driver = manualroute
32734 ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
32737 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
32739 <literallayout class="monospaced">
32740 darksite.ethereal.example: darksite.UUCP
32743 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
32744 makes clear the distinction between the domain name
32745 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
32750 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
32751 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
32756 <chapter id="CHAPdriverlast">
32757 <title>The queryprogram router</title>
32759 <indexterm role="concept" id="IIDquerou1" class="startofrange">
32760 <primary><command>queryprogram</command> router</primary>
32762 <indexterm role="concept" id="IIDquerou2" class="startofrange">
32763 <primary>routers</primary>
32764 <secondary><command>queryprogram</command></secondary>
32766 <indexterm role="concept">
32767 <primary>routing</primary>
32768 <secondary>by external program</secondary>
32770 The <command>queryprogram</command> router routes an address by running an external command
32771 and acting on its output. This is an expensive way to route, and is intended
32772 mainly for use in lightly-loaded systems, or for performing experiments.
32773 However, if it is possible to use the precondition options (<option>domains</option>,
32774 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
32775 be used in special cases, even on a busy host. There are the following private
32777 <indexterm role="concept">
32778 <primary>options</primary>
32779 <secondary><command>queryprogram</command> router</secondary>
32783 <indexterm role="option">
32784 <primary><option>command</option></primary>
32787 <informaltable frame="all">
32788 <tgroup cols="4" colsep="0" rowsep="0">
32789 <colspec colwidth="8*" align="left"/>
32790 <colspec colwidth="6*" align="center"/>
32791 <colspec colwidth="6*" align="center"/>
32792 <colspec colwidth="6*" align="right"/>
32795 <entry><option>command</option></entry>
32796 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32797 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
32798 <entry>Default: <emphasis>unset</emphasis></entry>
32804 This option must be set. It specifies the command that is to be run. The
32805 command is split up into a command name and arguments, and then each is
32806 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
32807 <xref linkend="CHAPpipetransport"/>).
32810 <indexterm role="option">
32811 <primary><option>command_group</option></primary>
32814 <informaltable frame="all">
32815 <tgroup cols="4" colsep="0" rowsep="0">
32816 <colspec colwidth="8*" align="left"/>
32817 <colspec colwidth="6*" align="center"/>
32818 <colspec colwidth="6*" align="center"/>
32819 <colspec colwidth="6*" align="right"/>
32822 <entry><option>command_group</option></entry>
32823 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32824 <entry>Type: <emphasis>string</emphasis></entry>
32825 <entry>Default: <emphasis>unset</emphasis></entry>
32831 <indexterm role="concept">
32832 <primary>gid (group id)</primary>
32833 <secondary>in <command>queryprogram</command> router</secondary>
32835 This option specifies a gid to be set when running the command while routing an
32836 address for deliver. It must be set if <option>command_user</option> specifies a numerical
32837 uid. If it begins with a digit, it is interpreted as the numerical value of the
32838 gid. Otherwise it is looked up using <function>getgrnam()</function>.
32841 <indexterm role="option">
32842 <primary><option>command_user</option></primary>
32845 <informaltable frame="all">
32846 <tgroup cols="4" colsep="0" rowsep="0">
32847 <colspec colwidth="8*" align="left"/>
32848 <colspec colwidth="6*" align="center"/>
32849 <colspec colwidth="6*" align="center"/>
32850 <colspec colwidth="6*" align="right"/>
32853 <entry><option>command_user</option></entry>
32854 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32855 <entry>Type: <emphasis>string</emphasis></entry>
32856 <entry>Default: <emphasis>unset</emphasis></entry>
32862 <indexterm role="concept">
32863 <primary>uid (user id)</primary>
32864 <secondary>for <command>queryprogram</command></secondary>
32866 This option must be set. It specifies the uid which is set when running the
32867 command while routing an address for delivery. If the value begins with a digit,
32868 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
32869 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
32870 not set, a value for the gid also.
32873 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
32874 root, which it does during a normal delivery in a conventional configuration.
32875 However, when an address is being verified during message reception, Exim is
32876 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
32877 is called from a non-root process, Exim cannot change uid or gid before running
32878 the command. In this circumstance the command runs under the current uid and
32882 <indexterm role="option">
32883 <primary><option>current_directory</option></primary>
32886 <informaltable frame="all">
32887 <tgroup cols="4" colsep="0" rowsep="0">
32888 <colspec colwidth="8*" align="left"/>
32889 <colspec colwidth="6*" align="center"/>
32890 <colspec colwidth="6*" align="center"/>
32891 <colspec colwidth="6*" align="right"/>
32894 <entry><option>current_directory</option></entry>
32895 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32896 <entry>Type: <emphasis>string</emphasis></entry>
32897 <entry>Default: <emphasis>/</emphasis></entry>
32903 This option specifies an absolute path which is made the current directory
32904 before running the command.
32907 <indexterm role="option">
32908 <primary><option>timeout</option></primary>
32911 <informaltable frame="all">
32912 <tgroup cols="4" colsep="0" rowsep="0">
32913 <colspec colwidth="8*" align="left"/>
32914 <colspec colwidth="6*" align="center"/>
32915 <colspec colwidth="6*" align="center"/>
32916 <colspec colwidth="6*" align="right"/>
32919 <entry><option>timeout</option></entry>
32920 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32921 <entry>Type: <emphasis>time</emphasis></entry>
32922 <entry>Default: <emphasis>1h</emphasis></entry>
32928 If the command does not complete within the timeout period, its process group
32929 is killed and the message is frozen. A value of zero time specifies no
32933 The standard output of the command is connected to a pipe, which is read when
32934 the command terminates. It should consist of a single line of output,
32935 containing up to five fields, separated by white space. The maximum length of
32936 the line is 1023 characters. Longer lines are silently truncated. The first
32937 field is one of the following words (case-insensitive):
32942 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
32948 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
32949 <option>no_more</option> is set.
32954 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
32955 subsequent text on the line is an error message. If the router is run as part
32956 of address verification during an incoming SMTP message, the message is
32957 included in the SMTP response.
32962 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
32963 subsequent text on the line is an error message which is logged. It is not
32964 included in any SMTP response.
32969 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
32974 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
32975 <option>pass_router</option>), overriding <option>no_more</option>.
32980 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
32981 new addresses, which are routed independently, starting with the first router,
32982 or the router specified by <option>redirect_router</option>, if set.
32987 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
32988 number of keyed data values, as follows (split into two lines here, to fit on
32991 <literallayout class="monospaced">
32992 ACCEPT TRANSPORT=<transport> HOSTS=<list of hosts>
32993 LOOKUP=byname|bydns DATA=<text>
32996 The data items can be given in any order, and all are optional. If no transport
32997 is included, the transport specified by the generic <option>transport</option> option is
32998 used. The list of hosts and the lookup type are needed only if the transport is
32999 an <command>smtp</command> transport that does not itself supply a list of hosts.
33002 The format of the list of hosts is the same as for the <command>manualroute</command> router.
33003 As well as host names and IP addresses with optional port numbers, as described
33004 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
33005 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
33006 (see section <xref linkend="SECThostshowused"/>).
33009 If the lookup type is not specified, Exim behaves as follows when trying to
33010 find an IP address for each host: First, a DNS lookup is done. If this yields
33011 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
33012 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
33013 result of the lookup is the result of that call.
33016 <indexterm role="variable">
33017 <primary><varname>$address_data</varname></primary>
33019 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
33020 variable. For example, this return line
33022 <literallayout class="monospaced">
33023 accept hosts=x1.y.example:x2.y.example data="rule1"
33026 routes the address to the default transport, passing a list of two hosts. When
33027 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
33028 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
33029 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
33033 <chapter id="CHAPredirect">
33034 <title>The redirect router</title>
33036 <indexterm role="concept" id="IIDredrou1" class="startofrange">
33037 <primary><command>redirect</command> router</primary>
33039 <indexterm role="concept" id="IIDredrou2" class="startofrange">
33040 <primary>routers</primary>
33041 <secondary><command>redirect</command></secondary>
33043 <indexterm role="concept">
33044 <primary>alias file</primary>
33045 <secondary>in a <command>redirect</command> router</secondary>
33047 <indexterm role="concept">
33048 <primary>address redirection</primary>
33049 <secondary><command>redirect</command> router</secondary>
33051 The <command>redirect</command> router handles several kinds of address redirection. Its most
33052 common uses are for resolving local part aliases from a central alias file
33053 (usually called <filename>/etc/aliases</filename>) and for handling users’ personal <filename>.forward</filename>
33054 files, but it has many other potential uses. The incoming address can be
33055 redirected in several different ways:
33060 It can be replaced by one or more new addresses which are themselves routed
33066 It can be routed to be delivered to a given file or directory.
33071 It can be routed to be delivered to a specified pipe command.
33076 It can cause an automatic reply to be generated.
33081 It can be forced to fail, optionally with a custom error message.
33086 It can be temporarily deferred, optionally with a custom message.
33091 It can be discarded.
33096 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
33097 However, there are some private options which define transports for delivery to
33098 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
33099 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
33101 <section id="SECID124">
33102 <title>Redirection data</title>
33104 The router operates by interpreting a text string which it obtains either by
33105 expanding the contents of the <option>data</option> option, or by reading the entire
33106 contents of a file whose name is given in the <option>file</option> option. These two
33107 options are mutually exclusive. The first is commonly used for handling system
33108 aliases, in a configuration like this:
33110 <literallayout class="monospaced">
33113 data = ${lookup{$local_part}lsearch{/etc/aliases}}
33116 If the lookup fails, the expanded string in this example is empty. When the
33117 expansion of <option>data</option> results in an empty string, the router declines. A forced
33118 expansion failure also causes the router to decline; other expansion failures
33119 cause delivery to be deferred.
33122 A configuration using <option>file</option> is commonly used for handling users’
33123 <filename>.forward</filename> files, like this:
33125 <literallayout class="monospaced">
33129 file = $home/.forward
33133 If the file does not exist, or causes no action to be taken (for example, it is
33134 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
33135 is not the case when the file contains syntactically valid items that happen to
33136 yield empty addresses, for example, items containing only RFC 2822 address
33140 <section id="SECID125">
33141 <title>Forward files and address verification</title>
33143 <indexterm role="concept">
33144 <primary>address redirection</primary>
33145 <secondary>while verifying</secondary>
33147 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users’
33148 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
33153 When Exim is receiving an incoming SMTP message from a remote host, it is
33154 running under the Exim uid, not as root. Exim is unable to change uid to read
33155 the file as the user, and it may not be able to read it as the Exim user. So in
33156 practice the router may not be able to operate.
33161 However, even when the router can operate, the existence of a <filename>.forward</filename> file
33162 is unimportant when verifying an address. What should be checked is whether the
33163 local part is a valid user name or not. Cutting out the redirection processing
33164 saves some resources.
33169 <section id="SECID126">
33170 <title>Interpreting redirection data</title>
33172 <indexterm role="concept">
33173 <primary>Sieve filter</primary>
33174 <secondary>specifying in redirection data</secondary>
33176 <indexterm role="concept">
33177 <primary>filter</primary>
33178 <secondary>specifying in redirection data</secondary>
33180 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
33181 can be interpreted in two different ways:
33186 If the <option>allow_filter</option> option is set true, and the data begins with the text
33187 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
33188 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
33189 respectively. Details of the syntax and semantics of filter files are described
33190 in a separate document entitled <emphasis>Exim’s interfaces to mail filtering</emphasis>; this
33191 document is intended for use by end users.
33196 Otherwise, the data must be a comma-separated list of redirection items, as
33197 described in the next section.
33202 When a message is redirected to a file (a <quote>mail folder</quote>), the file name given
33203 in a non-filter redirection list must always be an absolute path. A filter may
33204 generate a relative path – how this is handled depends on the transport’s
33205 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
33206 for the <command>appendfile</command> transport.
33209 <section id="SECTitenonfilred">
33210 <title>Items in a non-filter redirection list</title>
33212 <indexterm role="concept">
33213 <primary>address redirection</primary>
33214 <secondary>non-filter list items</secondary>
33216 When the redirection data is not an Exim or Sieve filter, for example, if it
33217 comes from a conventional alias or forward file, it consists of a list of
33218 addresses, file names, pipe commands, or certain special items (see section
33219 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
33220 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
33221 depending on their default values. The items in the list are separated by
33222 commas or newlines.
33223 If a comma is required in an item, the entire item must be enclosed in double
33227 Lines starting with a # character are comments, and are ignored, and # may
33228 also appear following a comma, in which case everything between the # and the
33229 next newline character is ignored.
33232 If an item is entirely enclosed in double quotes, these are removed. Otherwise
33233 double quotes are retained because some forms of mail address require their use
33234 (but never to enclose the entire address). In the following description,
33235 <quote>item</quote> refers to what remains after any surrounding double quotes have been
33239 <indexterm role="variable">
33240 <primary><varname>$local_part</varname></primary>
33242 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
33243 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
33244 of the <option>quote_local_part</option> expansion operator, in case the local part contains
33245 special characters. For example, to redirect all mail for the domain
33246 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
33249 <literallayout class="monospaced">
33250 data = ${quote_local_part:$local_part}@newdomain.example
33253 <section id="SECTredlocmai">
33254 <title>Redirecting to a local mailbox</title>
33256 <indexterm role="concept">
33257 <primary>routing</primary>
33258 <secondary>loops in</secondary>
33260 <indexterm role="concept">
33261 <primary>loop</primary>
33262 <secondary>while routing, avoidance of</secondary>
33264 <indexterm role="concept">
33265 <primary>address redirection</primary>
33266 <secondary>to local mailbox</secondary>
33268 A redirection item may safely be the same as the address currently under
33269 consideration. This does not cause a routing loop, because a router is
33270 automatically skipped if any ancestor of the address that is being processed
33271 is the same as the current address and was processed by the current router.
33272 Such an address is therefore passed to the following routers, so it is handled
33273 as if there were no redirection. When making this loop-avoidance test, the
33274 complete local part, including any prefix or suffix, is used.
33277 <indexterm role="concept">
33278 <primary>address redirection</primary>
33279 <secondary>local part without domain</secondary>
33281 Specifying the same local part without a domain is a common usage in personal
33282 filter files when the user wants to have messages delivered to the local
33283 mailbox and also forwarded elsewhere. For example, the user whose login is
33284 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
33286 <literallayout class="monospaced">
33287 cleo, cleopatra@egypt.example
33290 <indexterm role="concept">
33291 <primary>backslash in alias file</primary>
33293 <indexterm role="concept">
33294 <primary>alias file</primary>
33295 <secondary>backslash in</secondary>
33297 For compatibility with other MTAs, such unqualified local parts may be
33298 preceded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
33299 it does make a difference if more than one domain is being handled
33303 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
33304 2822 address that does not include a domain, the item is qualified using the
33305 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
33306 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
33307 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
33310 Care must be taken if there are alias names for local users.
33311 Consider an MTA handling a single local domain where the system alias file
33314 <literallayout class="monospaced">
33318 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
33319 messages in the local mailbox, and also forward copies elsewhere. He creates
33322 <literallayout class="monospaced">
33323 Sam.Reman, spqr@reme.elsewhere.example
33326 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
33327 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
33328 second time round, because it has previously routed it,
33329 and the following routers presumably cannot handle the alias. The forward file
33330 should really contain
33332 <literallayout class="monospaced">
33333 spqr, spqr@reme.elsewhere.example
33336 but because this is such a common error, the <option>check_ancestor</option> option (see
33337 below) exists to provide a way to get round it. This is normally set on a
33338 <command>redirect</command> router that is handling users’ <filename>.forward</filename> files.
33341 <section id="SECTspecitredli">
33342 <title>Special items in redirection lists</title>
33344 In addition to addresses, the following types of item may appear in redirection
33345 lists (that is, in non-filter redirection data):
33350 <indexterm role="concept">
33351 <primary>pipe</primary>
33352 <secondary>in redirection list</secondary>
33354 <indexterm role="concept">
33355 <primary>address redirection</primary>
33356 <secondary>to pipe</secondary>
33358 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
33359 as a valid RFC 2822 address that includes a domain. A transport for running the
33360 command must be specified by the <option>pipe_transport</option> option.
33361 Normally, either the router or the transport specifies a user and a group under
33362 which to run the delivery. The default is to use the Exim user and group.
33365 Single or double quotes can be used for enclosing the individual arguments of
33366 the pipe command; no interpretation of escapes is done for single quotes. If
33367 the command contains a comma character, it is necessary to put the whole item
33368 in double quotes, for example:
33370 <literallayout class="monospaced">
33371 "|/some/command ready,steady,go"
33374 since items in redirection lists are terminated by commas. Do not, however,
33375 quote just the command. An item such as
33377 <literallayout class="monospaced">
33378 |"/some/command ready,steady,go"
33381 is interpreted as a pipe with a rather strange command name, and no arguments.
33386 <indexterm role="concept">
33387 <primary>file</primary>
33388 <secondary>in redirection list</secondary>
33390 <indexterm role="concept">
33391 <primary>address redirection</primary>
33392 <secondary>to file</secondary>
33394 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
33395 parse as a valid RFC 2822 address that includes a domain. For example,
33397 <literallayout class="monospaced">
33398 /home/world/minbari
33401 is treated as a file name, but
33403 <literallayout class="monospaced">
33404 /s=molari/o=babylon/@x400gate.way
33407 is treated as an address. For a file name, a transport must be specified using
33408 the <option>file_transport</option> option. However, if the generated path name ends with a
33409 forward slash character, it is interpreted as a directory name rather than a
33410 file name, and <option>directory_transport</option> is used instead.
33413 Normally, either the router or the transport specifies a user and a group under
33414 which to run the delivery. The default is to use the Exim user and group.
33417 <indexterm role="concept">
33418 <primary><filename>/dev/null</filename></primary>
33420 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
33421 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
33422 instead of a transport name. In this case the user and group are not used.
33427 <indexterm role="concept">
33428 <primary>included address list</primary>
33430 <indexterm role="concept">
33431 <primary>address redirection</primary>
33432 <secondary>included external list</secondary>
33434 If an item is of the form
33436 <literallayout class="monospaced">
33437 :include:<path name>
33440 a list of further items is taken from the given file and included at that
33441 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
33442 out-of-line addition to the list. The items in the included list are separated
33443 by commas or newlines and are not subject to expansion. If this is the first
33444 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
33445 the alias name. This example is incorrect:
33447 <literallayout class="monospaced">
33448 list1 :include:/opt/lists/list1
33451 It must be given as
33453 <literallayout class="monospaced">
33454 list1: :include:/opt/lists/list1
33459 <indexterm role="concept">
33460 <primary>address redirection</primary>
33461 <secondary>to black hole</secondary>
33463 Sometimes you want to throw away mail to a particular local part. Making the
33464 <option>data</option> option expand to an empty string does not work, because that causes
33465 the router to decline. Instead, the alias item
33466 <indexterm role="concept">
33467 <primary>black hole</primary>
33469 <indexterm role="concept">
33470 <primary>abandoning mail</primary>
33472 <emphasis>:blackhole:</emphasis> can be used. It does what its name implies. No delivery is
33473 done, and no error message is generated. This has the same effect as specifing
33474 <filename>/dev/null</filename> as a destination, but it can be independently disabled.
33477 <emphasis role="bold">Warning</emphasis>: If <emphasis>:blackhole:</emphasis> appears anywhere in a redirection list, no
33478 delivery is done for the original local part, even if other redirection items
33479 are present. If you are generating a multi-item list (for example, by reading a
33480 database) and need the ability to provide a no-op item, you must use
33481 <filename>/dev/null</filename>.
33486 <indexterm role="concept">
33487 <primary>delivery</primary>
33488 <secondary>forcing failure</secondary>
33490 <indexterm role="concept">
33491 <primary>delivery</primary>
33492 <secondary>forcing deferral</secondary>
33494 <indexterm role="concept">
33495 <primary>failing delivery</primary>
33496 <secondary>forcing</secondary>
33498 <indexterm role="concept">
33499 <primary>deferred delivery, forcing</primary>
33501 <indexterm role="concept">
33502 <primary>customizing</primary>
33503 <secondary>failure message</secondary>
33505 An attempt to deliver a particular address can be deferred or forced to fail by
33506 redirection items of the form
33508 <literallayout class="monospaced">
33513 respectively. When a redirection list contains such an item, it applies
33514 to the entire redirection; any other items in the list are ignored. Any
33515 text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error text
33516 associated with the failure. For example, an alias file might contain:
33518 <literallayout class="monospaced">
33519 X.Employee: :fail: Gone away, no forwarding address
33522 In the case of an address that is being verified from an ACL or as the subject
33524 <indexterm role="concept">
33525 <primary>VRFY</primary>
33526 <secondary>error text, display of</secondary>
33528 VRFY command, the text is included in the SMTP error response by
33530 <indexterm role="concept">
33531 <primary>EXPN</primary>
33532 <secondary>error text, display of</secondary>
33534 The text is not included in the response to an EXPN command. In non-SMTP cases
33535 the text is included in the error message that Exim generates.
33538 <indexterm role="concept">
33539 <primary>SMTP</primary>
33540 <secondary>error codes</secondary>
33542 By default, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
33543 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
33544 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
33545 followed by a space, and the very first digit is the same as the default error
33546 code, the code from the message is used instead. If the very first digit is
33547 incorrect, a panic error is logged, and the default code is used. You can
33548 suppress the use of the supplied code in a redirect router by setting the
33549 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
33553 <indexterm role="variable">
33554 <primary><varname>$acl_verify_message</varname></primary>
33556 In an ACL, an explicitly provided message overrides the default, but the
33557 default message is available in the variable <varname>$acl_verify_message</varname> and can
33558 therefore be included in a custom message if this is desired.
33561 Normally the error text is the rest of the redirection list – a comma does
33562 not terminate it – but a newline does act as a terminator. Newlines are not
33563 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
33564 as part of the continuation process, but they may exist in other kinds of
33565 lookup and in <emphasis>:include:</emphasis> files.
33568 During routing for message delivery (as opposed to verification), a redirection
33569 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
33570 whereas <emphasis>:defer:</emphasis> causes the message to remain on the queue so that a
33571 subsequent delivery attempt can happen at a later time. If an address is
33572 deferred for too long, it will ultimately fail, because the normal retry
33578 <indexterm role="concept">
33579 <primary>alias file</primary>
33580 <secondary>exception to default</secondary>
33582 Sometimes it is useful to use a single-key search type with a default (see
33583 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
33584 for exceptions to the default. These can be handled by aliasing them to
33585 <emphasis>:unknown:</emphasis>. This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command>
33586 router to decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which
33587 results in an empty redirection list has the same effect.
33592 <section id="SECTdupaddr">
33593 <title>Duplicate addresses</title>
33595 <indexterm role="concept">
33596 <primary>duplicate addresses</primary>
33598 <indexterm role="concept">
33599 <primary>address duplicate, discarding</primary>
33601 <indexterm role="concept">
33602 <primary>pipe</primary>
33603 <secondary>duplicated</secondary>
33605 Exim removes duplicate addresses from the list to which it is delivering, so as
33606 to deliver just one copy to each address. This does not apply to deliveries
33607 routed to pipes by different immediate parent addresses, but an indirect
33608 aliasing scheme of the type
33610 <literallayout class="monospaced">
33611 pipe: |/some/command $local_part
33616 does not work with a message that is addressed to both local parts, because
33617 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
33618 discarded as being the same as a previously handled address. However, a scheme
33621 <literallayout class="monospaced">
33622 localpart1: |/some/command $local_part
33623 localpart2: |/some/command $local_part
33626 does result in two different pipe deliveries, because the immediate parents of
33627 the pipes are distinct.
33630 <section id="SECID128">
33631 <title>Repeated redirection expansion</title>
33633 <indexterm role="concept">
33634 <primary>repeated redirection expansion</primary>
33636 <indexterm role="concept">
33637 <primary>address redirection</primary>
33638 <secondary>repeated for each delivery attempt</secondary>
33640 When a message cannot be delivered to all of its recipients immediately,
33641 leading to two or more delivery attempts, redirection expansion is carried out
33642 afresh each time for those addresses whose children were not all previously
33643 delivered. If redirection is being used as a mailing list, this can lead to new
33644 members of the list receiving copies of old messages. The <option>one_time</option> option
33645 can be used to avoid this.
33648 <section id="SECID129">
33649 <title>Errors in redirection lists</title>
33651 <indexterm role="concept">
33652 <primary>address redirection</primary>
33653 <secondary>errors</secondary>
33655 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
33656 error is skipped, and an entry is written to the main log. This may be useful
33657 for mailing lists that are automatically managed. Otherwise, if an error is
33658 detected while generating the list of new addresses, the original address is
33659 deferred. See also <option>syntax_errors_to</option>.
33662 <section id="SECID130">
33663 <title>Private options for the redirect router</title>
33665 <indexterm role="concept">
33666 <primary>options</primary>
33667 <secondary><command>redirect</command> router</secondary>
33669 The private options for the <command>redirect</command> router are as follows:
33672 <indexterm role="option">
33673 <primary><option>allow_defer</option></primary>
33676 <informaltable frame="all">
33677 <tgroup cols="4" colsep="0" rowsep="0">
33678 <colspec colwidth="8*" align="left"/>
33679 <colspec colwidth="6*" align="center"/>
33680 <colspec colwidth="6*" align="center"/>
33681 <colspec colwidth="6*" align="right"/>
33684 <entry><option>allow_defer</option></entry>
33685 <entry>Use: <emphasis>redirect</emphasis></entry>
33686 <entry>Type: <emphasis>boolean</emphasis></entry>
33687 <entry>Default: <emphasis>false</emphasis></entry>
33693 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
33694 data, or the <option>defer</option> command in an Exim filter file.
33697 <indexterm role="option">
33698 <primary><option>allow_fail</option></primary>
33701 <informaltable frame="all">
33702 <tgroup cols="4" colsep="0" rowsep="0">
33703 <colspec colwidth="8*" align="left"/>
33704 <colspec colwidth="6*" align="center"/>
33705 <colspec colwidth="6*" align="center"/>
33706 <colspec colwidth="6*" align="right"/>
33709 <entry><option>allow_fail</option></entry>
33710 <entry>Use: <emphasis>redirect</emphasis></entry>
33711 <entry>Type: <emphasis>boolean</emphasis></entry>
33712 <entry>Default: <emphasis>false</emphasis></entry>
33718 <indexterm role="concept">
33719 <primary>failing delivery</primary>
33720 <secondary>from filter</secondary>
33722 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
33723 and the <option>fail</option> command may be used in an Exim filter file.
33726 <indexterm role="option">
33727 <primary><option>allow_filter</option></primary>
33730 <informaltable frame="all">
33731 <tgroup cols="4" colsep="0" rowsep="0">
33732 <colspec colwidth="8*" align="left"/>
33733 <colspec colwidth="6*" align="center"/>
33734 <colspec colwidth="6*" align="center"/>
33735 <colspec colwidth="6*" align="right"/>
33738 <entry><option>allow_filter</option></entry>
33739 <entry>Use: <emphasis>redirect</emphasis></entry>
33740 <entry>Type: <emphasis>boolean</emphasis></entry>
33741 <entry>Default: <emphasis>false</emphasis></entry>
33747 <indexterm role="concept">
33748 <primary>filter</primary>
33749 <secondary>enabling use of</secondary>
33751 <indexterm role="concept">
33752 <primary>Sieve filter</primary>
33753 <secondary>enabling use of</secondary>
33755 Setting this option allows Exim to interpret redirection data that starts with
33756 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
33757 are some features of Exim filter files that some administrators may wish to
33758 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
33761 It is also possible to lock out Exim filters or Sieve filters while allowing
33762 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
33765 The filter is run using the uid and gid set by the generic <option>user</option> and
33766 <option>group</option> options. These take their defaults from the password data if
33767 <option>check_local_user</option> is set, so in the normal case of users’ personal filter
33768 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
33769 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
33772 <indexterm role="option">
33773 <primary><option>allow_freeze</option></primary>
33776 <informaltable frame="all">
33777 <tgroup cols="4" colsep="0" rowsep="0">
33778 <colspec colwidth="8*" align="left"/>
33779 <colspec colwidth="6*" align="center"/>
33780 <colspec colwidth="6*" align="center"/>
33781 <colspec colwidth="6*" align="right"/>
33784 <entry><option>allow_freeze</option></entry>
33785 <entry>Use: <emphasis>redirect</emphasis></entry>
33786 <entry>Type: <emphasis>boolean</emphasis></entry>
33787 <entry>Default: <emphasis>false</emphasis></entry>
33793 <indexterm role="concept">
33794 <primary>freezing messages</primary>
33795 <secondary>allowing in filter</secondary>
33797 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
33798 This command is more normally encountered in system filters, and is disabled by
33799 default for redirection filters because it isn’t something you usually want to
33800 let ordinary users do.
33803 <indexterm role="option">
33804 <primary><option>check_ancestor</option></primary>
33807 <informaltable frame="all">
33808 <tgroup cols="4" colsep="0" rowsep="0">
33809 <colspec colwidth="8*" align="left"/>
33810 <colspec colwidth="6*" align="center"/>
33811 <colspec colwidth="6*" align="center"/>
33812 <colspec colwidth="6*" align="right"/>
33815 <entry><option>check_ancestor</option></entry>
33816 <entry>Use: <emphasis>redirect</emphasis></entry>
33817 <entry>Type: <emphasis>boolean</emphasis></entry>
33818 <entry>Default: <emphasis>false</emphasis></entry>
33824 This option is concerned with handling generated addresses that are the same
33825 as some address in the list of redirection ancestors of the current address.
33826 Although it is turned off by default in the code, it is set in the default
33827 configuration file for handling users’ <filename>.forward</filename> files. It is recommended
33828 for this use of the <command>redirect</command> router.
33831 When <option>check_ancestor</option> is set, if a generated address (including the domain)
33832 is the same as any ancestor of the current address, it is replaced by a copy of
33833 the current address. This helps in the case where local part A is aliased to B,
33834 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
33835 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
33836 <filename> jb/.forward</filename> contains:
33838 <literallayout class="monospaced">
33839 \Joe.Bloggs, <other item(s)>
33842 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
33843 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
33844 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
33845 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
33846 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
33847 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
33848 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
33849 original address. See also the <option>repeat_use</option> option below.
33852 <indexterm role="option">
33853 <primary><option>check_group</option></primary>
33856 <informaltable frame="all">
33857 <tgroup cols="4" colsep="0" rowsep="0">
33858 <colspec colwidth="8*" align="left"/>
33859 <colspec colwidth="6*" align="center"/>
33860 <colspec colwidth="6*" align="center"/>
33861 <colspec colwidth="6*" align="right"/>
33864 <entry><option>check_group</option></entry>
33865 <entry>Use: <emphasis>redirect</emphasis></entry>
33866 <entry>Type: <emphasis>boolean</emphasis></entry>
33867 <entry>Default: <emphasis>see below</emphasis></entry>
33873 When the <option>file</option> option is used, the group owner of the file is checked only
33874 when this option is set. The permitted groups are those listed in the
33875 <option>owngroups</option> option, together with the user’s default group if
33876 <option>check_local_user</option> is set. If the file has the wrong group, routing is
33877 deferred. The default setting for this option is true if <option>check_local_user</option>
33878 is set and the <option>modemask</option> option permits the group write bit, or if the
33879 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
33882 <indexterm role="option">
33883 <primary><option>check_owner</option></primary>
33886 <informaltable frame="all">
33887 <tgroup cols="4" colsep="0" rowsep="0">
33888 <colspec colwidth="8*" align="left"/>
33889 <colspec colwidth="6*" align="center"/>
33890 <colspec colwidth="6*" align="center"/>
33891 <colspec colwidth="6*" align="right"/>
33894 <entry><option>check_owner</option></entry>
33895 <entry>Use: <emphasis>redirect</emphasis></entry>
33896 <entry>Type: <emphasis>boolean</emphasis></entry>
33897 <entry>Default: <emphasis>see below</emphasis></entry>
33903 When the <option>file</option> option is used, the owner of the file is checked only when
33904 this option is set. If <option>check_local_user</option> is set, the local user is
33905 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
33906 option. The default value for this option is true if <option>check_local_user</option> or
33907 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
33910 <indexterm role="option">
33911 <primary><option>data</option></primary>
33914 <informaltable frame="all">
33915 <tgroup cols="4" colsep="0" rowsep="0">
33916 <colspec colwidth="8*" align="left"/>
33917 <colspec colwidth="6*" align="center"/>
33918 <colspec colwidth="6*" align="center"/>
33919 <colspec colwidth="6*" align="right"/>
33922 <entry><option>data</option></entry>
33923 <entry>Use: <emphasis>redirect</emphasis></entry>
33924 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
33925 <entry>Default: <emphasis>unset</emphasis></entry>
33931 This option is mutually exclusive with <option>file</option>. One or other of them must be
33932 set, but not both. The contents of <option>data</option> are expanded, and then used as the
33933 list of forwarding items, or as a set of filtering instructions. If the
33934 expansion is forced to fail, or the result is an empty string or a string that
33935 has no effect (consists entirely of comments), the router declines.
33938 When filtering instructions are used, the string must begin with <quote>#Exim
33939 filter</quote>, and all comments in the string, including this initial one, must be
33940 terminated with newline characters. For example:
33942 <literallayout class="monospaced">
33943 data = #Exim filter\n\
33944 if $h_to: contains Exim then save $home/mail/exim endif
33947 If you are reading the data from a database where newlines cannot be included,
33948 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
33949 choice into a newline.
33952 <indexterm role="option">
33953 <primary><option>directory_transport</option></primary>
33956 <informaltable frame="all">
33957 <tgroup cols="4" colsep="0" rowsep="0">
33958 <colspec colwidth="8*" align="left"/>
33959 <colspec colwidth="6*" align="center"/>
33960 <colspec colwidth="6*" align="center"/>
33961 <colspec colwidth="6*" align="right"/>
33964 <entry><option>directory_transport</option></entry>
33965 <entry>Use: <emphasis>redirect</emphasis></entry>
33966 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
33967 <entry>Default: <emphasis>unset</emphasis></entry>
33973 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
33974 ending with a slash is specified as a new <quote>address</quote>. The transport used is
33975 specified by this option, which, after expansion, must be the name of a
33976 configured transport. This should normally be an <command>appendfile</command> transport.
33979 <indexterm role="option">
33980 <primary><option>file</option></primary>
33983 <informaltable frame="all">
33984 <tgroup cols="4" colsep="0" rowsep="0">
33985 <colspec colwidth="8*" align="left"/>
33986 <colspec colwidth="6*" align="center"/>
33987 <colspec colwidth="6*" align="center"/>
33988 <colspec colwidth="6*" align="right"/>
33991 <entry><option>file</option></entry>
33992 <entry>Use: <emphasis>redirect</emphasis></entry>
33993 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
33994 <entry>Default: <emphasis>unset</emphasis></entry>
34000 This option specifies the name of a file that contains the redirection data. It
34001 is mutually exclusive with the <option>data</option> option. The string is expanded before
34002 use; if the expansion is forced to fail, the router declines. Other expansion
34003 failures cause delivery to be deferred. The result of a successful expansion
34004 must be an absolute path. The entire file is read and used as the redirection
34005 data. If the data is an empty string or a string that has no effect (consists
34006 entirely of comments), the router declines.
34009 <indexterm role="concept">
34010 <primary>NFS</primary>
34011 <secondary>checking for file existence</secondary>
34013 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
34014 runs a check on the containing directory,
34015 unless <option>ignore_enotdir</option> is true (see below).
34016 If the directory does not appear to exist, delivery is deferred. This can
34017 happen when users’ <filename>.forward</filename> files are in NFS-mounted directories, and there
34018 is a mount problem. If the containing directory does exist, but the file does
34019 not, the router declines.
34022 <indexterm role="option">
34023 <primary><option>file_transport</option></primary>
34026 <informaltable frame="all">
34027 <tgroup cols="4" colsep="0" rowsep="0">
34028 <colspec colwidth="8*" align="left"/>
34029 <colspec colwidth="6*" align="center"/>
34030 <colspec colwidth="6*" align="center"/>
34031 <colspec colwidth="6*" align="right"/>
34034 <entry><option>file_transport</option></entry>
34035 <entry>Use: <emphasis>redirect</emphasis></entry>
34036 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34037 <entry>Default: <emphasis>unset</emphasis></entry>
34043 <indexterm role="variable">
34044 <primary><varname>$address_file</varname></primary>
34046 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
34047 ending in a slash is specified as a new <quote>address</quote>. The transport used is
34048 specified by this option, which, after expansion, must be the name of a
34049 configured transport. This should normally be an <command>appendfile</command> transport. When
34050 it is running, the file name is in <varname>$address_file</varname>.
34053 <indexterm role="option">
34054 <primary><option>filter_prepend_home</option></primary>
34057 <informaltable frame="all">
34058 <tgroup cols="4" colsep="0" rowsep="0">
34059 <colspec colwidth="8*" align="left"/>
34060 <colspec colwidth="6*" align="center"/>
34061 <colspec colwidth="6*" align="center"/>
34062 <colspec colwidth="6*" align="right"/>
34065 <entry><option>filter_prepend_home</option></entry>
34066 <entry>Use: <emphasis>redirect</emphasis></entry>
34067 <entry>Type: <emphasis>boolean</emphasis></entry>
34068 <entry>Default: <emphasis>true</emphasis></entry>
34074 When this option is true, if a <command>save</command> command in an Exim filter specifies a
34075 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
34076 relative path. If this option is set false, this action does not happen. The
34077 relative path is then passed to the transport unmodified.
34080 <indexterm role="option">
34081 <primary><option>forbid_blackhole</option></primary>
34084 <informaltable frame="all">
34085 <tgroup cols="4" colsep="0" rowsep="0">
34086 <colspec colwidth="8*" align="left"/>
34087 <colspec colwidth="6*" align="center"/>
34088 <colspec colwidth="6*" align="center"/>
34089 <colspec colwidth="6*" align="right"/>
34092 <entry><option>forbid_blackhole</option></entry>
34093 <entry>Use: <emphasis>redirect</emphasis></entry>
34094 <entry>Type: <emphasis>boolean</emphasis></entry>
34095 <entry>Default: <emphasis>false</emphasis></entry>
34101 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
34105 <indexterm role="option">
34106 <primary><option>forbid_exim_filter</option></primary>
34109 <informaltable frame="all">
34110 <tgroup cols="4" colsep="0" rowsep="0">
34111 <colspec colwidth="8*" align="left"/>
34112 <colspec colwidth="6*" align="center"/>
34113 <colspec colwidth="6*" align="center"/>
34114 <colspec colwidth="6*" align="right"/>
34117 <entry><option>forbid_exim_filter</option></entry>
34118 <entry>Use: <emphasis>redirect</emphasis></entry>
34119 <entry>Type: <emphasis>boolean</emphasis></entry>
34120 <entry>Default: <emphasis>false</emphasis></entry>
34126 If this option is set true, only Sieve filters are permitted when
34127 <option>allow_filter</option> is true.
34130 <indexterm role="option">
34131 <primary><option>forbid_file</option></primary>
34134 <informaltable frame="all">
34135 <tgroup cols="4" colsep="0" rowsep="0">
34136 <colspec colwidth="8*" align="left"/>
34137 <colspec colwidth="6*" align="center"/>
34138 <colspec colwidth="6*" align="center"/>
34139 <colspec colwidth="6*" align="right"/>
34142 <entry><option>forbid_file</option></entry>
34143 <entry>Use: <emphasis>redirect</emphasis></entry>
34144 <entry>Type: <emphasis>boolean</emphasis></entry>
34145 <entry>Default: <emphasis>false</emphasis></entry>
34151 <indexterm role="concept">
34152 <primary>delivery</primary>
34153 <secondary>to file; forbidding</secondary>
34155 <indexterm role="concept">
34156 <primary>Sieve filter</primary>
34157 <secondary>forbidding delivery to a file</secondary>
34159 <indexterm role="concept">
34160 <primary>Sieve filter</primary>
34161 <secondary><quote>keep</quote> facility; disabling</secondary>
34163 If this option is true, this router may not generate a new address that
34164 specifies delivery to a local file or directory, either from a filter or from a
34165 conventional forward file. This option is forced to be true if <option>one_time</option> is
34166 set. It applies to Sieve filters as well as to Exim filters, but if true, it
34167 locks out the Sieve’s <quote>keep</quote> facility.
34170 <indexterm role="option">
34171 <primary><option>forbid_filter_dlfunc</option></primary>
34174 <informaltable frame="all">
34175 <tgroup cols="4" colsep="0" rowsep="0">
34176 <colspec colwidth="8*" align="left"/>
34177 <colspec colwidth="6*" align="center"/>
34178 <colspec colwidth="6*" align="center"/>
34179 <colspec colwidth="6*" align="right"/>
34182 <entry><option>forbid_filter_dlfunc</option></entry>
34183 <entry>Use: <emphasis>redirect</emphasis></entry>
34184 <entry>Type: <emphasis>boolean</emphasis></entry>
34185 <entry>Default: <emphasis>false</emphasis></entry>
34191 <indexterm role="concept">
34192 <primary>filter</primary>
34193 <secondary>locking out certain features</secondary>
34195 If this option is true, string expansions in Exim filters are not allowed to
34196 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
34200 <indexterm role="option">
34201 <primary><option>forbid_filter_existstest</option></primary>
34204 <informaltable frame="all">
34205 <tgroup cols="4" colsep="0" rowsep="0">
34206 <colspec colwidth="8*" align="left"/>
34207 <colspec colwidth="6*" align="center"/>
34208 <colspec colwidth="6*" align="center"/>
34209 <colspec colwidth="6*" align="right"/>
34212 <entry><option>forbid_filter_existstest</option></entry>
34213 <entry>Use: <emphasis>redirect</emphasis></entry>
34214 <entry>Type: <emphasis>boolean</emphasis></entry>
34215 <entry>Default: <emphasis>false</emphasis></entry>
34221 <indexterm role="concept">
34222 <primary>expansion</primary>
34223 <secondary>statting a file</secondary>
34225 If this option is true, string expansions in Exim filters are not allowed to
34226 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
34229 <indexterm role="option">
34230 <primary><option>forbid_filter_logwrite</option></primary>
34233 <informaltable frame="all">
34234 <tgroup cols="4" colsep="0" rowsep="0">
34235 <colspec colwidth="8*" align="left"/>
34236 <colspec colwidth="6*" align="center"/>
34237 <colspec colwidth="6*" align="center"/>
34238 <colspec colwidth="6*" align="right"/>
34241 <entry><option>forbid_filter_logwrite</option></entry>
34242 <entry>Use: <emphasis>redirect</emphasis></entry>
34243 <entry>Type: <emphasis>boolean</emphasis></entry>
34244 <entry>Default: <emphasis>false</emphasis></entry>
34250 If this option is true, use of the logging facility in Exim filters is not
34251 permitted. Logging is in any case available only if the filter is being run
34252 under some unprivileged uid (which is normally the case for ordinary users’
34253 <filename>.forward</filename> files).
34256 <indexterm role="option">
34257 <primary><option>forbid_filter_lookup</option></primary>
34260 <informaltable frame="all">
34261 <tgroup cols="4" colsep="0" rowsep="0">
34262 <colspec colwidth="8*" align="left"/>
34263 <colspec colwidth="6*" align="center"/>
34264 <colspec colwidth="6*" align="center"/>
34265 <colspec colwidth="6*" align="right"/>
34268 <entry><option>forbid_filter_lookup</option></entry>
34269 <entry>Use: <emphasis>redirect</emphasis></entry>
34270 <entry>Type: <emphasis>boolean</emphasis></entry>
34271 <entry>Default: <emphasis>false</emphasis></entry>
34277 If this option is true, string expansions in Exim filter files are not allowed
34278 to make use of <option>lookup</option> items.
34281 <indexterm role="option">
34282 <primary><option>forbid_filter_perl</option></primary>
34285 <informaltable frame="all">
34286 <tgroup cols="4" colsep="0" rowsep="0">
34287 <colspec colwidth="8*" align="left"/>
34288 <colspec colwidth="6*" align="center"/>
34289 <colspec colwidth="6*" align="center"/>
34290 <colspec colwidth="6*" align="right"/>
34293 <entry><option>forbid_filter_perl</option></entry>
34294 <entry>Use: <emphasis>redirect</emphasis></entry>
34295 <entry>Type: <emphasis>boolean</emphasis></entry>
34296 <entry>Default: <emphasis>false</emphasis></entry>
34302 This option has an effect only if Exim is built with embedded Perl support. If
34303 it is true, string expansions in Exim filter files are not allowed to make use
34304 of the embedded Perl support.
34307 <indexterm role="option">
34308 <primary><option>forbid_filter_readfile</option></primary>
34311 <informaltable frame="all">
34312 <tgroup cols="4" colsep="0" rowsep="0">
34313 <colspec colwidth="8*" align="left"/>
34314 <colspec colwidth="6*" align="center"/>
34315 <colspec colwidth="6*" align="center"/>
34316 <colspec colwidth="6*" align="right"/>
34319 <entry><option>forbid_filter_readfile</option></entry>
34320 <entry>Use: <emphasis>redirect</emphasis></entry>
34321 <entry>Type: <emphasis>boolean</emphasis></entry>
34322 <entry>Default: <emphasis>false</emphasis></entry>
34328 If this option is true, string expansions in Exim filter files are not allowed
34329 to make use of <option>readfile</option> items.
34332 <indexterm role="option">
34333 <primary><option>forbid_filter_readsocket</option></primary>
34336 <informaltable frame="all">
34337 <tgroup cols="4" colsep="0" rowsep="0">
34338 <colspec colwidth="8*" align="left"/>
34339 <colspec colwidth="6*" align="center"/>
34340 <colspec colwidth="6*" align="center"/>
34341 <colspec colwidth="6*" align="right"/>
34344 <entry><option>forbid_filter_readsocket</option></entry>
34345 <entry>Use: <emphasis>redirect</emphasis></entry>
34346 <entry>Type: <emphasis>boolean</emphasis></entry>
34347 <entry>Default: <emphasis>false</emphasis></entry>
34353 If this option is true, string expansions in Exim filter files are not allowed
34354 to make use of <option>readsocket</option> items.
34357 <indexterm role="option">
34358 <primary><option>forbid_filter_reply</option></primary>
34361 <informaltable frame="all">
34362 <tgroup cols="4" colsep="0" rowsep="0">
34363 <colspec colwidth="8*" align="left"/>
34364 <colspec colwidth="6*" align="center"/>
34365 <colspec colwidth="6*" align="center"/>
34366 <colspec colwidth="6*" align="right"/>
34369 <entry><option>forbid_filter_reply</option></entry>
34370 <entry>Use: <emphasis>redirect</emphasis></entry>
34371 <entry>Type: <emphasis>boolean</emphasis></entry>
34372 <entry>Default: <emphasis>false</emphasis></entry>
34378 If this option is true, this router may not generate an automatic reply
34379 message. Automatic replies can be generated only from Exim or Sieve filter
34380 files, not from traditional forward files. This option is forced to be true if
34381 <option>one_time</option> is set.
34384 <indexterm role="option">
34385 <primary><option>forbid_filter_run</option></primary>
34388 <informaltable frame="all">
34389 <tgroup cols="4" colsep="0" rowsep="0">
34390 <colspec colwidth="8*" align="left"/>
34391 <colspec colwidth="6*" align="center"/>
34392 <colspec colwidth="6*" align="center"/>
34393 <colspec colwidth="6*" align="right"/>
34396 <entry><option>forbid_filter_run</option></entry>
34397 <entry>Use: <emphasis>redirect</emphasis></entry>
34398 <entry>Type: <emphasis>boolean</emphasis></entry>
34399 <entry>Default: <emphasis>false</emphasis></entry>
34405 If this option is true, string expansions in Exim filter files are not allowed
34406 to make use of <option>run</option> items.
34409 <indexterm role="option">
34410 <primary><option>forbid_include</option></primary>
34413 <informaltable frame="all">
34414 <tgroup cols="4" colsep="0" rowsep="0">
34415 <colspec colwidth="8*" align="left"/>
34416 <colspec colwidth="6*" align="center"/>
34417 <colspec colwidth="6*" align="center"/>
34418 <colspec colwidth="6*" align="right"/>
34421 <entry><option>forbid_include</option></entry>
34422 <entry>Use: <emphasis>redirect</emphasis></entry>
34423 <entry>Type: <emphasis>boolean</emphasis></entry>
34424 <entry>Default: <emphasis>false</emphasis></entry>
34430 If this option is true, items of the form
34432 <literallayout class="monospaced">
34433 :include:<path name>
34436 are not permitted in non-filter redirection lists.
34439 <indexterm role="option">
34440 <primary><option>forbid_pipe</option></primary>
34443 <informaltable frame="all">
34444 <tgroup cols="4" colsep="0" rowsep="0">
34445 <colspec colwidth="8*" align="left"/>
34446 <colspec colwidth="6*" align="center"/>
34447 <colspec colwidth="6*" align="center"/>
34448 <colspec colwidth="6*" align="right"/>
34451 <entry><option>forbid_pipe</option></entry>
34452 <entry>Use: <emphasis>redirect</emphasis></entry>
34453 <entry>Type: <emphasis>boolean</emphasis></entry>
34454 <entry>Default: <emphasis>false</emphasis></entry>
34460 <indexterm role="concept">
34461 <primary>delivery</primary>
34462 <secondary>to pipe; forbidding</secondary>
34464 If this option is true, this router may not generate a new address which
34465 specifies delivery to a pipe, either from an Exim filter or from a conventional
34466 forward file. This option is forced to be true if <option>one_time</option> is set.
34469 <indexterm role="option">
34470 <primary><option>forbid_sieve_filter</option></primary>
34473 <informaltable frame="all">
34474 <tgroup cols="4" colsep="0" rowsep="0">
34475 <colspec colwidth="8*" align="left"/>
34476 <colspec colwidth="6*" align="center"/>
34477 <colspec colwidth="6*" align="center"/>
34478 <colspec colwidth="6*" align="right"/>
34481 <entry><option>forbid_sieve_filter</option></entry>
34482 <entry>Use: <emphasis>redirect</emphasis></entry>
34483 <entry>Type: <emphasis>boolean</emphasis></entry>
34484 <entry>Default: <emphasis>false</emphasis></entry>
34490 If this option is set true, only Exim filters are permitted when
34491 <option>allow_filter</option> is true.
34494 <indexterm role="concept">
34495 <primary>SMTP</primary>
34496 <secondary>error codes</secondary>
34498 <indexterm role="option">
34499 <primary><option>forbid_smtp_code</option></primary>
34502 <informaltable frame="all">
34503 <tgroup cols="4" colsep="0" rowsep="0">
34504 <colspec colwidth="8*" align="left"/>
34505 <colspec colwidth="6*" align="center"/>
34506 <colspec colwidth="6*" align="center"/>
34507 <colspec colwidth="6*" align="right"/>
34510 <entry><option>forbid_smtp_code</option></entry>
34511 <entry>Use: <emphasis>redirect</emphasis></entry>
34512 <entry>Type: <emphasis>boolean</emphasis></entry>
34513 <entry>Default: <emphasis>false</emphasis></entry>
34519 If this option is set true, any SMTP error codes that are present at the start
34520 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
34521 the default codes (451 and 550, respectively) are always used.
34524 <indexterm role="option">
34525 <primary><option>hide_child_in_errmsg</option></primary>
34528 <informaltable frame="all">
34529 <tgroup cols="4" colsep="0" rowsep="0">
34530 <colspec colwidth="8*" align="left"/>
34531 <colspec colwidth="6*" align="center"/>
34532 <colspec colwidth="6*" align="center"/>
34533 <colspec colwidth="6*" align="right"/>
34536 <entry><option>hide_child_in_errmsg</option></entry>
34537 <entry>Use: <emphasis>redirect</emphasis></entry>
34538 <entry>Type: <emphasis>boolean</emphasis></entry>
34539 <entry>Default: <emphasis>false</emphasis></entry>
34545 <indexterm role="concept">
34546 <primary>bounce message</primary>
34547 <secondary>redirection details; suppressing</secondary>
34549 If this option is true, it prevents Exim from quoting a child address if it
34550 generates a bounce or delay message for it. Instead it says <quote>an address
34551 generated from <<emphasis>the top level address</emphasis>></quote>. Of course, this applies only to
34552 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
34553 bounce may well quote the generated address.
34556 <indexterm role="option">
34557 <primary><option>ignore_eacces</option></primary>
34560 <informaltable frame="all">
34561 <tgroup cols="4" colsep="0" rowsep="0">
34562 <colspec colwidth="8*" align="left"/>
34563 <colspec colwidth="6*" align="center"/>
34564 <colspec colwidth="6*" align="center"/>
34565 <colspec colwidth="6*" align="right"/>
34568 <entry><option>ignore_eacces</option></entry>
34569 <entry>Use: <emphasis>redirect</emphasis></entry>
34570 <entry>Type: <emphasis>boolean</emphasis></entry>
34571 <entry>Default: <emphasis>false</emphasis></entry>
34577 <indexterm role="concept">
34578 <primary>EACCES</primary>
34580 If this option is set and an attempt to open a redirection file yields the
34581 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
34582 file did not exist.
34585 <indexterm role="option">
34586 <primary><option>ignore_enotdir</option></primary>
34589 <informaltable frame="all">
34590 <tgroup cols="4" colsep="0" rowsep="0">
34591 <colspec colwidth="8*" align="left"/>
34592 <colspec colwidth="6*" align="center"/>
34593 <colspec colwidth="6*" align="center"/>
34594 <colspec colwidth="6*" align="right"/>
34597 <entry><option>ignore_enotdir</option></entry>
34598 <entry>Use: <emphasis>redirect</emphasis></entry>
34599 <entry>Type: <emphasis>boolean</emphasis></entry>
34600 <entry>Default: <emphasis>false</emphasis></entry>
34606 <indexterm role="concept">
34607 <primary>ENOTDIR</primary>
34609 If this option is set and an attempt to open a redirection file yields the
34610 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
34611 router behaves as if the file did not exist.
34614 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
34615 router that has the <option>file</option> option set discovers that the file does not exist
34616 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
34617 against unmounted NFS directories. If the parent can not be statted, delivery
34618 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
34619 is set, because that option tells Exim to ignore <quote>something on the path is not
34620 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
34621 that some operating systems give ENOENT where others give ENOTDIR.
34624 <indexterm role="option">
34625 <primary><option>include_directory</option></primary>
34628 <informaltable frame="all">
34629 <tgroup cols="4" colsep="0" rowsep="0">
34630 <colspec colwidth="8*" align="left"/>
34631 <colspec colwidth="6*" align="center"/>
34632 <colspec colwidth="6*" align="center"/>
34633 <colspec colwidth="6*" align="right"/>
34636 <entry><option>include_directory</option></entry>
34637 <entry>Use: <emphasis>redirect</emphasis></entry>
34638 <entry>Type: <emphasis>string</emphasis></entry>
34639 <entry>Default: <emphasis>unset</emphasis></entry>
34645 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
34646 redirection list must start with this directory.
34649 <indexterm role="option">
34650 <primary><option>modemask</option></primary>
34653 <informaltable frame="all">
34654 <tgroup cols="4" colsep="0" rowsep="0">
34655 <colspec colwidth="8*" align="left"/>
34656 <colspec colwidth="6*" align="center"/>
34657 <colspec colwidth="6*" align="center"/>
34658 <colspec colwidth="6*" align="right"/>
34661 <entry><option>modemask</option></entry>
34662 <entry>Use: <emphasis>redirect</emphasis></entry>
34663 <entry>Type: <emphasis>octal integer</emphasis></entry>
34664 <entry>Default: <emphasis>022</emphasis></entry>
34670 This specifies mode bits which must not be set for a file specified by the
34671 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
34674 <indexterm role="option">
34675 <primary><option>one_time</option></primary>
34678 <informaltable frame="all">
34679 <tgroup cols="4" colsep="0" rowsep="0">
34680 <colspec colwidth="8*" align="left"/>
34681 <colspec colwidth="6*" align="center"/>
34682 <colspec colwidth="6*" align="center"/>
34683 <colspec colwidth="6*" align="right"/>
34686 <entry><option>one_time</option></entry>
34687 <entry>Use: <emphasis>redirect</emphasis></entry>
34688 <entry>Type: <emphasis>boolean</emphasis></entry>
34689 <entry>Default: <emphasis>false</emphasis></entry>
34695 <indexterm role="concept">
34696 <primary>one-time aliasing/forwarding expansion</primary>
34698 <indexterm role="concept">
34699 <primary>alias file</primary>
34700 <secondary>one-time expansion</secondary>
34702 <indexterm role="concept">
34703 <primary>forward file</primary>
34704 <secondary>one-time expansion</secondary>
34706 <indexterm role="concept">
34707 <primary>mailing lists</primary>
34708 <secondary>one-time expansion</secondary>
34710 <indexterm role="concept">
34711 <primary>address redirection</primary>
34712 <secondary>one-time expansion</secondary>
34714 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
34715 files each time it tries to deliver a message causes a problem when one or more
34716 of the generated addresses fails be delivered at the first attempt. The problem
34717 is not one of duplicate delivery – Exim is clever enough to handle that –
34718 but of what happens when the redirection list changes during the time that the
34719 message is on Exim’s queue. This is particularly true in the case of mailing
34720 lists, where new subscribers might receive copies of messages that were posted
34721 before they subscribed.
34724 If <option>one_time</option> is set and any addresses generated by the router fail to
34725 deliver at the first attempt, the failing addresses are added to the message as
34726 <quote>top level</quote> addresses, and the parent address that generated them is marked
34727 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
34731 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
34732 router would be lost if delivery did not succeed at the first attempt. For this
34733 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
34734 permitted when <option>one_time</option> is set.
34737 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
34738 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
34739 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
34742 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
34743 <option>one_time</option>.
34746 The original top-level address is remembered with each of the generated
34747 addresses, and is output in any log messages. However, any intermediate parent
34748 addresses are not recorded. This makes a difference to the log only if
34749 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
34750 typically be used for mailing lists, where there is normally just one level of
34754 <indexterm role="option">
34755 <primary><option>owners</option></primary>
34758 <informaltable frame="all">
34759 <tgroup cols="4" colsep="0" rowsep="0">
34760 <colspec colwidth="8*" align="left"/>
34761 <colspec colwidth="6*" align="center"/>
34762 <colspec colwidth="6*" align="center"/>
34763 <colspec colwidth="6*" align="right"/>
34766 <entry><option>owners</option></entry>
34767 <entry>Use: <emphasis>redirect</emphasis></entry>
34768 <entry>Type: <emphasis>string list</emphasis></entry>
34769 <entry>Default: <emphasis>unset</emphasis></entry>
34775 <indexterm role="concept">
34776 <primary>ownership</primary>
34777 <secondary>alias file</secondary>
34779 <indexterm role="concept">
34780 <primary>ownership</primary>
34781 <secondary>forward file</secondary>
34783 <indexterm role="concept">
34784 <primary>alias file</primary>
34785 <secondary>ownership</secondary>
34787 <indexterm role="concept">
34788 <primary>forward file</primary>
34789 <secondary>ownership</secondary>
34791 This specifies a list of permitted owners for the file specified by <option>file</option>.
34792 This list is in addition to the local user when <option>check_local_user</option> is set.
34793 See <option>check_owner</option> above.
34796 <indexterm role="option">
34797 <primary><option>owngroups</option></primary>
34800 <informaltable frame="all">
34801 <tgroup cols="4" colsep="0" rowsep="0">
34802 <colspec colwidth="8*" align="left"/>
34803 <colspec colwidth="6*" align="center"/>
34804 <colspec colwidth="6*" align="center"/>
34805 <colspec colwidth="6*" align="right"/>
34808 <entry><option>owngroups</option></entry>
34809 <entry>Use: <emphasis>redirect</emphasis></entry>
34810 <entry>Type: <emphasis>string list</emphasis></entry>
34811 <entry>Default: <emphasis>unset</emphasis></entry>
34817 This specifies a list of permitted groups for the file specified by <option>file</option>.
34818 The list is in addition to the local user’s primary group when
34819 <option>check_local_user</option> is set. See <option>check_group</option> above.
34822 <indexterm role="option">
34823 <primary><option>pipe_transport</option></primary>
34826 <informaltable frame="all">
34827 <tgroup cols="4" colsep="0" rowsep="0">
34828 <colspec colwidth="8*" align="left"/>
34829 <colspec colwidth="6*" align="center"/>
34830 <colspec colwidth="6*" align="center"/>
34831 <colspec colwidth="6*" align="right"/>
34834 <entry><option>pipe_transport</option></entry>
34835 <entry>Use: <emphasis>redirect</emphasis></entry>
34836 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34837 <entry>Default: <emphasis>unset</emphasis></entry>
34843 <indexterm role="variable">
34844 <primary><varname>$address_pipe</varname></primary>
34846 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
34847 starting with a vertical bar character is specified as a new <quote>address</quote>. The
34848 transport used is specified by this option, which, after expansion, must be the
34849 name of a configured transport. This should normally be a <command>pipe</command> transport.
34850 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
34853 <indexterm role="option">
34854 <primary><option>qualify_domain</option></primary>
34857 <informaltable frame="all">
34858 <tgroup cols="4" colsep="0" rowsep="0">
34859 <colspec colwidth="8*" align="left"/>
34860 <colspec colwidth="6*" align="center"/>
34861 <colspec colwidth="6*" align="center"/>
34862 <colspec colwidth="6*" align="right"/>
34865 <entry><option>qualify_domain</option></entry>
34866 <entry>Use: <emphasis>redirect</emphasis></entry>
34867 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34868 <entry>Default: <emphasis>unset</emphasis></entry>
34874 <indexterm role="variable">
34875 <primary><varname>$qualify_recipient</varname></primary>
34877 If this option is set, and an unqualified address (one without a domain) is
34878 generated, and that address would normally be qualified by the global setting
34879 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
34880 expanding this string. If the expansion fails, the router declines. If you want
34881 to revert to the default, you can have the expansion generate
34882 <varname>$qualify_recipient</varname>.
34885 This option applies to all unqualified addresses generated by Exim filters,
34886 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
34887 not preceded by a backslash. Sieve filters cannot generate unqualified
34891 <indexterm role="option">
34892 <primary><option>qualify_preserve_domain</option></primary>
34895 <informaltable frame="all">
34896 <tgroup cols="4" colsep="0" rowsep="0">
34897 <colspec colwidth="8*" align="left"/>
34898 <colspec colwidth="6*" align="center"/>
34899 <colspec colwidth="6*" align="center"/>
34900 <colspec colwidth="6*" align="right"/>
34903 <entry><option>qualify_preserve_domain</option></entry>
34904 <entry>Use: <emphasis>redirect</emphasis></entry>
34905 <entry>Type: <emphasis>boolean</emphasis></entry>
34906 <entry>Default: <emphasis>false</emphasis></entry>
34912 <indexterm role="concept">
34913 <primary>domain</primary>
34914 <secondary>in redirection; preserving</secondary>
34916 <indexterm role="concept">
34917 <primary>preserving domain in redirection</primary>
34919 <indexterm role="concept">
34920 <primary>address redirection</primary>
34921 <secondary>domain; preserving</secondary>
34923 If this option is set, the router’s local <option>qualify_domain</option> option must not be
34924 set (a configuration error occurs if it is). If an unqualified address (one
34925 without a domain) is generated, it is qualified with the domain of the parent
34926 address (the immediately preceding ancestor) instead of the global
34927 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
34928 this applies whether or not the address is preceded by a backslash.
34931 <indexterm role="option">
34932 <primary><option>repeat_use</option></primary>
34935 <informaltable frame="all">
34936 <tgroup cols="4" colsep="0" rowsep="0">
34937 <colspec colwidth="8*" align="left"/>
34938 <colspec colwidth="6*" align="center"/>
34939 <colspec colwidth="6*" align="center"/>
34940 <colspec colwidth="6*" align="right"/>
34943 <entry><option>repeat_use</option></entry>
34944 <entry>Use: <emphasis>redirect</emphasis></entry>
34945 <entry>Type: <emphasis>boolean</emphasis></entry>
34946 <entry>Default: <emphasis>true</emphasis></entry>
34952 If this option is set false, the router is skipped for a child address that has
34953 any ancestor that was routed by this router. This test happens before any of
34954 the other preconditions are tested. Exim’s default anti-looping rules skip
34955 only when the ancestor is the same as the current address. See also
34956 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
34959 <indexterm role="option">
34960 <primary><option>reply_transport</option></primary>
34963 <informaltable frame="all">
34964 <tgroup cols="4" colsep="0" rowsep="0">
34965 <colspec colwidth="8*" align="left"/>
34966 <colspec colwidth="6*" align="center"/>
34967 <colspec colwidth="6*" align="center"/>
34968 <colspec colwidth="6*" align="right"/>
34971 <entry><option>reply_transport</option></entry>
34972 <entry>Use: <emphasis>redirect</emphasis></entry>
34973 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34974 <entry>Default: <emphasis>unset</emphasis></entry>
34980 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
34981 <option>vacation</option> command is used in a filter file. The transport used is specified
34982 by this option, which, after expansion, must be the name of a configured
34983 transport. This should normally be an <command>autoreply</command> transport. Other transports
34984 are unlikely to do anything sensible or useful.
34987 <indexterm role="option">
34988 <primary><option>rewrite</option></primary>
34991 <informaltable frame="all">
34992 <tgroup cols="4" colsep="0" rowsep="0">
34993 <colspec colwidth="8*" align="left"/>
34994 <colspec colwidth="6*" align="center"/>
34995 <colspec colwidth="6*" align="center"/>
34996 <colspec colwidth="6*" align="right"/>
34999 <entry><option>rewrite</option></entry>
35000 <entry>Use: <emphasis>redirect</emphasis></entry>
35001 <entry>Type: <emphasis>boolean</emphasis></entry>
35002 <entry>Default: <emphasis>true</emphasis></entry>
35008 <indexterm role="concept">
35009 <primary>address redirection</primary>
35010 <secondary>disabling rewriting</secondary>
35012 If this option is set false, addresses generated by the router are not
35013 subject to address rewriting. Otherwise, they are treated like new addresses
35014 and are rewritten according to the global rewriting rules.
35017 <indexterm role="option">
35018 <primary><option>sieve_subaddress</option></primary>
35021 <informaltable frame="all">
35022 <tgroup cols="4" colsep="0" rowsep="0">
35023 <colspec colwidth="8*" align="left"/>
35024 <colspec colwidth="6*" align="center"/>
35025 <colspec colwidth="6*" align="center"/>
35026 <colspec colwidth="6*" align="right"/>
35029 <entry><option>sieve_subaddress</option></entry>
35030 <entry>Use: <emphasis>redirect</emphasis></entry>
35031 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35032 <entry>Default: <emphasis>unset</emphasis></entry>
35038 The value of this option is passed to a Sieve filter to specify the
35039 :subaddress part of an address.
35042 <indexterm role="option">
35043 <primary><option>sieve_useraddress</option></primary>
35046 <informaltable frame="all">
35047 <tgroup cols="4" colsep="0" rowsep="0">
35048 <colspec colwidth="8*" align="left"/>
35049 <colspec colwidth="6*" align="center"/>
35050 <colspec colwidth="6*" align="center"/>
35051 <colspec colwidth="6*" align="right"/>
35054 <entry><option>sieve_useraddress</option></entry>
35055 <entry>Use: <emphasis>redirect</emphasis></entry>
35056 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35057 <entry>Default: <emphasis>unset</emphasis></entry>
35063 The value of this option is passed to a Sieve filter to specify the :user part
35064 of an address. However, if it is unset, the entire original local part
35065 (including any prefix or suffix) is used for :user.
35068 <indexterm role="option">
35069 <primary><option>sieve_vacation_directory</option></primary>
35072 <informaltable frame="all">
35073 <tgroup cols="4" colsep="0" rowsep="0">
35074 <colspec colwidth="8*" align="left"/>
35075 <colspec colwidth="6*" align="center"/>
35076 <colspec colwidth="6*" align="center"/>
35077 <colspec colwidth="6*" align="right"/>
35080 <entry><option>sieve_vacation_directory</option></entry>
35081 <entry>Use: <emphasis>redirect</emphasis></entry>
35082 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35083 <entry>Default: <emphasis>unset</emphasis></entry>
35089 <indexterm role="concept">
35090 <primary>Sieve filter</primary>
35091 <secondary>vacation directory</secondary>
35093 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
35094 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
35095 (do not put anything else in that directory), and ensure that the
35096 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
35097 needs their own directory; Exim will create it if necessary.
35100 <indexterm role="option">
35101 <primary><option>skip_syntax_errors</option></primary>
35104 <informaltable frame="all">
35105 <tgroup cols="4" colsep="0" rowsep="0">
35106 <colspec colwidth="8*" align="left"/>
35107 <colspec colwidth="6*" align="center"/>
35108 <colspec colwidth="6*" align="center"/>
35109 <colspec colwidth="6*" align="right"/>
35112 <entry><option>skip_syntax_errors</option></entry>
35113 <entry>Use: <emphasis>redirect</emphasis></entry>
35114 <entry>Type: <emphasis>boolean</emphasis></entry>
35115 <entry>Default: <emphasis>false</emphasis></entry>
35121 <indexterm role="concept">
35122 <primary>forward file</primary>
35123 <secondary>broken</secondary>
35125 <indexterm role="concept">
35126 <primary>address redirection</primary>
35127 <secondary>broken files</secondary>
35129 <indexterm role="concept">
35130 <primary>alias file</primary>
35131 <secondary>broken</secondary>
35133 <indexterm role="concept">
35134 <primary>broken alias or forward files</primary>
35136 <indexterm role="concept">
35137 <primary>ignoring faulty addresses</primary>
35139 <indexterm role="concept">
35140 <primary>skipping faulty addresses</primary>
35142 <indexterm role="concept">
35143 <primary>error</primary>
35144 <secondary>skipping bad syntax</secondary>
35146 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
35147 non-filter redirection data are skipped, and each failing address is logged. If
35148 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
35149 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
35150 are expanded and placed at the head of the error message generated by
35151 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
35152 be the same address as the generic <option>errors_to</option> option. The
35153 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
35156 If all the addresses in a redirection list are skipped because of syntax
35157 errors, the router declines to handle the original address, and it is passed to
35158 the following routers.
35161 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
35162 error in the filter causes filtering to be abandoned without any action being
35163 taken. The incident is logged, and the router declines to handle the address,
35164 so it is passed to the following routers.
35167 <indexterm role="concept">
35168 <primary>Sieve filter</primary>
35169 <secondary>syntax errors in</secondary>
35171 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
35172 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
35173 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
35176 <option>skip_syntax_errors</option> can be used to specify that errors in users’ forward
35177 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
35178 option, used with an address that does not get redirected, can be used to
35179 notify users of these errors, by means of a router like this:
35181 <literallayout class="monospaced">
35186 file = $home/.forward
35187 file_transport = address_file
35188 pipe_transport = address_pipe
35189 reply_transport = address_reply
35192 syntax_errors_to = real-$local_part@$domain
35193 syntax_errors_text = \
35194 This is an automatically generated message. An error has\n\
35195 been found in your .forward file. Details of the error are\n\
35196 reported below. While this error persists, you will receive\n\
35197 a copy of this message for every message that is addressed\n\
35198 to you. If your .forward file is a filter file, or if it is\n\
35199 a non-filter file containing no valid forwarding addresses,\n\
35200 a copy of each incoming message will be put in your normal\n\
35201 mailbox. If a non-filter file contains at least one valid\n\
35202 forwarding address, forwarding to the valid addresses will\n\
35203 happen, and those will be the only deliveries that occur.
35206 You also need a router to ensure that local addresses that are prefixed by
35207 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
35208 put this immediately before the <command>userforward</command> router:
35210 <literallayout class="monospaced">
35214 local_part_prefix = real-
35215 transport = local_delivery
35218 For security, it would probably be a good idea to restrict the use of this
35219 router to locally-generated messages, using a condition such as this:
35221 <literallayout class="monospaced">
35222 condition = ${if match {$sender_host_address}\
35223 {\N^(|127\.0\.0\.1)$\N}}
35226 <indexterm role="option">
35227 <primary><option>syntax_errors_text</option></primary>
35230 <informaltable frame="all">
35231 <tgroup cols="4" colsep="0" rowsep="0">
35232 <colspec colwidth="8*" align="left"/>
35233 <colspec colwidth="6*" align="center"/>
35234 <colspec colwidth="6*" align="center"/>
35235 <colspec colwidth="6*" align="right"/>
35238 <entry><option>syntax_errors_text</option></entry>
35239 <entry>Use: <emphasis>redirect</emphasis></entry>
35240 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35241 <entry>Default: <emphasis>unset</emphasis></entry>
35247 See <option>skip_syntax_errors</option> above.
35250 <indexterm role="option">
35251 <primary><option>syntax_errors_to</option></primary>
35254 <informaltable frame="all">
35255 <tgroup cols="4" colsep="0" rowsep="0">
35256 <colspec colwidth="8*" align="left"/>
35257 <colspec colwidth="6*" align="center"/>
35258 <colspec colwidth="6*" align="center"/>
35259 <colspec colwidth="6*" align="right"/>
35262 <entry><option>syntax_errors_to</option></entry>
35263 <entry>Use: <emphasis>redirect</emphasis></entry>
35264 <entry>Type: <emphasis>string</emphasis></entry>
35265 <entry>Default: <emphasis>unset</emphasis></entry>
35271 See <option>skip_syntax_errors</option> above.
35272 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
35273 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
35278 <chapter id="CHAPenvironment">
35279 <title>Environment for running local transports</title>
35280 <titleabbrev>Environment for local transports</titleabbrev>
35282 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
35283 <primary>local transports</primary>
35284 <secondary>environment for</secondary>
35286 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
35287 <primary>environment for local transports</primary>
35289 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
35290 <primary>transport</primary>
35291 <secondary>local; environment for</secondary>
35293 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
35294 transport can be thought of as similar to a pipe.) Exim always runs transports
35295 in subprocesses, under specified uids and gids. Typical deliveries to local
35296 mailboxes run under the uid and gid of the local user.
35299 Exim also sets a specific current directory while running the transport; for
35300 some transports a home directory setting is also relevant. The <command>pipe</command>
35301 transport is the only one that sets up environment variables; see section
35302 <xref linkend="SECTpipeenv"/> for details.
35305 The values used for the uid, gid, and the directories may come from several
35306 different places. In many cases, the router that handles the address associates
35307 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
35308 or <option>user</option> options. However, values may also be given in the transport’s own
35309 configuration, and these override anything that comes from the router.
35311 <section id="SECID131">
35312 <title>Concurrent deliveries</title>
35314 <indexterm role="concept">
35315 <primary>concurrent deliveries</primary>
35317 <indexterm role="concept">
35318 <primary>simultaneous deliveries</primary>
35320 If two different messages for the same local recipient arrive more or less
35321 simultaneously, the two delivery processes are likely to run concurrently. When
35322 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
35323 rules to stop concurrent processes from writing to the same file at the same
35327 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
35328 locking that is needed. Here is a silly example:
35330 <literallayout class="monospaced">
35333 command = /bin/sh -c 'cat >>/some/file'
35336 This is supposed to write the message at the end of the file. However, if two
35337 messages arrive at the same time, the file will be scrambled. You can use the
35338 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
35339 file using the same algorithm that Exim itself uses.
35342 <section id="SECTenvuidgid">
35343 <title>Uids and gids</title>
35345 <indexterm role="concept">
35346 <primary>local transports</primary>
35347 <secondary>uid and gid</secondary>
35349 <indexterm role="concept">
35350 <primary>transport</primary>
35351 <secondary>local; uid and gid</secondary>
35353 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
35354 overrides any group that the router set in the address, even if <option>user</option> is not
35355 set for the transport. This makes it possible, for example, to run local mail
35356 delivery under the uid of the recipient (set by the router), but in a special
35357 group (set by the transport). For example:
35359 <literallayout class="monospaced">
35361 # User/group are set by check_local_user in this router
35365 transport = group_delivery
35368 # This transport overrides the group
35370 driver = appendfile
35371 file = /var/spool/mail/$local_part
35375 If <option>user</option> is set for a transport, its value overrides what is set in the
35376 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
35377 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
35381 <indexterm role="option">
35382 <primary><option>initgroups</option></primary>
35384 When the uid is taken from the transport’s configuration, the <function>initgroups()</function>
35385 function is called for the groups associated with that uid if the
35386 <option>initgroups</option> option is set for the transport. When the uid is not specified
35387 by the transport, but is associated with the address by a router, the option
35388 for calling <function>initgroups()</function> is taken from the router configuration.
35391 <indexterm role="concept">
35392 <primary><command>pipe</command> transport</primary>
35393 <secondary>uid for</secondary>
35395 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
35396 is set and <option>user</option> is not set, the uid of the process that called Exim to
35397 receive the message is used, and if <option>group</option> is not set, the corresponding
35398 original gid is also used.
35401 This is the detailed preference order for obtaining a gid; the first of the
35402 following that is set is used:
35407 A <option>group</option> setting of the transport;
35412 A <option>group</option> setting of the router;
35417 A gid associated with a user setting of the router, either as a result of
35418 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
35423 The group associated with a non-numeric <option>user</option> setting of the transport;
35428 In a <command>pipe</command> transport, the creator’s gid if <option>deliver_as_creator</option> is set and
35429 the uid is the creator’s uid;
35434 The Exim gid if the Exim uid is being used as a default.
35439 If, for example, the user is specified numerically on the router and there are
35440 no group settings, no gid is available. In this situation, an error occurs.
35441 This is different for the uid, for which there always is an ultimate default.
35442 The first of the following that is set is used:
35447 A <option>user</option> setting of the transport;
35452 In a <command>pipe</command> transport, the creator’s uid if <option>deliver_as_creator</option> is set;
35457 A <option>user</option> setting of the router;
35462 A <option>check_local_user</option> setting of the router;
35472 Of course, an error will still occur if the uid that is chosen is on the
35473 <option>never_users</option> list.
35476 <section id="SECID132">
35477 <title>Current and home directories</title>
35479 <indexterm role="concept">
35480 <primary>current directory for local transport</primary>
35482 <indexterm role="concept">
35483 <primary>home directory</primary>
35484 <secondary>for local transport</secondary>
35486 <indexterm role="concept">
35487 <primary>transport</primary>
35488 <secondary>local; home directory for</secondary>
35490 <indexterm role="concept">
35491 <primary>transport</primary>
35492 <secondary>local; current directory for</secondary>
35494 Routers may set current and home directories for local transports by means of
35495 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
35496 However, if the transport’s <option>current_directory</option> or <option>home_directory</option> options
35497 are set, they override the router’s values. In detail, the home directory
35498 for a local transport is taken from the first of these values that is set:
35503 The <option>home_directory</option> option on the transport;
35508 The <option>transport_home_directory</option> option on the router;
35513 The password data if <option>check_local_user</option> is set on the router;
35518 The <option>router_home_directory</option> option on the router.
35523 The current directory is taken from the first of these values that is set:
35528 The <option>current_directory</option> option on the transport;
35533 The <option>transport_current_directory</option> option on the router.
35538 If neither the router nor the transport sets a current directory, Exim uses the
35539 value of the home directory, if it is set. Otherwise it sets the current
35540 directory to <filename>/</filename> before running a local transport.
35543 <section id="SECID133">
35544 <title>Expansion variables derived from the address</title>
35546 <indexterm role="variable">
35547 <primary><varname>$domain</varname></primary>
35549 <indexterm role="variable">
35550 <primary><varname>$local_part</varname></primary>
35552 <indexterm role="variable">
35553 <primary><varname>$original_domain</varname></primary>
35555 Normally a local delivery is handling a single address, and in that case the
35556 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
35557 deliveries. However, in some circumstances more than one address may be handled
35558 at once (for example, while writing batch SMTP for onward transmission by some
35559 other means). In this case, the variables associated with the local part are
35560 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
35561 and <varname>$original_domain</varname> is never set.
35562 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
35563 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
35564 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
35569 <chapter id="CHAPtransportgeneric">
35570 <title>Generic options for transports</title>
35572 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
35573 <primary>generic options</primary>
35574 <secondary>transport</secondary>
35576 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
35577 <primary>options</primary>
35578 <secondary>generic; for transports</secondary>
35580 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
35581 <primary>transport</primary>
35582 <secondary>generic options for</secondary>
35584 The following generic options apply to all transports:
35587 <indexterm role="option">
35588 <primary><option>body_only</option></primary>
35591 <informaltable frame="all">
35592 <tgroup cols="4" colsep="0" rowsep="0">
35593 <colspec colwidth="8*" align="left"/>
35594 <colspec colwidth="6*" align="center"/>
35595 <colspec colwidth="6*" align="center"/>
35596 <colspec colwidth="6*" align="right"/>
35599 <entry><option>body_only</option></entry>
35600 <entry>Use: <emphasis>transports</emphasis></entry>
35601 <entry>Type: <emphasis>boolean</emphasis></entry>
35602 <entry>Default: <emphasis>false</emphasis></entry>
35608 <indexterm role="concept">
35609 <primary>transport</primary>
35610 <secondary>body only</secondary>
35612 <indexterm role="concept">
35613 <primary>message</primary>
35614 <secondary>transporting body only</secondary>
35616 <indexterm role="concept">
35617 <primary>body of message</primary>
35618 <secondary>transporting</secondary>
35620 If this option is set, the message’s headers are not transported. It is
35621 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
35622 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
35623 <option>message_suffix</option> should be checked, because this option does not
35624 automatically suppress them.
35627 <indexterm role="option">
35628 <primary><option>current_directory</option></primary>
35631 <informaltable frame="all">
35632 <tgroup cols="4" colsep="0" rowsep="0">
35633 <colspec colwidth="8*" align="left"/>
35634 <colspec colwidth="6*" align="center"/>
35635 <colspec colwidth="6*" align="center"/>
35636 <colspec colwidth="6*" align="right"/>
35639 <entry><option>current_directory</option></entry>
35640 <entry>Use: <emphasis>transports</emphasis></entry>
35641 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35642 <entry>Default: <emphasis>unset</emphasis></entry>
35648 <indexterm role="concept">
35649 <primary>transport</primary>
35650 <secondary>current directory for</secondary>
35652 This specifies the current directory that is to be set while running the
35653 transport, overriding any value that may have been set by the router.
35654 If the expansion fails for any reason, including forced failure, an error is
35655 logged, and delivery is deferred.
35658 <indexterm role="option">
35659 <primary><option>disable_logging</option></primary>
35662 <informaltable frame="all">
35663 <tgroup cols="4" colsep="0" rowsep="0">
35664 <colspec colwidth="8*" align="left"/>
35665 <colspec colwidth="6*" align="center"/>
35666 <colspec colwidth="6*" align="center"/>
35667 <colspec colwidth="6*" align="right"/>
35670 <entry><option>disable_logging</option></entry>
35671 <entry>Use: <emphasis>transports</emphasis></entry>
35672 <entry>Type: <emphasis>boolean</emphasis></entry>
35673 <entry>Default: <emphasis>false</emphasis></entry>
35679 If this option is set true, nothing is logged for any
35680 deliveries by the transport or for any
35681 transport errors. You should not set this option unless you really, really know
35682 what you are doing.
35685 <indexterm role="option">
35686 <primary><option>debug_print</option></primary>
35689 <informaltable frame="all">
35690 <tgroup cols="4" colsep="0" rowsep="0">
35691 <colspec colwidth="8*" align="left"/>
35692 <colspec colwidth="6*" align="center"/>
35693 <colspec colwidth="6*" align="center"/>
35694 <colspec colwidth="6*" align="right"/>
35697 <entry><option>debug_print</option></entry>
35698 <entry>Use: <emphasis>transports</emphasis></entry>
35699 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35700 <entry>Default: <emphasis>unset</emphasis></entry>
35706 <indexterm role="concept">
35707 <primary>testing</primary>
35708 <secondary>variables in drivers</secondary>
35710 If this option is set and debugging is enabled (see the <option>-d</option> command line
35711 option), the string is expanded and included in the debugging output when the
35713 If expansion of the string fails, the error message is written to the debugging
35714 output, and Exim carries on processing.
35715 This facility is provided to help with checking out the values of variables and
35716 so on when debugging driver configurations. For example, if a <option>headers_add</option>
35717 option is not working properly, <option>debug_print</option> could be used to output the
35718 variables it references. A newline is added to the text if it does not end with
35722 <indexterm role="option">
35723 <primary><option>delivery_date_add</option></primary>
35726 <informaltable frame="all">
35727 <tgroup cols="4" colsep="0" rowsep="0">
35728 <colspec colwidth="8*" align="left"/>
35729 <colspec colwidth="6*" align="center"/>
35730 <colspec colwidth="6*" align="center"/>
35731 <colspec colwidth="6*" align="right"/>
35734 <entry><option>delivery_date_add</option></entry>
35735 <entry>Use: <emphasis>transports</emphasis></entry>
35736 <entry>Type: <emphasis>boolean</emphasis></entry>
35737 <entry>Default: <emphasis>false</emphasis></entry>
35743 <indexterm role="concept">
35744 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
35746 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
35747 This gives the actual time the delivery was made. As this is not a standard
35748 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
35749 requests its removal from incoming messages, so that delivered messages can
35750 safely be resent to other recipients.
35753 <indexterm role="option">
35754 <primary><option>driver</option></primary>
35757 <informaltable frame="all">
35758 <tgroup cols="4" colsep="0" rowsep="0">
35759 <colspec colwidth="8*" align="left"/>
35760 <colspec colwidth="6*" align="center"/>
35761 <colspec colwidth="6*" align="center"/>
35762 <colspec colwidth="6*" align="right"/>
35765 <entry><option>driver</option></entry>
35766 <entry>Use: <emphasis>transports</emphasis></entry>
35767 <entry>Type: <emphasis>string</emphasis></entry>
35768 <entry>Default: <emphasis>unset</emphasis></entry>
35774 This specifies which of the available transport drivers is to be used.
35775 There is no default, and this option must be set for every transport.
35778 <indexterm role="option">
35779 <primary><option>envelope_to_add</option></primary>
35782 <informaltable frame="all">
35783 <tgroup cols="4" colsep="0" rowsep="0">
35784 <colspec colwidth="8*" align="left"/>
35785 <colspec colwidth="6*" align="center"/>
35786 <colspec colwidth="6*" align="center"/>
35787 <colspec colwidth="6*" align="right"/>
35790 <entry><option>envelope_to_add</option></entry>
35791 <entry>Use: <emphasis>transports</emphasis></entry>
35792 <entry>Type: <emphasis>boolean</emphasis></entry>
35793 <entry>Default: <emphasis>false</emphasis></entry>
35799 <indexterm role="concept">
35800 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
35802 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
35803 This gives the original address(es) in the incoming envelope that caused this
35804 delivery to happen. More than one address may be present if the transport is
35805 configured to handle several addresses at once, or if more than one original
35806 address was redirected to the same final address. As this is not a standard
35807 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
35808 its removal from incoming messages, so that delivered messages can safely be
35809 resent to other recipients.
35812 <indexterm role="option">
35813 <primary><option>group</option></primary>
35816 <informaltable frame="all">
35817 <tgroup cols="4" colsep="0" rowsep="0">
35818 <colspec colwidth="8*" align="left"/>
35819 <colspec colwidth="6*" align="center"/>
35820 <colspec colwidth="6*" align="center"/>
35821 <colspec colwidth="6*" align="right"/>
35824 <entry><option>group</option></entry>
35825 <entry>Use: <emphasis>transports</emphasis></entry>
35826 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35827 <entry>Default: <emphasis>Exim group</emphasis></entry>
35833 <indexterm role="concept">
35834 <primary>transport</primary>
35835 <secondary>group; specifying</secondary>
35837 This option specifies a gid for running the transport process, overriding any
35838 value that the router supplies, and also overriding any value associated with
35839 <option>user</option> (see below).
35842 <indexterm role="option">
35843 <primary><option>headers_add</option></primary>
35846 <informaltable frame="all">
35847 <tgroup cols="4" colsep="0" rowsep="0">
35848 <colspec colwidth="8*" align="left"/>
35849 <colspec colwidth="6*" align="center"/>
35850 <colspec colwidth="6*" align="center"/>
35851 <colspec colwidth="6*" align="right"/>
35854 <entry><option>headers_add</option></entry>
35855 <entry>Use: <emphasis>transports</emphasis></entry>
35856 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35857 <entry>Default: <emphasis>unset</emphasis></entry>
35863 <indexterm role="concept">
35864 <primary>header lines</primary>
35865 <secondary>adding in transport</secondary>
35867 <indexterm role="concept">
35868 <primary>transport</primary>
35869 <secondary>header lines; adding</secondary>
35871 This option specifies a string of text that is expanded and added to the header
35872 portion of a message as it is transported, as described in section
35873 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
35874 routers. If the result of the expansion is an empty string, or if the expansion
35875 is forced to fail, no action is taken. Other expansion failures are treated as
35876 errors and cause the delivery to be deferred.
35879 <indexterm role="option">
35880 <primary><option>headers_only</option></primary>
35883 <informaltable frame="all">
35884 <tgroup cols="4" colsep="0" rowsep="0">
35885 <colspec colwidth="8*" align="left"/>
35886 <colspec colwidth="6*" align="center"/>
35887 <colspec colwidth="6*" align="center"/>
35888 <colspec colwidth="6*" align="right"/>
35891 <entry><option>headers_only</option></entry>
35892 <entry>Use: <emphasis>transports</emphasis></entry>
35893 <entry>Type: <emphasis>boolean</emphasis></entry>
35894 <entry>Default: <emphasis>false</emphasis></entry>
35900 <indexterm role="concept">
35901 <primary>transport</primary>
35902 <secondary>header lines only</secondary>
35904 <indexterm role="concept">
35905 <primary>message</primary>
35906 <secondary>transporting headers only</secondary>
35908 <indexterm role="concept">
35909 <primary>header lines</primary>
35910 <secondary>transporting</secondary>
35912 If this option is set, the message’s body is not transported. It is mutually
35913 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
35914 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
35915 checked, since this option does not automatically suppress them.
35918 <indexterm role="option">
35919 <primary><option>headers_remove</option></primary>
35922 <informaltable frame="all">
35923 <tgroup cols="4" colsep="0" rowsep="0">
35924 <colspec colwidth="8*" align="left"/>
35925 <colspec colwidth="6*" align="center"/>
35926 <colspec colwidth="6*" align="center"/>
35927 <colspec colwidth="6*" align="right"/>
35930 <entry><option>headers_remove</option></entry>
35931 <entry>Use: <emphasis>transports</emphasis></entry>
35932 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35933 <entry>Default: <emphasis>unset</emphasis></entry>
35939 <indexterm role="concept">
35940 <primary>header lines</primary>
35941 <secondary>removing</secondary>
35943 <indexterm role="concept">
35944 <primary>transport</primary>
35945 <secondary>header lines; removing</secondary>
35947 This option specifies a string that is expanded into a list of header names;
35948 these headers are omitted from the message as it is transported, as described
35949 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
35950 routers. If the result of the expansion is an empty string, or if the expansion
35951 is forced to fail, no action is taken. Other expansion failures are treated as
35952 errors and cause the delivery to be deferred.
35955 <indexterm role="option">
35956 <primary><option>headers_rewrite</option></primary>
35959 <informaltable frame="all">
35960 <tgroup cols="4" colsep="0" rowsep="0">
35961 <colspec colwidth="8*" align="left"/>
35962 <colspec colwidth="6*" align="center"/>
35963 <colspec colwidth="6*" align="center"/>
35964 <colspec colwidth="6*" align="right"/>
35967 <entry><option>headers_rewrite</option></entry>
35968 <entry>Use: <emphasis>transports</emphasis></entry>
35969 <entry>Type: <emphasis>string</emphasis></entry>
35970 <entry>Default: <emphasis>unset</emphasis></entry>
35976 <indexterm role="concept">
35977 <primary>transport</primary>
35978 <secondary>header lines; rewriting</secondary>
35980 <indexterm role="concept">
35981 <primary>rewriting</primary>
35982 <secondary>at transport time</secondary>
35984 This option allows addresses in header lines to be rewritten at transport time,
35985 that is, as the message is being copied to its destination. The contents of the
35986 option are a colon-separated list of rewriting rules. Each rule is in exactly
35987 the same form as one of the general rewriting rules that are applied when a
35988 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
35991 <literallayout class="monospaced">
35992 headers_rewrite = a@b c@d f : \
35996 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
35997 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
35998 header lines just before they are written out at transport time, so they affect
35999 only those copies of the message that pass through the transport. However, only
36000 the message’s original header lines, and any that were added by a system
36001 filter, are rewritten. If a router or transport adds header lines, they are not
36002 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
36003 envelope. You can change the return path using <option>return_path</option>, but you cannot
36004 change envelope recipients at this time.
36007 <indexterm role="option">
36008 <primary><option>home_directory</option></primary>
36011 <informaltable frame="all">
36012 <tgroup cols="4" colsep="0" rowsep="0">
36013 <colspec colwidth="8*" align="left"/>
36014 <colspec colwidth="6*" align="center"/>
36015 <colspec colwidth="6*" align="center"/>
36016 <colspec colwidth="6*" align="right"/>
36019 <entry><option>home_directory</option></entry>
36020 <entry>Use: <emphasis>transports</emphasis></entry>
36021 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36022 <entry>Default: <emphasis>unset</emphasis></entry>
36028 <indexterm role="concept">
36029 <primary>transport</primary>
36030 <secondary>home directory for</secondary>
36032 <indexterm role="variable">
36033 <primary><varname>$home</varname></primary>
36035 This option specifies a home directory setting for a local transport,
36036 overriding any value that may be set by the router. The home directory is
36037 placed in <varname>$home</varname> while expanding the transport’s private options. It is also
36038 used as the current directory if no current directory is set by the
36039 <option>current_directory</option> option on the transport or the
36040 <option>transport_current_directory</option> option on the router. If the expansion fails
36041 for any reason, including forced failure, an error is logged, and delivery is
36045 <indexterm role="option">
36046 <primary><option>initgroups</option></primary>
36049 <informaltable frame="all">
36050 <tgroup cols="4" colsep="0" rowsep="0">
36051 <colspec colwidth="8*" align="left"/>
36052 <colspec colwidth="6*" align="center"/>
36053 <colspec colwidth="6*" align="center"/>
36054 <colspec colwidth="6*" align="right"/>
36057 <entry><option>initgroups</option></entry>
36058 <entry>Use: <emphasis>transports</emphasis></entry>
36059 <entry>Type: <emphasis>boolean</emphasis></entry>
36060 <entry>Default: <emphasis>false</emphasis></entry>
36066 <indexterm role="concept">
36067 <primary>additional groups</primary>
36069 <indexterm role="concept">
36070 <primary>groups</primary>
36071 <secondary>additional</secondary>
36073 <indexterm role="concept">
36074 <primary>transport</primary>
36075 <secondary>group; additional</secondary>
36077 If this option is true and the uid for the delivery process is provided by the
36078 transport, the <function>initgroups()</function> function is called when running the transport
36079 to ensure that any additional groups associated with the uid are set up.
36082 <indexterm role="option">
36083 <primary><option>message_size_limit</option></primary>
36086 <informaltable frame="all">
36087 <tgroup cols="4" colsep="0" rowsep="0">
36088 <colspec colwidth="8*" align="left"/>
36089 <colspec colwidth="6*" align="center"/>
36090 <colspec colwidth="6*" align="center"/>
36091 <colspec colwidth="6*" align="right"/>
36094 <entry><option>message_size_limit</option></entry>
36095 <entry>Use: <emphasis>transports</emphasis></entry>
36096 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36097 <entry>Default: <emphasis>0</emphasis></entry>
36103 <indexterm role="concept">
36104 <primary>limit</primary>
36105 <secondary>message size per transport</secondary>
36107 <indexterm role="concept">
36108 <primary>size</primary>
36109 <secondary>of message, limit</secondary>
36111 <indexterm role="concept">
36112 <primary>transport</primary>
36113 <secondary>message size; limiting</secondary>
36115 This option controls the size of messages passed through the transport. It is
36116 expanded before use; the result of the expansion must be a sequence of decimal
36117 digits, optionally followed by K or M. If the expansion fails for any reason,
36118 including forced failure, or if the result is not of the required form,
36119 delivery is deferred. If the value is greater than zero and the size of a
36120 message exceeds this limit, the address is failed. If there is any chance that
36121 the resulting bounce message could be routed to the same transport, you should
36122 ensure that <option>return_size_limit</option> is less than the transport’s
36123 <option>message_size_limit</option>, as otherwise the bounce message will fail to get
36127 <indexterm role="option">
36128 <primary><option>rcpt_include_affixes</option></primary>
36131 <informaltable frame="all">
36132 <tgroup cols="4" colsep="0" rowsep="0">
36133 <colspec colwidth="8*" align="left"/>
36134 <colspec colwidth="6*" align="center"/>
36135 <colspec colwidth="6*" align="center"/>
36136 <colspec colwidth="6*" align="right"/>
36139 <entry><option>rcpt_include_affixes</option></entry>
36140 <entry>Use: <emphasis>transports</emphasis></entry>
36141 <entry>Type: <emphasis>boolean</emphasis></entry>
36142 <entry>Default: <emphasis>false</emphasis></entry>
36148 <indexterm role="concept">
36149 <primary>prefix</primary>
36150 <secondary>for local part, including in envelope</secondary>
36152 <indexterm role="concept">
36153 <primary>suffix for local part</primary>
36154 <secondary>including in envelope</secondary>
36156 <indexterm role="concept">
36157 <primary>local part</primary>
36158 <secondary>prefix</secondary>
36160 <indexterm role="concept">
36161 <primary>local part</primary>
36162 <secondary>suffix</secondary>
36164 When this option is false (the default), and an address that has had any
36165 affixes (prefixes or suffixes) removed from the local part is delivered by any
36166 form of SMTP or LMTP, the affixes are not included. For example, if a router
36169 <literallayout class="monospaced">
36170 local_part_prefix = *-
36173 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
36176 <literallayout class="monospaced">
36177 RCPT TO:<xyz@some.domain>
36180 This is also the case when an ACL-time callout is being used to verify a
36181 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
36182 whole local part is included in the RCPT command. This option applies to BSMTP
36183 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
36184 <command>lmtp</command> and <command>smtp</command> transports.
36187 <indexterm role="option">
36188 <primary><option>retry_use_local_part</option></primary>
36191 <informaltable frame="all">
36192 <tgroup cols="4" colsep="0" rowsep="0">
36193 <colspec colwidth="8*" align="left"/>
36194 <colspec colwidth="6*" align="center"/>
36195 <colspec colwidth="6*" align="center"/>
36196 <colspec colwidth="6*" align="right"/>
36199 <entry><option>retry_use_local_part</option></entry>
36200 <entry>Use: <emphasis>transports</emphasis></entry>
36201 <entry>Type: <emphasis>boolean</emphasis></entry>
36202 <entry>Default: <emphasis>see below</emphasis></entry>
36208 <indexterm role="concept">
36209 <primary>hints database</primary>
36210 <secondary>retry keys</secondary>
36212 When a delivery suffers a temporary failure, a retry record is created
36213 in Exim’s hints database. For remote deliveries, the key for the retry record
36214 is based on the name and/or IP address of the failing remote host. For local
36215 deliveries, the key is normally the entire address, including both the local
36216 part and the domain. This is suitable for most common cases of local delivery
36217 temporary failure – for example, exceeding a mailbox quota should delay only
36218 deliveries to that mailbox, not to the whole domain.
36221 However, in some special cases you may want to treat a temporary local delivery
36222 as a failure associated with the domain, and not with a particular local part.
36223 (For example, if you are storing all mail for some domain in files.) You can do
36224 this by setting <option>retry_use_local_part</option> false.
36227 For all the local transports, its default value is true. For remote transports,
36228 the default value is false for tidiness, but changing the value has no effect
36229 on a remote transport in the current implementation.
36232 <indexterm role="option">
36233 <primary><option>return_path</option></primary>
36236 <informaltable frame="all">
36237 <tgroup cols="4" colsep="0" rowsep="0">
36238 <colspec colwidth="8*" align="left"/>
36239 <colspec colwidth="6*" align="center"/>
36240 <colspec colwidth="6*" align="center"/>
36241 <colspec colwidth="6*" align="right"/>
36244 <entry><option>return_path</option></entry>
36245 <entry>Use: <emphasis>transports</emphasis></entry>
36246 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36247 <entry>Default: <emphasis>unset</emphasis></entry>
36253 <indexterm role="concept">
36254 <primary>envelope sender</primary>
36256 <indexterm role="concept">
36257 <primary>transport</primary>
36258 <secondary>return path; changing</secondary>
36260 <indexterm role="concept">
36261 <primary>return path</primary>
36262 <secondary>changing in transport</secondary>
36264 If this option is set, the string is expanded at transport time and replaces
36265 the existing return path (envelope sender) value in the copy of the message
36266 that is being delivered. An empty return path is permitted. This feature is
36267 designed for remote deliveries, where the value of this option is used in the
36268 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
36269 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
36270 header line, if one is added to the message (see the next option).
36273 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
36274 <option>return_path_on_delivery</option> to the log selector.
36277 <indexterm role="variable">
36278 <primary><varname>$return_path</varname></primary>
36280 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
36281 either the message’s envelope sender, or an address set by the
36282 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
36283 replacement occurs; if it fails for another reason, delivery is deferred. This
36284 option can be used to support VERP (Variable Envelope Return Paths) – see
36285 section <xref linkend="SECTverp"/>.
36288 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
36289 remote server rejects a message at SMTP time, the bounce message is not sent to
36290 the value of this option. It is sent to the previously set errors address.
36291 This defaults to the incoming sender address, but can be changed by setting
36292 <option>errors_to</option> in a router.
36295 <indexterm role="option">
36296 <primary><option>return_path_add</option></primary>
36299 <informaltable frame="all">
36300 <tgroup cols="4" colsep="0" rowsep="0">
36301 <colspec colwidth="8*" align="left"/>
36302 <colspec colwidth="6*" align="center"/>
36303 <colspec colwidth="6*" align="center"/>
36304 <colspec colwidth="6*" align="right"/>
36307 <entry><option>return_path_add</option></entry>
36308 <entry>Use: <emphasis>transports</emphasis></entry>
36309 <entry>Type: <emphasis>boolean</emphasis></entry>
36310 <entry>Default: <emphasis>false</emphasis></entry>
36316 <indexterm role="concept">
36317 <primary><emphasis>Return-path:</emphasis> header line</primary>
36319 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
36320 Although the return path is normally available in the prefix line of BSD
36321 mailboxes, this is commonly not displayed by MUAs, and so the user does not
36322 have easy access to it.
36325 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
36326 the delivery SMTP server makes the final delivery</quote>. This implies that this
36327 header should not be present in incoming messages. Exim has a configuration
36328 option, <option>return_path_remove</option>, which requests removal of this header from
36329 incoming messages, so that delivered messages can safely be resent to other
36333 <indexterm role="option">
36334 <primary><option>shadow_condition</option></primary>
36337 <informaltable frame="all">
36338 <tgroup cols="4" colsep="0" rowsep="0">
36339 <colspec colwidth="8*" align="left"/>
36340 <colspec colwidth="6*" align="center"/>
36341 <colspec colwidth="6*" align="center"/>
36342 <colspec colwidth="6*" align="right"/>
36345 <entry><option>shadow_condition</option></entry>
36346 <entry>Use: <emphasis>transports</emphasis></entry>
36347 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36348 <entry>Default: <emphasis>unset</emphasis></entry>
36354 See <option>shadow_transport</option> below.
36357 <indexterm role="option">
36358 <primary><option>shadow_transport</option></primary>
36361 <informaltable frame="all">
36362 <tgroup cols="4" colsep="0" rowsep="0">
36363 <colspec colwidth="8*" align="left"/>
36364 <colspec colwidth="6*" align="center"/>
36365 <colspec colwidth="6*" align="center"/>
36366 <colspec colwidth="6*" align="right"/>
36369 <entry><option>shadow_transport</option></entry>
36370 <entry>Use: <emphasis>transports</emphasis></entry>
36371 <entry>Type: <emphasis>string</emphasis></entry>
36372 <entry>Default: <emphasis>unset</emphasis></entry>
36378 <indexterm role="concept">
36379 <primary>shadow transport</primary>
36381 <indexterm role="concept">
36382 <primary>transport</primary>
36383 <secondary>shadow</secondary>
36385 A local transport may set the <option>shadow_transport</option> option to the name of
36386 another local transport. Shadow remote transports are not supported.
36389 Whenever a delivery to the main transport succeeds, and either
36390 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
36391 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
36392 passed to the shadow transport, with the same delivery address or addresses. If
36393 expansion fails, no action is taken except that non-forced expansion failures
36394 cause a log line to be written.
36397 The result of the shadow transport is discarded and does not affect the
36398 subsequent processing of the message. Only a single level of shadowing is
36399 provided; the <option>shadow_transport</option> option is ignored on any transport when it
36400 is running as a shadow. Options concerned with output from pipes are also
36401 ignored. The log line for the successful delivery has an item added on the end,
36404 <literallayout class="monospaced">
36405 ST=<shadow transport name>
36408 If the shadow transport did not succeed, the error message is put in
36409 parentheses afterwards. Shadow transports can be used for a number of different
36410 purposes, including keeping more detailed log information than Exim normally
36411 provides, and implementing automatic acknowledgment policies based on message
36412 headers that some sites insist on.
36415 <indexterm role="option">
36416 <primary><option>transport_filter</option></primary>
36419 <informaltable frame="all">
36420 <tgroup cols="4" colsep="0" rowsep="0">
36421 <colspec colwidth="8*" align="left"/>
36422 <colspec colwidth="6*" align="center"/>
36423 <colspec colwidth="6*" align="center"/>
36424 <colspec colwidth="6*" align="right"/>
36427 <entry><option>transport_filter</option></entry>
36428 <entry>Use: <emphasis>transports</emphasis></entry>
36429 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36430 <entry>Default: <emphasis>unset</emphasis></entry>
36436 <indexterm role="concept">
36437 <primary>transport</primary>
36438 <secondary>filter</secondary>
36440 <indexterm role="concept">
36441 <primary>filter</primary>
36442 <secondary>transport filter</secondary>
36444 This option sets up a filtering (in the Unix shell sense) process for messages
36445 at transport time. It should not be confused with mail filtering as set up by
36446 individual users or via a system filter.
36449 When the message is about to be written out, the command specified by
36450 <option>transport_filter</option> is started up in a separate, parallel process, and
36451 the entire message, including the header lines, is passed to it on its standard
36452 input (this in fact is done from a third process, to avoid deadlock). The
36453 command must be specified as an absolute path.
36456 The lines of the message that are written to the transport filter are
36457 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
36458 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
36459 lines beginning with a dot, and also before any processing implied by the
36460 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
36461 <command>pipe</command> transports.
36464 The standard error for the filter process is set to the same destination as its
36465 standard output; this is read and written to the message’s ultimate
36466 destination. The process that writes the message to the filter, the
36467 filter itself, and the original process that reads the result and delivers it
36468 are all run in parallel, like a shell pipeline.
36471 The filter can perform any transformations it likes, but of course should take
36472 care not to break RFC 2822 syntax. Exim does not check the result, except to
36473 test for a final newline when SMTP is in use. All messages transmitted over
36474 SMTP must end with a newline, so Exim supplies one if it is missing.
36477 <indexterm role="concept">
36478 <primary>content scanning</primary>
36479 <secondary>per user</secondary>
36481 A transport filter can be used to provide content-scanning on a per-user basis
36482 at delivery time if the only required effect of the scan is to modify the
36483 message. For example, a content scan could insert a new header line containing
36484 a spam score. This could be interpreted by a filter in the user’s MUA. It is
36485 not possible to discard a message at this stage.
36488 <indexterm role="concept">
36489 <primary>SMTP</primary>
36490 <secondary>SIZE</secondary>
36492 A problem might arise if the filter increases the size of a message that is
36493 being sent down an SMTP connection. If the receiving SMTP server has indicated
36494 support for the SIZE parameter, Exim will have sent the size of the message
36495 at the start of the SMTP session. If what is actually sent is substantially
36496 more, the server might reject the message. This can be worked round by setting
36497 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
36498 additions to the message, or to disable the use of SIZE altogether.
36501 <indexterm role="variable">
36502 <primary><varname>$pipe_addresses</varname></primary>
36504 The value of the <option>transport_filter</option> option is the command string for starting
36505 the filter, which is run directly from Exim, not under a shell. The string is
36506 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
36507 Exim breaks it up into arguments and then expands each argument separately (see
36508 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
36509 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
36510 of arguments, one for each address that applies to this delivery. (This isn’t
36511 an ideal name for this feature here, but as it was already implemented for the
36512 <command>pipe</command> transport, it seemed sensible not to change it.)
36515 <indexterm role="variable">
36516 <primary><varname>$host</varname></primary>
36518 <indexterm role="variable">
36519 <primary><varname>$host_address</varname></primary>
36521 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
36522 transport is a remote one. They contain the name and IP address of the host to
36523 which the message is being sent. For example:
36525 <literallayout class="monospaced">
36526 transport_filter = /some/directory/transport-filter.pl \
36527 $host $host_address $sender_address $pipe_addresses
36530 Two problems arise if you want to use more complicated expansion items to
36531 generate transport filter commands, both of which due to the fact that the
36532 command is split up <emphasis>before</emphasis> expansion.
36537 If an expansion item contains white space, you must quote it, so that it is all
36538 part of the same command item. If the entire option setting is one such
36539 expansion item, you have to take care what kind of quoting you use. For
36542 <literallayout class="monospaced">
36543 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
36546 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
36547 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
36548 stripped by Exim when it read the option’s value. When the value is used, if
36549 the single quotes were missing, the line would be split into two items,
36550 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
36551 Exim tried to expand the first one.
36556 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
36557 expansion cannot generate multiple arguments, or a command name followed by
36558 arguments. Consider this example:
36560 <literallayout class="monospaced">
36561 transport_filter = ${lookup{$host}lsearch{/a/file}\
36562 {$value}{/bin/cat}}
36565 The result of the lookup is interpreted as the name of the command, even
36566 if it contains white space. The simplest way round this is to use a shell:
36568 <literallayout class="monospaced">
36569 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/a/file}\
36570 {$value}{/bin/cat}}
36575 The filter process is run under the same uid and gid as the normal delivery.
36576 For remote deliveries this is the Exim uid/gid by default. The command should
36577 normally yield a zero return code. Transport filters are not supposed to fail.
36578 A non-zero code is taken to mean that the transport filter encountered some
36579 serious problem. Delivery of the message is deferred; the message remains on
36580 the queue and is tried again later. It is not possible to cause a message to be
36581 bounced from a transport filter.
36584 If a transport filter is set on an autoreply transport, the original message is
36585 passed through the filter as it is being copied into the newly generated
36586 message, which happens if the <option>return_message</option> option is set.
36589 <indexterm role="option">
36590 <primary><option>transport_filter_timeout</option></primary>
36593 <informaltable frame="all">
36594 <tgroup cols="4" colsep="0" rowsep="0">
36595 <colspec colwidth="8*" align="left"/>
36596 <colspec colwidth="6*" align="center"/>
36597 <colspec colwidth="6*" align="center"/>
36598 <colspec colwidth="6*" align="right"/>
36601 <entry><option>transport_filter_timeout</option></entry>
36602 <entry>Use: <emphasis>transports</emphasis></entry>
36603 <entry>Type: <emphasis>time</emphasis></entry>
36604 <entry>Default: <emphasis>5m</emphasis></entry>
36610 <indexterm role="concept">
36611 <primary>transport</primary>
36612 <secondary>filter, timeout</secondary>
36614 When Exim is reading the output of a transport filter, it a applies a timeout
36615 that can be set by this option. Exceeding the timeout is normally treated as a
36616 temporary delivery failure. However, if a transport filter is used with a
36617 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
36618 way as a timeout in the pipe command itself. By default, a timeout is a hard
36619 error, but if the <command>pipe</command> transport’s <option>timeout_defer</option> option is set true, it
36620 becomes a temporary error.
36623 <indexterm role="option">
36624 <primary><option>user</option></primary>
36627 <informaltable frame="all">
36628 <tgroup cols="4" colsep="0" rowsep="0">
36629 <colspec colwidth="8*" align="left"/>
36630 <colspec colwidth="6*" align="center"/>
36631 <colspec colwidth="6*" align="center"/>
36632 <colspec colwidth="6*" align="right"/>
36635 <entry><option>user</option></entry>
36636 <entry>Use: <emphasis>transports</emphasis></entry>
36637 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36638 <entry>Default: <emphasis>Exim user</emphasis></entry>
36644 <indexterm role="concept">
36645 <primary>uid (user id)</primary>
36646 <secondary>local delivery</secondary>
36648 <indexterm role="concept">
36649 <primary>transport</primary>
36650 <secondary>user, specifying</secondary>
36652 This option specifies the user under whose uid the delivery process is to be
36653 run, overriding any uid that may have been set by the router. If the user is
36654 given as a name, the uid is looked up from the password data, and the
36655 associated group is taken as the value of the gid to be used if the <option>group</option>
36659 For deliveries that use local transports, a user and group are normally
36660 specified explicitly or implicitly (for example, as a result of
36661 <option>check_local_user</option>) by the router or transport.
36664 <indexterm role="concept">
36665 <primary>hints database</primary>
36666 <secondary>access by remote transport</secondary>
36668 For remote transports, you should leave this option unset unless you really are
36669 sure you know what you are doing. When a remote transport is running, it needs
36670 to be able to access Exim’s hints databases, because each host may have its own
36672 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
36673 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
36674 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
36678 <chapter id="CHAPbatching">
36679 <title>Address batching in local transports</title>
36680 <titleabbrev>Address batching</titleabbrev>
36682 <indexterm role="concept">
36683 <primary>transport</primary>
36684 <secondary>local; address batching in</secondary>
36686 The only remote transport (<command>smtp</command>) is normally configured to handle more than
36687 one address at a time, so that when several addresses are routed to the same
36688 remote host, just one copy of the message is sent. Local transports, however,
36689 normally handle one address at a time. That is, a separate instance of the
36690 transport is run for each address that is routed to the transport. A separate
36691 copy of the message is delivered each time.
36694 <indexterm role="concept">
36695 <primary>batched local delivery</primary>
36697 <indexterm role="option">
36698 <primary><option>batch_max</option></primary>
36700 <indexterm role="option">
36701 <primary><option>batch_id</option></primary>
36703 In special cases, it may be desirable to handle several addresses at once in a
36704 local transport, for example:
36709 In an <command>appendfile</command> transport, when storing messages in files for later
36710 delivery by some other means, a single copy of the message with multiple
36711 recipients saves space.
36716 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
36717 a single copy saves time, and is the normal way LMTP is expected to work.
36722 In a <command>pipe</command> transport, when passing the message
36723 to a scanner program or
36724 to some other delivery mechanism such as UUCP, multiple recipients may be
36730 These three local transports all have the same options for controlling multiple
36731 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
36732 repeating the information for each transport, these options are described here.
36735 The <option>batch_max</option> option specifies the maximum number of addresses that can be
36736 delivered together in a single run of the transport. Its default value is one
36737 (no batching). When more than one address is routed to a transport that has a
36738 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
36739 (that is, in a single run of the transport with multiple recipients), subject
36740 to certain conditions:
36745 <indexterm role="variable">
36746 <primary><varname>$local_part</varname></primary>
36748 If any of the transport’s options contain a reference to <varname>$local_part</varname>, no
36749 batching is possible.
36754 <indexterm role="variable">
36755 <primary><varname>$domain</varname></primary>
36757 If any of the transport’s options contain a reference to <varname>$domain</varname>, only
36758 addresses with the same domain are batched.
36763 <indexterm role="concept">
36764 <primary>customizing</primary>
36765 <secondary>batching condition</secondary>
36767 If <option>batch_id</option> is set, it is expanded for each address, and only those
36768 addresses with the same expanded value are batched. This allows you to specify
36769 customized batching conditions. Failure of the expansion for any reason,
36770 including forced failure, disables batching, but it does not stop the delivery
36776 Batched addresses must also have the same errors address (where to send
36777 delivery errors), the same header additions and removals, the same user and
36778 group for the transport, and if a host list is present, the first host must
36784 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
36785 both when the file or pipe command is specified in the transport, and when it
36786 is specified by a <command>redirect</command> router, but all the batched addresses must of
36787 course be routed to the same file or pipe command. These two transports have an
36788 option called <option>use_bsmtp</option>, which causes them to deliver the message in
36789 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
36790 <option>check_string</option> and <option>escape_string</option> options are forced to the values
36792 <literallayout class="monospaced">
36794 escape_string = ".."
36797 when batched SMTP is in use. A full description of the batch SMTP mechanism is
36798 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
36799 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
36802 <indexterm role="concept">
36803 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
36805 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
36806 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
36807 that are being processed together. If you are using a batching <command>appendfile</command>
36808 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
36809 addresses is to set the <option>envelope_to_add</option> option.
36812 <indexterm role="concept">
36813 <primary><command>pipe</command> transport</primary>
36814 <secondary>with multiple addresses</secondary>
36816 <indexterm role="variable">
36817 <primary><varname>$pipe_addresses</varname></primary>
36819 If you are using a <command>pipe</command> transport without BSMTP, and setting the
36820 transport’s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
36821 the command. This is not a true variable; it is a bit of magic that causes each
36822 of the recipient addresses to be inserted into the command as a separate
36823 argument. This provides a way of accessing all the addresses that are being
36824 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
36825 are specified by a <command>redirect</command> router.
36829 <chapter id="CHAPappendfile">
36830 <title>The appendfile transport</title>
36832 <indexterm role="concept" id="IIDapptra1" class="startofrange">
36833 <primary><command>appendfile</command> transport</primary>
36835 <indexterm role="concept" id="IIDapptra2" class="startofrange">
36836 <primary>transports</primary>
36837 <secondary><command>appendfile</command></secondary>
36839 <indexterm role="concept">
36840 <primary>directory creation</primary>
36842 <indexterm role="concept">
36843 <primary>creating directories</primary>
36845 The <command>appendfile</command> transport delivers a message by appending it to an existing
36846 file, or by creating an entirely new file in a specified directory. Single
36847 files to which messages are appended can be in the traditional Unix mailbox
36848 format, or optionally in the MBX format supported by the Pine MUA and
36849 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
36850 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
36851 to give added protection against failures that happen part-way through the
36852 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
36853 supported. For all file formats, Exim attempts to create as many levels of
36854 directory as necessary, provided that <option>create_directory</option> is set.
36857 The code for the optional formats is not included in the Exim binary by
36858 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
36859 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
36863 <indexterm role="concept">
36864 <primary>quota</primary>
36865 <secondary>system</secondary>
36867 Exim recognizes system quota errors, and generates an appropriate message. Exim
36868 also supports its own quota control within the transport, for use when the
36869 system facility is unavailable or cannot be used for some reason.
36872 If there is an error while appending to a file (for example, quota exceeded or
36873 partition filled), Exim attempts to reset the file’s length and last
36874 modification time back to what they were before. If there is an error while
36875 creating an entirely new file, the new file is removed.
36878 Before appending to a file, a number of security checks are made, and the
36879 file is locked. A detailed description is given below, after the list of
36883 The <command>appendfile</command> transport is most commonly used for local deliveries to
36884 users’ mailboxes. However, it can also be used as a pseudo-remote transport for
36885 putting messages into files for remote delivery by some means other than Exim.
36886 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
36889 <section id="SECTfildiropt">
36890 <title>The file and directory options</title>
36892 The <option>file</option> option specifies a single file, to which the message is appended;
36893 the <option>directory</option> option specifies a directory, in which a new file containing
36894 the message is created. Only one of these two options can be set, and for
36895 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
36898 <indexterm role="variable">
36899 <primary><varname>$address_file</varname></primary>
36901 <indexterm role="variable">
36902 <primary><varname>$local_part</varname></primary>
36904 However, <command>appendfile</command> is also used for delivering messages to files or
36905 directories whose names (or parts of names) are obtained from alias,
36906 forwarding, or filtering operations (for example, a <option>save</option> command in a
36907 user’s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
36908 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
36909 name (or partial name) of the file or directory generated by the redirection
36910 operation. There are two cases:
36915 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
36916 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
36917 common case when users with local accounts use filtering to sort mail into
36918 different folders. See for example, the <command>address_file</command> transport in the
36919 default configuration. If the path ends with a slash, it is assumed to be the
36920 name of a directory. A delivery to a directory can also be forced by setting
36921 <option>maildir_format</option> or <option>mailstore_format</option>.
36926 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
36927 used to determine the file or directory name for the delivery. Normally, the
36928 contents of <varname>$address_file</varname> are used in some way in the string expansion.
36933 <indexterm role="concept">
36934 <primary>Sieve filter</primary>
36935 <secondary>configuring <command>appendfile</command></secondary>
36937 <indexterm role="concept">
36938 <primary>Sieve filter</primary>
36939 <secondary>relative mailbox path handling</secondary>
36941 As an example of the second case, consider an environment where users do not
36942 have home directories. They may be permitted to use Exim filter commands of the
36945 <literallayout class="monospaced">
36949 or Sieve filter commands of the form:
36951 <literallayout class="monospaced">
36952 require "fileinto";
36953 fileinto "folder23";
36956 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
36957 must transform the relative path into an appropriate absolute file name. In the
36958 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
36959 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
36960 way of handling this requirement:
36962 <literallayout class="monospaced">
36963 file = ${if eq{$address_file}{inbox} \
36964 {/var/mail/$local_part} \
36965 {${if eq{${substr_0_1:$address_file}}{/} \
36967 {$home/mail/$address_file} \
36972 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
36973 location, absolute paths are used without change, and other folders are in the
36974 <filename>mail</filename> directory within the home directory.
36977 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
36978 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
36979 the router. In particular, this is the case if <option>check_local_user</option> is set. If
36980 you want to prevent this happening at routing time, you can set
36981 <option>router_home_directory</option> empty. This forces the router to pass the relative
36982 path to the transport.
36985 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
36986 the <option>file</option> or <option>directory</option> option is still used if it is set.
36989 <section id="SECID134">
36990 <title>Private options for appendfile</title>
36992 <indexterm role="concept">
36993 <primary>options</primary>
36994 <secondary><command>appendfile</command> transport</secondary>
36998 <indexterm role="option">
36999 <primary><option>allow_fifo</option></primary>
37002 <informaltable frame="all">
37003 <tgroup cols="4" colsep="0" rowsep="0">
37004 <colspec colwidth="8*" align="left"/>
37005 <colspec colwidth="6*" align="center"/>
37006 <colspec colwidth="6*" align="center"/>
37007 <colspec colwidth="6*" align="right"/>
37010 <entry><option>allow_fifo</option></entry>
37011 <entry>Use: <emphasis>appendfile</emphasis></entry>
37012 <entry>Type: <emphasis>boolean</emphasis></entry>
37013 <entry>Default: <emphasis>false</emphasis></entry>
37019 <indexterm role="concept">
37020 <primary>fifo (named pipe)</primary>
37022 <indexterm role="concept">
37023 <primary>named pipe (fifo)</primary>
37025 <indexterm role="concept">
37026 <primary>pipe</primary>
37027 <secondary>named (fifo)</secondary>
37029 Setting this option permits delivery to named pipes (FIFOs) as well as to
37030 regular files. If no process is reading the named pipe at delivery time, the
37031 delivery is deferred.
37034 <indexterm role="option">
37035 <primary><option>allow_symlink</option></primary>
37038 <informaltable frame="all">
37039 <tgroup cols="4" colsep="0" rowsep="0">
37040 <colspec colwidth="8*" align="left"/>
37041 <colspec colwidth="6*" align="center"/>
37042 <colspec colwidth="6*" align="center"/>
37043 <colspec colwidth="6*" align="right"/>
37046 <entry><option>allow_symlink</option></entry>
37047 <entry>Use: <emphasis>appendfile</emphasis></entry>
37048 <entry>Type: <emphasis>boolean</emphasis></entry>
37049 <entry>Default: <emphasis>false</emphasis></entry>
37055 <indexterm role="concept">
37056 <primary>symbolic link</primary>
37057 <secondary>to mailbox</secondary>
37059 <indexterm role="concept">
37060 <primary>mailbox</primary>
37061 <secondary>symbolic link</secondary>
37063 By default, <command>appendfile</command> will not deliver if the path name for the file is
37064 that of a symbolic link. Setting this option relaxes that constraint, but there
37065 are security issues involved in the use of symbolic links. Be sure you know
37066 what you are doing if you set this. Details of exactly what this option affects
37067 are included in the discussion which follows this list of options.
37070 <indexterm role="option">
37071 <primary><option>batch_id</option></primary>
37074 <informaltable frame="all">
37075 <tgroup cols="4" colsep="0" rowsep="0">
37076 <colspec colwidth="8*" align="left"/>
37077 <colspec colwidth="6*" align="center"/>
37078 <colspec colwidth="6*" align="center"/>
37079 <colspec colwidth="6*" align="right"/>
37082 <entry><option>batch_id</option></entry>
37083 <entry>Use: <emphasis>appendfile</emphasis></entry>
37084 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37085 <entry>Default: <emphasis>unset</emphasis></entry>
37091 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
37092 However, batching is automatically disabled for <command>appendfile</command> deliveries that
37093 happen as a result of forwarding or aliasing or other redirection directly to a
37097 <indexterm role="option">
37098 <primary><option>batch_max</option></primary>
37101 <informaltable frame="all">
37102 <tgroup cols="4" colsep="0" rowsep="0">
37103 <colspec colwidth="8*" align="left"/>
37104 <colspec colwidth="6*" align="center"/>
37105 <colspec colwidth="6*" align="center"/>
37106 <colspec colwidth="6*" align="right"/>
37109 <entry><option>batch_max</option></entry>
37110 <entry>Use: <emphasis>appendfile</emphasis></entry>
37111 <entry>Type: <emphasis>integer</emphasis></entry>
37112 <entry>Default: <emphasis>1</emphasis></entry>
37118 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
37121 <indexterm role="option">
37122 <primary><option>check_group</option></primary>
37125 <informaltable frame="all">
37126 <tgroup cols="4" colsep="0" rowsep="0">
37127 <colspec colwidth="8*" align="left"/>
37128 <colspec colwidth="6*" align="center"/>
37129 <colspec colwidth="6*" align="center"/>
37130 <colspec colwidth="6*" align="right"/>
37133 <entry><option>check_group</option></entry>
37134 <entry>Use: <emphasis>appendfile</emphasis></entry>
37135 <entry>Type: <emphasis>boolean</emphasis></entry>
37136 <entry>Default: <emphasis>false</emphasis></entry>
37142 When this option is set, the group owner of the file defined by the <option>file</option>
37143 option is checked to see that it is the same as the group under which the
37144 delivery process is running. The default setting is false because the default
37145 file mode is 0600, which means that the group is irrelevant.
37148 <indexterm role="option">
37149 <primary><option>check_owner</option></primary>
37152 <informaltable frame="all">
37153 <tgroup cols="4" colsep="0" rowsep="0">
37154 <colspec colwidth="8*" align="left"/>
37155 <colspec colwidth="6*" align="center"/>
37156 <colspec colwidth="6*" align="center"/>
37157 <colspec colwidth="6*" align="right"/>
37160 <entry><option>check_owner</option></entry>
37161 <entry>Use: <emphasis>appendfile</emphasis></entry>
37162 <entry>Type: <emphasis>boolean</emphasis></entry>
37163 <entry>Default: <emphasis>true</emphasis></entry>
37169 When this option is set, the owner of the file defined by the <option>file</option> option
37170 is checked to ensure that it is the same as the user under which the delivery
37171 process is running.
37174 <indexterm role="option">
37175 <primary><option>check_string</option></primary>
37178 <informaltable frame="all">
37179 <tgroup cols="4" colsep="0" rowsep="0">
37180 <colspec colwidth="8*" align="left"/>
37181 <colspec colwidth="6*" align="center"/>
37182 <colspec colwidth="6*" align="center"/>
37183 <colspec colwidth="6*" align="right"/>
37186 <entry><option>check_string</option></entry>
37187 <entry>Use: <emphasis>appendfile</emphasis></entry>
37188 <entry>Type: <emphasis>string</emphasis></entry>
37189 <entry>Default: <emphasis>see below</emphasis></entry>
37195 <indexterm role="concept">
37196 <primary><quote>From</quote> line</primary>
37198 As <command>appendfile</command> writes the message, the start of each line is tested for
37199 matching <option>check_string</option>, and if it does, the initial matching characters are
37200 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
37201 a literal string, not a regular expression, and the case of any letters it
37202 contains is significant.
37205 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
37206 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
37207 configuration are ignored. Otherwise, they default to <quote>From </quote> and
37208 <quote>>From </quote> when the <option>file</option> option is set, and unset when any of the
37209 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
37212 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
37213 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
37214 <quote>From </quote> indicates the start of a new message. All four options need changing
37215 if another format is used. For example, to deliver to mailboxes in MMDF format:
37216 <indexterm role="concept">
37217 <primary>MMDF format mailbox</primary>
37219 <indexterm role="concept">
37220 <primary>mailbox</primary>
37221 <secondary>MMDF format</secondary>
37224 <literallayout class="monospaced">
37225 check_string = "\1\1\1\1\n"
37226 escape_string = "\1\1\1\1 \n"
37227 message_prefix = "\1\1\1\1\n"
37228 message_suffix = "\1\1\1\1\n"
37231 <indexterm role="option">
37232 <primary><option>create_directory</option></primary>
37235 <informaltable frame="all">
37236 <tgroup cols="4" colsep="0" rowsep="0">
37237 <colspec colwidth="8*" align="left"/>
37238 <colspec colwidth="6*" align="center"/>
37239 <colspec colwidth="6*" align="center"/>
37240 <colspec colwidth="6*" align="right"/>
37243 <entry><option>create_directory</option></entry>
37244 <entry>Use: <emphasis>appendfile</emphasis></entry>
37245 <entry>Type: <emphasis>boolean</emphasis></entry>
37246 <entry>Default: <emphasis>true</emphasis></entry>
37252 <indexterm role="concept">
37253 <primary>directory creation</primary>
37255 When this option is true, Exim attempts to create any missing superior
37256 directories for the file that it is about to write. A created directory’s mode
37257 is given by the <option>directory_mode</option> option.
37260 The group ownership of a newly created directory is highly dependent on the
37261 operating system (and possibly the file system) that is being used. For
37262 example, in Solaris, if the parent directory has the setgid bit set, its group
37263 is propagated to the child; if not, the currently set group is used. However,
37264 in FreeBSD, the parent’s group is always used.
37267 <indexterm role="option">
37268 <primary><option>create_file</option></primary>
37271 <informaltable frame="all">
37272 <tgroup cols="4" colsep="0" rowsep="0">
37273 <colspec colwidth="8*" align="left"/>
37274 <colspec colwidth="6*" align="center"/>
37275 <colspec colwidth="6*" align="center"/>
37276 <colspec colwidth="6*" align="right"/>
37279 <entry><option>create_file</option></entry>
37280 <entry>Use: <emphasis>appendfile</emphasis></entry>
37281 <entry>Type: <emphasis>string</emphasis></entry>
37282 <entry>Default: <emphasis>anywhere</emphasis></entry>
37288 This option constrains the location of files and directories that are created
37289 by this transport. It applies to files defined by the <option>file</option> option and
37290 directories defined by the <option>directory</option> option. In the case of maildir
37291 delivery, it applies to the top level directory, not the maildir directories
37295 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
37296 <quote>belowhome</quote>. In the second and third cases, a home directory must have been
37297 set for the transport. This option is not useful when an explicit file name is
37298 given for normal mailbox deliveries. It is intended for the case when file
37299 names are generated from users’ <filename>.forward</filename> files. These are usually handled
37300 by an <command>appendfile</command> transport called <option>address_file</option>. See also
37301 <option>file_must_exist</option>.
37304 <indexterm role="option">
37305 <primary><option>directory</option></primary>
37308 <informaltable frame="all">
37309 <tgroup cols="4" colsep="0" rowsep="0">
37310 <colspec colwidth="8*" align="left"/>
37311 <colspec colwidth="6*" align="center"/>
37312 <colspec colwidth="6*" align="center"/>
37313 <colspec colwidth="6*" align="right"/>
37316 <entry><option>directory</option></entry>
37317 <entry>Use: <emphasis>appendfile</emphasis></entry>
37318 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37319 <entry>Default: <emphasis>unset</emphasis></entry>
37325 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
37326 or <option>directory</option> must be set, unless the delivery is the direct result of a
37327 redirection (see section <xref linkend="SECTfildiropt"/>).
37330 When <option>directory</option> is set, the string is expanded, and the message is delivered
37331 into a new file or files in or below the given directory, instead of being
37332 appended to a single mailbox file. A number of different formats are provided
37333 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
37334 <xref linkend="SECTopdir"/> for further details of this form of delivery.
37337 <indexterm role="option">
37338 <primary><option>directory_file</option></primary>
37341 <informaltable frame="all">
37342 <tgroup cols="4" colsep="0" rowsep="0">
37343 <colspec colwidth="8*" align="left"/>
37344 <colspec colwidth="6*" align="center"/>
37345 <colspec colwidth="6*" align="center"/>
37346 <colspec colwidth="6*" align="right"/>
37349 <entry><option>directory_file</option></entry>
37350 <entry>Use: <emphasis>appendfile</emphasis></entry>
37351 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37352 <entry>Default: <emphasis>see below</emphasis></entry>
37358 <indexterm role="concept">
37359 <primary>base62</primary>
37361 <indexterm role="variable">
37362 <primary><varname>$inode</varname></primary>
37364 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
37365 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
37366 whose name is obtained by expanding this string. The default value is:
37368 <literallayout class="monospaced">
37369 q${base62:$tod_epoch}-$inode
37372 This generates a unique name from the current time, in base 62 form, and the
37373 inode of the file. The variable <varname>$inode</varname> is available only when expanding this
37377 <indexterm role="option">
37378 <primary><option>directory_mode</option></primary>
37381 <informaltable frame="all">
37382 <tgroup cols="4" colsep="0" rowsep="0">
37383 <colspec colwidth="8*" align="left"/>
37384 <colspec colwidth="6*" align="center"/>
37385 <colspec colwidth="6*" align="center"/>
37386 <colspec colwidth="6*" align="right"/>
37389 <entry><option>directory_mode</option></entry>
37390 <entry>Use: <emphasis>appendfile</emphasis></entry>
37391 <entry>Type: <emphasis>octal integer</emphasis></entry>
37392 <entry>Default: <emphasis>0700</emphasis></entry>
37398 If <command>appendfile</command> creates any directories as a result of the
37399 <option>create_directory</option> option, their mode is specified by this option.
37402 <indexterm role="option">
37403 <primary><option>escape_string</option></primary>
37406 <informaltable frame="all">
37407 <tgroup cols="4" colsep="0" rowsep="0">
37408 <colspec colwidth="8*" align="left"/>
37409 <colspec colwidth="6*" align="center"/>
37410 <colspec colwidth="6*" align="center"/>
37411 <colspec colwidth="6*" align="right"/>
37414 <entry><option>escape_string</option></entry>
37415 <entry>Use: <emphasis>appendfile</emphasis></entry>
37416 <entry>Type: <emphasis>string</emphasis></entry>
37417 <entry>Default: <emphasis>see description</emphasis></entry>
37423 See <option>check_string</option> above.
37426 <indexterm role="option">
37427 <primary><option>file</option></primary>
37430 <informaltable frame="all">
37431 <tgroup cols="4" colsep="0" rowsep="0">
37432 <colspec colwidth="8*" align="left"/>
37433 <colspec colwidth="6*" align="center"/>
37434 <colspec colwidth="6*" align="center"/>
37435 <colspec colwidth="6*" align="right"/>
37438 <entry><option>file</option></entry>
37439 <entry>Use: <emphasis>appendfile</emphasis></entry>
37440 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37441 <entry>Default: <emphasis>unset</emphasis></entry>
37447 This option is mutually exclusive with the <option>directory</option> option, but one of
37448 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
37449 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
37450 specifies a single file, to which the message is appended. One or more of
37451 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
37452 <option>file</option>.
37455 <indexterm role="concept">
37456 <primary>NFS</primary>
37457 <secondary>lock file</secondary>
37459 <indexterm role="concept">
37460 <primary>locking files</primary>
37462 <indexterm role="concept">
37463 <primary>lock files</primary>
37465 If you are using more than one host to deliver over NFS into the same
37466 mailboxes, you should always use lock files.
37469 The string value is expanded for each delivery, and must yield an absolute
37470 path. The most common settings of this option are variations on one of these
37473 <literallayout class="monospaced">
37474 file = /var/spool/mail/$local_part
37475 file = /home/$local_part/inbox
37479 <indexterm role="concept">
37480 <primary><quote>sticky</quote> bit</primary>
37482 In the first example, all deliveries are done into the same directory. If Exim
37483 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
37484 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
37485 deliveries to be possible, or alternatively the <option>group</option> option can be used to
37486 run the delivery under a group id which has write access to the directory.
37489 <indexterm role="option">
37490 <primary><option>file_format</option></primary>
37493 <informaltable frame="all">
37494 <tgroup cols="4" colsep="0" rowsep="0">
37495 <colspec colwidth="8*" align="left"/>
37496 <colspec colwidth="6*" align="center"/>
37497 <colspec colwidth="6*" align="center"/>
37498 <colspec colwidth="6*" align="right"/>
37501 <entry><option>file_format</option></entry>
37502 <entry>Use: <emphasis>appendfile</emphasis></entry>
37503 <entry>Type: <emphasis>string</emphasis></entry>
37504 <entry>Default: <emphasis>unset</emphasis></entry>
37510 <indexterm role="concept">
37511 <primary>file</primary>
37512 <secondary>mailbox; checking existing format</secondary>
37514 This option requests the transport to check the format of an existing file
37515 before adding to it. The check consists of matching a specific string at the
37516 start of the file. The value of the option consists of an even number of
37517 colon-separated strings. The first of each pair is the test string, and the
37518 second is the name of a transport. If the transport associated with a matched
37519 string is not the current transport, control is passed over to the other
37520 transport. For example, suppose the standard <command>local_delivery</command> transport has
37523 <literallayout class="monospaced">
37524 file_format = "From : local_delivery :\
37525 \1\1\1\1\n : local_mmdf_delivery"
37528 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
37529 a mailbox begins with four binary ones followed by a newline, control is passed
37530 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
37531 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
37532 is assumed to match the current transport. If the start of a mailbox doesn’t
37533 match any string, or if the transport named for a given string is not defined,
37534 delivery is deferred.
37537 <indexterm role="option">
37538 <primary><option>file_must_exist</option></primary>
37541 <informaltable frame="all">
37542 <tgroup cols="4" colsep="0" rowsep="0">
37543 <colspec colwidth="8*" align="left"/>
37544 <colspec colwidth="6*" align="center"/>
37545 <colspec colwidth="6*" align="center"/>
37546 <colspec colwidth="6*" align="right"/>
37549 <entry><option>file_must_exist</option></entry>
37550 <entry>Use: <emphasis>appendfile</emphasis></entry>
37551 <entry>Type: <emphasis>boolean</emphasis></entry>
37552 <entry>Default: <emphasis>false</emphasis></entry>
37558 If this option is true, the file specified by the <option>file</option> option must exist.
37559 A temporary error occurs if it does not, causing delivery to be deferred.
37560 If this option is false, the file is created if it does not exist.
37563 <indexterm role="option">
37564 <primary><option>lock_fcntl_timeout</option></primary>
37567 <informaltable frame="all">
37568 <tgroup cols="4" colsep="0" rowsep="0">
37569 <colspec colwidth="8*" align="left"/>
37570 <colspec colwidth="6*" align="center"/>
37571 <colspec colwidth="6*" align="center"/>
37572 <colspec colwidth="6*" align="right"/>
37575 <entry><option>lock_fcntl_timeout</option></entry>
37576 <entry>Use: <emphasis>appendfile</emphasis></entry>
37577 <entry>Type: <emphasis>time</emphasis></entry>
37578 <entry>Default: <emphasis>0s</emphasis></entry>
37584 <indexterm role="concept">
37585 <primary>timeout</primary>
37586 <secondary>mailbox locking</secondary>
37588 <indexterm role="concept">
37589 <primary>mailbox</primary>
37590 <secondary>locking, blocking and non-blocking</secondary>
37592 <indexterm role="concept">
37593 <primary>locking files</primary>
37595 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
37596 when locking an open mailbox file. If the call fails, the delivery process
37597 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
37598 Non-blocking calls are used so that the file is not kept open during the wait
37599 for the lock; the reason for this is to make it as safe as possible for
37600 deliveries over NFS in the case when processes might be accessing an NFS
37601 mailbox without using a lock file. This should not be done, but
37602 misunderstandings and hence misconfigurations are not unknown.
37605 On a busy system, however, the performance of a non-blocking lock approach is
37606 not as good as using a blocking lock with a timeout. In this case, the waiting
37607 is done inside the system call, and Exim’s delivery process acquires the lock
37608 and can proceed as soon as the previous lock holder releases it.
37611 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
37612 timeout, are used. There may still be some retrying: the maximum number of
37615 <literallayout class="monospaced">
37616 (lock_retries * lock_interval) / lock_fcntl_timeout
37619 rounded up to the next whole number. In other words, the total time during
37620 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
37621 <option>lock_fcntl_timeout</option> is set very large.
37624 You should consider setting this option if you are getting a lot of delayed
37625 local deliveries because of errors of the form
37627 <literallayout class="monospaced">
37628 failed to lock mailbox /some/file (fcntl)
37631 <indexterm role="option">
37632 <primary><option>lock_flock_timeout</option></primary>
37635 <informaltable frame="all">
37636 <tgroup cols="4" colsep="0" rowsep="0">
37637 <colspec colwidth="8*" align="left"/>
37638 <colspec colwidth="6*" align="center"/>
37639 <colspec colwidth="6*" align="center"/>
37640 <colspec colwidth="6*" align="right"/>
37643 <entry><option>lock_flock_timeout</option></entry>
37644 <entry>Use: <emphasis>appendfile</emphasis></entry>
37645 <entry>Type: <emphasis>time</emphasis></entry>
37646 <entry>Default: <emphasis>0s</emphasis></entry>
37652 This timeout applies to file locking when using <function>flock()</function> (see
37653 <option>use_flock</option>); the timeout operates in a similar manner to
37654 <option>lock_fcntl_timeout</option>.
37657 <indexterm role="option">
37658 <primary><option>lock_interval</option></primary>
37661 <informaltable frame="all">
37662 <tgroup cols="4" colsep="0" rowsep="0">
37663 <colspec colwidth="8*" align="left"/>
37664 <colspec colwidth="6*" align="center"/>
37665 <colspec colwidth="6*" align="center"/>
37666 <colspec colwidth="6*" align="right"/>
37669 <entry><option>lock_interval</option></entry>
37670 <entry>Use: <emphasis>appendfile</emphasis></entry>
37671 <entry>Type: <emphasis>time</emphasis></entry>
37672 <entry>Default: <emphasis>3s</emphasis></entry>
37678 This specifies the time to wait between attempts to lock the file. See below
37679 for details of locking.
37682 <indexterm role="option">
37683 <primary><option>lock_retries</option></primary>
37686 <informaltable frame="all">
37687 <tgroup cols="4" colsep="0" rowsep="0">
37688 <colspec colwidth="8*" align="left"/>
37689 <colspec colwidth="6*" align="center"/>
37690 <colspec colwidth="6*" align="center"/>
37691 <colspec colwidth="6*" align="right"/>
37694 <entry><option>lock_retries</option></entry>
37695 <entry>Use: <emphasis>appendfile</emphasis></entry>
37696 <entry>Type: <emphasis>integer</emphasis></entry>
37697 <entry>Default: <emphasis>10</emphasis></entry>
37703 This specifies the maximum number of attempts to lock the file. A value of zero
37704 is treated as 1. See below for details of locking.
37707 <indexterm role="option">
37708 <primary><option>lockfile_mode</option></primary>
37711 <informaltable frame="all">
37712 <tgroup cols="4" colsep="0" rowsep="0">
37713 <colspec colwidth="8*" align="left"/>
37714 <colspec colwidth="6*" align="center"/>
37715 <colspec colwidth="6*" align="center"/>
37716 <colspec colwidth="6*" align="right"/>
37719 <entry><option>lockfile_mode</option></entry>
37720 <entry>Use: <emphasis>appendfile</emphasis></entry>
37721 <entry>Type: <emphasis>octal integer</emphasis></entry>
37722 <entry>Default: <emphasis>0600</emphasis></entry>
37728 This specifies the mode of the created lock file, when a lock file is being
37729 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
37732 <indexterm role="option">
37733 <primary><option>lockfile_timeout</option></primary>
37736 <informaltable frame="all">
37737 <tgroup cols="4" colsep="0" rowsep="0">
37738 <colspec colwidth="8*" align="left"/>
37739 <colspec colwidth="6*" align="center"/>
37740 <colspec colwidth="6*" align="center"/>
37741 <colspec colwidth="6*" align="right"/>
37744 <entry><option>lockfile_timeout</option></entry>
37745 <entry>Use: <emphasis>appendfile</emphasis></entry>
37746 <entry>Type: <emphasis>time</emphasis></entry>
37747 <entry>Default: <emphasis>30m</emphasis></entry>
37753 <indexterm role="concept">
37754 <primary>timeout</primary>
37755 <secondary>mailbox locking</secondary>
37757 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
37758 exists and is older than this value, it is assumed to have been left behind by
37759 accident, and Exim attempts to remove it.
37762 <indexterm role="option">
37763 <primary><option>mailbox_filecount</option></primary>
37766 <informaltable frame="all">
37767 <tgroup cols="4" colsep="0" rowsep="0">
37768 <colspec colwidth="8*" align="left"/>
37769 <colspec colwidth="6*" align="center"/>
37770 <colspec colwidth="6*" align="center"/>
37771 <colspec colwidth="6*" align="right"/>
37774 <entry><option>mailbox_filecount</option></entry>
37775 <entry>Use: <emphasis>appendfile</emphasis></entry>
37776 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37777 <entry>Default: <emphasis>unset</emphasis></entry>
37783 <indexterm role="concept">
37784 <primary>mailbox</primary>
37785 <secondary>specifying size of</secondary>
37787 <indexterm role="concept">
37788 <primary>size</primary>
37789 <secondary>of mailbox</secondary>
37791 If this option is set, it is expanded, and the result is taken as the current
37792 number of files in the mailbox. It must be a decimal number, optionally
37793 followed by K or M. This provides a way of obtaining this information from an
37794 external source that maintains the data.
37797 <indexterm role="option">
37798 <primary><option>mailbox_size</option></primary>
37801 <informaltable frame="all">
37802 <tgroup cols="4" colsep="0" rowsep="0">
37803 <colspec colwidth="8*" align="left"/>
37804 <colspec colwidth="6*" align="center"/>
37805 <colspec colwidth="6*" align="center"/>
37806 <colspec colwidth="6*" align="right"/>
37809 <entry><option>mailbox_size</option></entry>
37810 <entry>Use: <emphasis>appendfile</emphasis></entry>
37811 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37812 <entry>Default: <emphasis>unset</emphasis></entry>
37818 <indexterm role="concept">
37819 <primary>mailbox</primary>
37820 <secondary>specifying size of</secondary>
37822 <indexterm role="concept">
37823 <primary>size</primary>
37824 <secondary>of mailbox</secondary>
37826 If this option is set, it is expanded, and the result is taken as the current
37827 size the mailbox. It must be a decimal number, optionally followed by K or M.
37828 This provides a way of obtaining this information from an external source that
37829 maintains the data. This is likely to be helpful for maildir deliveries where
37830 it is computationally expensive to compute the size of a mailbox.
37833 <indexterm role="option">
37834 <primary><option>maildir_format</option></primary>
37837 <informaltable frame="all">
37838 <tgroup cols="4" colsep="0" rowsep="0">
37839 <colspec colwidth="8*" align="left"/>
37840 <colspec colwidth="6*" align="center"/>
37841 <colspec colwidth="6*" align="center"/>
37842 <colspec colwidth="6*" align="right"/>
37845 <entry><option>maildir_format</option></entry>
37846 <entry>Use: <emphasis>appendfile</emphasis></entry>
37847 <entry>Type: <emphasis>boolean</emphasis></entry>
37848 <entry>Default: <emphasis>false</emphasis></entry>
37854 <indexterm role="concept">
37855 <primary>maildir format</primary>
37856 <secondary>specifying</secondary>
37858 If this option is set with the <option>directory</option> option, the delivery is into a new
37859 file, in the <quote>maildir</quote> format that is used by other mail software. When the
37860 transport is activated directly from a <command>redirect</command> router (for example, the
37861 <command>address_file</command> transport in the default configuration), setting
37862 <option>maildir_format</option> causes the path received from the router to be treated as a
37863 directory, whether or not it ends with <literal>/</literal>. This option is available only if
37864 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
37865 <xref linkend="SECTmaildirdelivery"/> below for further details.
37868 <indexterm role="option">
37869 <primary><option>maildir_quota_directory_regex</option></primary>
37872 <informaltable frame="all">
37873 <tgroup cols="4" colsep="0" rowsep="0">
37874 <colspec colwidth="8*" align="left"/>
37875 <colspec colwidth="6*" align="center"/>
37876 <colspec colwidth="6*" align="center"/>
37877 <colspec colwidth="6*" align="right"/>
37880 <entry><option>maildir_quota_directory_regex</option></entry>
37881 <entry>Use: <emphasis>appendfile</emphasis></entry>
37882 <entry>Type: <emphasis>string</emphasis></entry>
37883 <entry>Default: <emphasis>See below</emphasis></entry>
37889 <indexterm role="concept">
37890 <primary>maildir format</primary>
37891 <secondary>quota; directories included in</secondary>
37893 <indexterm role="concept">
37894 <primary>quota</primary>
37895 <secondary>maildir; directories included in</secondary>
37897 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
37898 a regular expression for specifying directories, relative to the quota
37899 directory (see <option>quota_directory</option>), that should be included in the quota
37900 calculation. The default value is:
37902 <literallayout class="monospaced">
37903 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
37906 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
37907 (directories whose names begin with a dot). If you want to exclude the
37908 <filename>Trash</filename>
37909 folder from the count (as some sites do), you need to change this setting to
37911 <literallayout class="monospaced">
37912 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
37915 This uses a negative lookahead in the regular expression to exclude the
37916 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
37917 calculations, quota processing is bypassed for any messages that are delivered
37918 directly into that directory.
37921 <indexterm role="option">
37922 <primary><option>maildir_retries</option></primary>
37925 <informaltable frame="all">
37926 <tgroup cols="4" colsep="0" rowsep="0">
37927 <colspec colwidth="8*" align="left"/>
37928 <colspec colwidth="6*" align="center"/>
37929 <colspec colwidth="6*" align="center"/>
37930 <colspec colwidth="6*" align="right"/>
37933 <entry><option>maildir_retries</option></entry>
37934 <entry>Use: <emphasis>appendfile</emphasis></entry>
37935 <entry>Type: <emphasis>integer</emphasis></entry>
37936 <entry>Default: <emphasis>10</emphasis></entry>
37942 This option specifies the number of times to retry when writing a file in
37943 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
37946 <indexterm role="option">
37947 <primary><option>maildir_tag</option></primary>
37950 <informaltable frame="all">
37951 <tgroup cols="4" colsep="0" rowsep="0">
37952 <colspec colwidth="8*" align="left"/>
37953 <colspec colwidth="6*" align="center"/>
37954 <colspec colwidth="6*" align="center"/>
37955 <colspec colwidth="6*" align="right"/>
37958 <entry><option>maildir_tag</option></entry>
37959 <entry>Use: <emphasis>appendfile</emphasis></entry>
37960 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37961 <entry>Default: <emphasis>unset</emphasis></entry>
37967 This option applies only to deliveries in maildir format, and is described in
37968 section <xref linkend="SECTmaildirdelivery"/> below.
37971 <indexterm role="option">
37972 <primary><option>maildir_use_size_file</option></primary>
37975 <informaltable frame="all">
37976 <tgroup cols="4" colsep="0" rowsep="0">
37977 <colspec colwidth="8*" align="left"/>
37978 <colspec colwidth="6*" align="center"/>
37979 <colspec colwidth="6*" align="center"/>
37980 <colspec colwidth="6*" align="right"/>
37983 <entry><option>maildir_use_size_file</option></entry>
37984 <entry>Use: <emphasis>appendfile</emphasis></entry>
37985 <entry>Type: <emphasis>boolean</emphasis></entry>
37986 <entry>Default: <emphasis>false</emphasis></entry>
37992 <indexterm role="concept">
37993 <primary>maildir format</primary>
37994 <secondary><filename>maildirsize</filename> file</secondary>
37996 Setting this option true enables support for <filename>maildirsize</filename> files. Exim
37997 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
37998 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
37999 value is zero. See <option>maildir_quota_directory_regex</option> above and section
38000 <xref linkend="SECTmaildirdelivery"/> below for further details.
38003 <indexterm role="option">
38004 <primary><option>maildirfolder_create_regex</option></primary>
38007 <informaltable frame="all">
38008 <tgroup cols="4" colsep="0" rowsep="0">
38009 <colspec colwidth="8*" align="left"/>
38010 <colspec colwidth="6*" align="center"/>
38011 <colspec colwidth="6*" align="center"/>
38012 <colspec colwidth="6*" align="right"/>
38015 <entry><option>maildirfolder_create_regex</option></entry>
38016 <entry>Use: <emphasis>appendfile</emphasis></entry>
38017 <entry>Type: <emphasis>string</emphasis></entry>
38018 <entry>Default: <emphasis>unset</emphasis></entry>
38024 <indexterm role="concept">
38025 <primary>maildir format</primary>
38026 <secondary><filename>maildirfolder</filename> file</secondary>
38028 <indexterm role="concept">
38029 <primary><filename>maildirfolder</filename>, creating</primary>
38031 The value of this option is a regular expression. If it is unset, it has no
38032 effect. Otherwise, before a maildir delivery takes place, the pattern is
38033 matched against the name of the maildir directory, that is, the directory
38034 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
38035 delivery. If there is a match, Exim checks for the existence of a file called
38036 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
38037 See section <xref linkend="SECTmaildirdelivery"/> for more details.
38040 <indexterm role="option">
38041 <primary><option>mailstore_format</option></primary>
38044 <informaltable frame="all">
38045 <tgroup cols="4" colsep="0" rowsep="0">
38046 <colspec colwidth="8*" align="left"/>
38047 <colspec colwidth="6*" align="center"/>
38048 <colspec colwidth="6*" align="center"/>
38049 <colspec colwidth="6*" align="right"/>
38052 <entry><option>mailstore_format</option></entry>
38053 <entry>Use: <emphasis>appendfile</emphasis></entry>
38054 <entry>Type: <emphasis>boolean</emphasis></entry>
38055 <entry>Default: <emphasis>false</emphasis></entry>
38061 <indexterm role="concept">
38062 <primary>mailstore format</primary>
38063 <secondary>specifying</secondary>
38065 If this option is set with the <option>directory</option> option, the delivery is into two
38066 new files in <quote>mailstore</quote> format. The option is available only if
38067 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
38068 below for further details.
38071 <indexterm role="option">
38072 <primary><option>mailstore_prefix</option></primary>
38075 <informaltable frame="all">
38076 <tgroup cols="4" colsep="0" rowsep="0">
38077 <colspec colwidth="8*" align="left"/>
38078 <colspec colwidth="6*" align="center"/>
38079 <colspec colwidth="6*" align="center"/>
38080 <colspec colwidth="6*" align="right"/>
38083 <entry><option>mailstore_prefix</option></entry>
38084 <entry>Use: <emphasis>appendfile</emphasis></entry>
38085 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38086 <entry>Default: <emphasis>unset</emphasis></entry>
38092 This option applies only to deliveries in mailstore format, and is described in
38093 section <xref linkend="SECTopdir"/> below.
38096 <indexterm role="option">
38097 <primary><option>mailstore_suffix</option></primary>
38100 <informaltable frame="all">
38101 <tgroup cols="4" colsep="0" rowsep="0">
38102 <colspec colwidth="8*" align="left"/>
38103 <colspec colwidth="6*" align="center"/>
38104 <colspec colwidth="6*" align="center"/>
38105 <colspec colwidth="6*" align="right"/>
38108 <entry><option>mailstore_suffix</option></entry>
38109 <entry>Use: <emphasis>appendfile</emphasis></entry>
38110 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38111 <entry>Default: <emphasis>unset</emphasis></entry>
38117 This option applies only to deliveries in mailstore format, and is described in
38118 section <xref linkend="SECTopdir"/> below.
38121 <indexterm role="option">
38122 <primary><option>mbx_format</option></primary>
38125 <informaltable frame="all">
38126 <tgroup cols="4" colsep="0" rowsep="0">
38127 <colspec colwidth="8*" align="left"/>
38128 <colspec colwidth="6*" align="center"/>
38129 <colspec colwidth="6*" align="center"/>
38130 <colspec colwidth="6*" align="right"/>
38133 <entry><option>mbx_format</option></entry>
38134 <entry>Use: <emphasis>appendfile</emphasis></entry>
38135 <entry>Type: <emphasis>boolean</emphasis></entry>
38136 <entry>Default: <emphasis>false</emphasis></entry>
38142 <indexterm role="concept">
38143 <primary>locking files</primary>
38145 <indexterm role="concept">
38146 <primary>file</primary>
38147 <secondary>locking</secondary>
38149 <indexterm role="concept">
38150 <primary>file</primary>
38151 <secondary>MBX format</secondary>
38153 <indexterm role="concept">
38154 <primary>MBX format, specifying</primary>
38156 This option is available only if Exim has been compiled with SUPPORT_MBX
38157 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
38158 the message is appended to the mailbox file in MBX format instead of
38159 traditional Unix format. This format is supported by Pine4 and its associated
38160 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
38163 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
38164 automatically changed by the use of <option>mbx_format</option>. They should normally be set
38165 empty when using MBX format, so this option almost always appears in this
38168 <literallayout class="monospaced">
38174 If none of the locking options are mentioned in the configuration,
38175 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
38176 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
38177 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
38178 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
38179 should not be used if any program that does not use this form of locking is
38180 going to access the mailbox, nor should it be used if the mailbox file is NFS
38181 mounted, because it works only when the mailbox is accessed from a single host.
38184 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
38185 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
38186 (this means for the whole of a Pine or IMAP session), Exim will not be able to
38187 append messages to it.
38190 <indexterm role="option">
38191 <primary><option>message_prefix</option></primary>
38194 <informaltable frame="all">
38195 <tgroup cols="4" colsep="0" rowsep="0">
38196 <colspec colwidth="8*" align="left"/>
38197 <colspec colwidth="6*" align="center"/>
38198 <colspec colwidth="6*" align="center"/>
38199 <colspec colwidth="6*" align="right"/>
38202 <entry><option>message_prefix</option></entry>
38203 <entry>Use: <emphasis>appendfile</emphasis></entry>
38204 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38205 <entry>Default: <emphasis>see below</emphasis></entry>
38211 <indexterm role="concept">
38212 <primary><quote>From</quote> line</primary>
38214 The string specified here is expanded and output at the start of every message.
38215 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
38216 in which case it is:
38218 <literallayout class="monospaced">
38219 message_prefix = "From ${if def:return_path{$return_path}\
38220 {MAILER-DAEMON}} $tod_bsdinbox\n"
38223 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
38224 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
38227 <indexterm role="option">
38228 <primary><option>message_suffix</option></primary>
38231 <informaltable frame="all">
38232 <tgroup cols="4" colsep="0" rowsep="0">
38233 <colspec colwidth="8*" align="left"/>
38234 <colspec colwidth="6*" align="center"/>
38235 <colspec colwidth="6*" align="center"/>
38236 <colspec colwidth="6*" align="right"/>
38239 <entry><option>message_suffix</option></entry>
38240 <entry>Use: <emphasis>appendfile</emphasis></entry>
38241 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38242 <entry>Default: <emphasis>see below</emphasis></entry>
38248 The string specified here is expanded and output at the end of every message.
38249 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
38250 in which case it is a single newline character. The suffix can be suppressed by
38253 <literallayout class="monospaced">
38257 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
38258 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
38261 <indexterm role="option">
38262 <primary><option>mode</option></primary>
38265 <informaltable frame="all">
38266 <tgroup cols="4" colsep="0" rowsep="0">
38267 <colspec colwidth="8*" align="left"/>
38268 <colspec colwidth="6*" align="center"/>
38269 <colspec colwidth="6*" align="center"/>
38270 <colspec colwidth="6*" align="right"/>
38273 <entry><option>mode</option></entry>
38274 <entry>Use: <emphasis>appendfile</emphasis></entry>
38275 <entry>Type: <emphasis>octal integer</emphasis></entry>
38276 <entry>Default: <emphasis>0600</emphasis></entry>
38282 If the output file is created, it is given this mode. If it already exists and
38283 has wider permissions, they are reduced to this mode. If it has narrower
38284 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
38285 if the delivery is the result of a <option>save</option> command in a filter file specifying
38286 a particular mode, the mode of the output file is always forced to take that
38287 value, and this option is ignored.
38290 <indexterm role="option">
38291 <primary><option>mode_fail_narrower</option></primary>
38294 <informaltable frame="all">
38295 <tgroup cols="4" colsep="0" rowsep="0">
38296 <colspec colwidth="8*" align="left"/>
38297 <colspec colwidth="6*" align="center"/>
38298 <colspec colwidth="6*" align="center"/>
38299 <colspec colwidth="6*" align="right"/>
38302 <entry><option>mode_fail_narrower</option></entry>
38303 <entry>Use: <emphasis>appendfile</emphasis></entry>
38304 <entry>Type: <emphasis>boolean</emphasis></entry>
38305 <entry>Default: <emphasis>true</emphasis></entry>
38311 This option applies in the case when an existing mailbox file has a narrower
38312 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
38313 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
38314 continues with the delivery attempt, using the existing mode of the file.
38317 <indexterm role="option">
38318 <primary><option>notify_comsat</option></primary>
38321 <informaltable frame="all">
38322 <tgroup cols="4" colsep="0" rowsep="0">
38323 <colspec colwidth="8*" align="left"/>
38324 <colspec colwidth="6*" align="center"/>
38325 <colspec colwidth="6*" align="center"/>
38326 <colspec colwidth="6*" align="right"/>
38329 <entry><option>notify_comsat</option></entry>
38330 <entry>Use: <emphasis>appendfile</emphasis></entry>
38331 <entry>Type: <emphasis>boolean</emphasis></entry>
38332 <entry>Default: <emphasis>false</emphasis></entry>
38338 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
38339 successful delivery to a user mailbox. This is the daemon that notifies logged
38340 on users about incoming mail.
38343 <indexterm role="option">
38344 <primary><option>quota</option></primary>
38347 <informaltable frame="all">
38348 <tgroup cols="4" colsep="0" rowsep="0">
38349 <colspec colwidth="8*" align="left"/>
38350 <colspec colwidth="6*" align="center"/>
38351 <colspec colwidth="6*" align="center"/>
38352 <colspec colwidth="6*" align="right"/>
38355 <entry><option>quota</option></entry>
38356 <entry>Use: <emphasis>appendfile</emphasis></entry>
38357 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38358 <entry>Default: <emphasis>unset</emphasis></entry>
38364 <indexterm role="concept">
38365 <primary>quota</primary>
38366 <secondary>imposed by Exim</secondary>
38368 This option imposes a limit on the size of the file to which Exim is appending,
38369 or to the total space used in the directory tree when the <option>directory</option> option
38370 is set. In the latter case, computation of the space used is expensive, because
38371 all the files in the directory (and any sub-directories) have to be
38372 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
38373 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
38374 have no shell access to their mailboxes).
38377 As there is no interlock against two simultaneous deliveries into a
38378 multi-file mailbox, it is possible for the quota to be overrun in this case.
38379 For single-file mailboxes, of course, an interlock is a necessity.
38382 A file’s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
38383 may be a lot less than the actual amount of disk space allocated to the file.
38384 If the sizes of a number of files are being added up, the rounding effect can
38385 become quite noticeable, especially on systems that have large block sizes.
38386 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
38387 the obvious value which users understand most easily.
38390 The value of the option is expanded, and must then be a numerical value
38391 (decimal point allowed), optionally followed by one of the letters K, M, or G,
38392 for kilobytes, megabytes, or gigabytes. If Exim is running on a system with
38393 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
38397 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
38400 The expansion happens while Exim is running as root, before it changes uid for
38401 the delivery. This means that files that are inaccessible to the end user can
38402 be used to hold quota values that are looked up in the expansion. When delivery
38403 fails because this quota is exceeded, the handling of the error is as for
38404 system quota failures.
38407 By default, Exim’s quota checking mimics system quotas, and restricts the
38408 mailbox to the specified maximum size, though the value is not accurate to the
38409 last byte, owing to separator lines and additional headers that may get added
38410 during message delivery. When a mailbox is nearly full, large messages may get
38411 refused even though small ones are accepted, because the size of the current
38412 message is added to the quota when the check is made. This behaviour can be
38413 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
38414 for exceeding the quota does not include the current message. Thus, deliveries
38415 continue until the quota has been exceeded; thereafter, no further messages are
38416 delivered. See also <option>quota_warn_threshold</option>.
38419 <indexterm role="option">
38420 <primary><option>quota_directory</option></primary>
38423 <informaltable frame="all">
38424 <tgroup cols="4" colsep="0" rowsep="0">
38425 <colspec colwidth="8*" align="left"/>
38426 <colspec colwidth="6*" align="center"/>
38427 <colspec colwidth="6*" align="center"/>
38428 <colspec colwidth="6*" align="right"/>
38431 <entry><option>quota_directory</option></entry>
38432 <entry>Use: <emphasis>appendfile</emphasis></entry>
38433 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38434 <entry>Default: <emphasis>unset</emphasis></entry>
38440 This option defines the directory to check for quota purposes when delivering
38441 into individual files. The default is the delivery directory, or, if a file
38442 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
38443 delivery directory.
38446 <indexterm role="option">
38447 <primary><option>quota_filecount</option></primary>
38450 <informaltable frame="all">
38451 <tgroup cols="4" colsep="0" rowsep="0">
38452 <colspec colwidth="8*" align="left"/>
38453 <colspec colwidth="6*" align="center"/>
38454 <colspec colwidth="6*" align="center"/>
38455 <colspec colwidth="6*" align="right"/>
38458 <entry><option>quota_filecount</option></entry>
38459 <entry>Use: <emphasis>appendfile</emphasis></entry>
38460 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38461 <entry>Default: <emphasis>0</emphasis></entry>
38467 This option applies when the <option>directory</option> option is set. It limits the total
38468 number of files in the directory (compare the inode limit in system quotas). It
38469 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
38470 failure causes delivery to be deferred. A value of zero is interpreted as
38471 <quote>no quota</quote>.
38474 <indexterm role="option">
38475 <primary><option>quota_is_inclusive</option></primary>
38478 <informaltable frame="all">
38479 <tgroup cols="4" colsep="0" rowsep="0">
38480 <colspec colwidth="8*" align="left"/>
38481 <colspec colwidth="6*" align="center"/>
38482 <colspec colwidth="6*" align="center"/>
38483 <colspec colwidth="6*" align="right"/>
38486 <entry><option>quota_is_inclusive</option></entry>
38487 <entry>Use: <emphasis>appendfile</emphasis></entry>
38488 <entry>Type: <emphasis>boolean</emphasis></entry>
38489 <entry>Default: <emphasis>true</emphasis></entry>
38495 See <option>quota</option> above.
38498 <indexterm role="option">
38499 <primary><option>quota_size_regex</option></primary>
38502 <informaltable frame="all">
38503 <tgroup cols="4" colsep="0" rowsep="0">
38504 <colspec colwidth="8*" align="left"/>
38505 <colspec colwidth="6*" align="center"/>
38506 <colspec colwidth="6*" align="center"/>
38507 <colspec colwidth="6*" align="right"/>
38510 <entry><option>quota_size_regex</option></entry>
38511 <entry>Use: <emphasis>appendfile</emphasis></entry>
38512 <entry>Type: <emphasis>string</emphasis></entry>
38513 <entry>Default: <emphasis>unset</emphasis></entry>
38519 This option applies when one of the delivery modes that writes a separate file
38520 for each message is being used. When Exim wants to find the size of one of
38521 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
38522 If this is set to a regular expression that matches the file name, and it
38523 captures one string, that string is interpreted as a representation of the
38524 file’s size. The value of <option>quota_size_regex</option> is not expanded.
38527 This feature is useful only when users have no shell access to their mailboxes
38528 – otherwise they could defeat the quota simply by renaming the files. This
38529 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
38530 the file length to the file name. For example:
38532 <literallayout class="monospaced">
38533 maildir_tag = ,S=$message_size
38534 quota_size_regex = ,S=(\d+)
38537 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
38538 number of lines in the message.
38541 The regular expression should not assume that the length is at the end of the
38542 file name (even though <option>maildir_tag</option> puts it there) because maildir MUAs
38543 sometimes add other information onto the ends of message file names.
38546 <indexterm role="option">
38547 <primary><option>quota_warn_message</option></primary>
38550 <informaltable frame="all">
38551 <tgroup cols="4" colsep="0" rowsep="0">
38552 <colspec colwidth="8*" align="left"/>
38553 <colspec colwidth="6*" align="center"/>
38554 <colspec colwidth="6*" align="center"/>
38555 <colspec colwidth="6*" align="right"/>
38558 <entry><option>quota_warn_message</option></entry>
38559 <entry>Use: <emphasis>appendfile</emphasis></entry>
38560 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38561 <entry>Default: <emphasis>see below</emphasis></entry>
38567 See below for the use of this option. If it is not set when
38568 <option>quota_warn_threshold</option> is set, it defaults to
38570 <literallayout class="monospaced">
38571 quota_warn_message = "\
38572 To: $local_part@$domain\n\
38573 Subject: Your mailbox\n\n\
38574 This message is automatically created \
38575 by mail delivery software.\n\n\
38576 The size of your mailbox has exceeded \
38577 a warning threshold that is\n\
38578 set by the system administrator.\n"
38581 <indexterm role="option">
38582 <primary><option>quota_warn_threshold</option></primary>
38585 <informaltable frame="all">
38586 <tgroup cols="4" colsep="0" rowsep="0">
38587 <colspec colwidth="8*" align="left"/>
38588 <colspec colwidth="6*" align="center"/>
38589 <colspec colwidth="6*" align="center"/>
38590 <colspec colwidth="6*" align="right"/>
38593 <entry><option>quota_warn_threshold</option></entry>
38594 <entry>Use: <emphasis>appendfile</emphasis></entry>
38595 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38596 <entry>Default: <emphasis>0</emphasis></entry>
38602 <indexterm role="concept">
38603 <primary>quota</primary>
38604 <secondary>warning threshold</secondary>
38606 <indexterm role="concept">
38607 <primary>mailbox</primary>
38608 <secondary>size warning</secondary>
38610 <indexterm role="concept">
38611 <primary>size</primary>
38612 <secondary>of mailbox</secondary>
38614 This option is expanded in the same way as <option>quota</option> (see above). If the
38615 resulting value is greater than zero, and delivery of the message causes the
38616 size of the file or total space in the directory tree to cross the given
38617 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
38618 may be specified as a percentage of it by following the value with a percent
38621 <literallayout class="monospaced">
38623 quota_warn_threshold = 75%
38626 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
38627 percent sign is ignored.
38630 The warning message itself is specified by the <option>quota_warn_message</option> option,
38631 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
38632 warning message. These do not necessarily have to include the recipient(s) of
38633 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
38634 can include any other header lines that you want. If you do not include a
38635 <emphasis>From:</emphasis> line, the default is:
38637 <literallayout class="monospaced">
38638 From: Mail Delivery System <mailer-daemon@$qualify_domain_sender>
38641 <indexterm role="option">
38642 <primary><option>errors_reply_to</option></primary>
38644 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
38648 The <option>quota</option> option does not have to be set in order to use this option; they
38649 are independent of one another except when the threshold is specified as a
38653 <indexterm role="option">
38654 <primary><option>use_bsmtp</option></primary>
38657 <informaltable frame="all">
38658 <tgroup cols="4" colsep="0" rowsep="0">
38659 <colspec colwidth="8*" align="left"/>
38660 <colspec colwidth="6*" align="center"/>
38661 <colspec colwidth="6*" align="center"/>
38662 <colspec colwidth="6*" align="right"/>
38665 <entry><option>use_bsmtp</option></entry>
38666 <entry>Use: <emphasis>appendfile</emphasis></entry>
38667 <entry>Type: <emphasis>boolean</emphasis></entry>
38668 <entry>Default: <emphasis>false</emphasis></entry>
38674 <indexterm role="concept">
38675 <primary>envelope sender</primary>
38677 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
38678 format, with the envelope sender and recipient(s) included as SMTP commands. If
38679 you want to include a leading HELO command with such messages, you can do
38680 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
38681 for details of batch SMTP.
38684 <indexterm role="option">
38685 <primary><option>use_crlf</option></primary>
38688 <informaltable frame="all">
38689 <tgroup cols="4" colsep="0" rowsep="0">
38690 <colspec colwidth="8*" align="left"/>
38691 <colspec colwidth="6*" align="center"/>
38692 <colspec colwidth="6*" align="center"/>
38693 <colspec colwidth="6*" align="right"/>
38696 <entry><option>use_crlf</option></entry>
38697 <entry>Use: <emphasis>appendfile</emphasis></entry>
38698 <entry>Type: <emphasis>boolean</emphasis></entry>
38699 <entry>Default: <emphasis>false</emphasis></entry>
38705 <indexterm role="concept">
38706 <primary>carriage return</primary>
38708 <indexterm role="concept">
38709 <primary>linefeed</primary>
38711 This option causes lines to be terminated with the two-character CRLF sequence
38712 (carriage return, linefeed) instead of just a linefeed character. In the case
38713 of batched SMTP, the byte sequence written to the file is then an exact image
38714 of what would be sent down a real SMTP connection.
38717 <emphasis role="bold">Note:</emphasis> The contents of the <option>message_prefix</option> and <option>message_suffix</option> options
38718 (which are used to supply the traditional <quote>From </quote> and blank line separators
38719 in Berkeley-style mailboxes) are written verbatim, so must contain their own
38720 carriage return characters if these are needed. In cases where these options
38721 have non-empty defaults, the values end with a single linefeed, so they must be
38722 changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
38725 <indexterm role="option">
38726 <primary><option>use_fcntl_lock</option></primary>
38729 <informaltable frame="all">
38730 <tgroup cols="4" colsep="0" rowsep="0">
38731 <colspec colwidth="8*" align="left"/>
38732 <colspec colwidth="6*" align="center"/>
38733 <colspec colwidth="6*" align="center"/>
38734 <colspec colwidth="6*" align="right"/>
38737 <entry><option>use_fcntl_lock</option></entry>
38738 <entry>Use: <emphasis>appendfile</emphasis></entry>
38739 <entry>Type: <emphasis>boolean</emphasis></entry>
38740 <entry>Default: <emphasis>see below</emphasis></entry>
38746 This option controls the use of the <function>fcntl()</function> function to lock a file for
38747 exclusive use when a message is being appended. It is set by default unless
38748 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
38749 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
38750 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
38753 <indexterm role="option">
38754 <primary><option>use_flock_lock</option></primary>
38757 <informaltable frame="all">
38758 <tgroup cols="4" colsep="0" rowsep="0">
38759 <colspec colwidth="8*" align="left"/>
38760 <colspec colwidth="6*" align="center"/>
38761 <colspec colwidth="6*" align="center"/>
38762 <colspec colwidth="6*" align="right"/>
38765 <entry><option>use_flock_lock</option></entry>
38766 <entry>Use: <emphasis>appendfile</emphasis></entry>
38767 <entry>Type: <emphasis>boolean</emphasis></entry>
38768 <entry>Default: <emphasis>false</emphasis></entry>
38774 This option is provided to support the use of <function>flock()</function> for file locking, for
38775 the few situations where it is needed. Most modern operating systems support
38776 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
38777 each other. Exim uses <function>fcntl()</function> locking by default.
38780 This option is required only if you are using an operating system where
38781 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
38782 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
38783 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
38786 <indexterm role="concept">
38787 <primary>Solaris</primary>
38788 <secondary><function>flock()</function> support</secondary>
38790 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
38791 have it (and some, I think, provide a not quite right version built on top of
38792 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
38793 the ability to use it, and any attempt to do so will cause a configuration
38797 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
38798 is just being mapped onto <function>fcntl()</function> by the OS).
38801 <indexterm role="option">
38802 <primary><option>use_lockfile</option></primary>
38805 <informaltable frame="all">
38806 <tgroup cols="4" colsep="0" rowsep="0">
38807 <colspec colwidth="8*" align="left"/>
38808 <colspec colwidth="6*" align="center"/>
38809 <colspec colwidth="6*" align="center"/>
38810 <colspec colwidth="6*" align="right"/>
38813 <entry><option>use_lockfile</option></entry>
38814 <entry>Use: <emphasis>appendfile</emphasis></entry>
38815 <entry>Type: <emphasis>boolean</emphasis></entry>
38816 <entry>Default: <emphasis>see below</emphasis></entry>
38822 If this option is turned off, Exim does not attempt to create a lock file when
38823 appending to a mailbox file. In this situation, the only locking is by
38824 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
38825 sure that every MUA that is ever going to look at your users’ mailboxes uses
38826 <function>fcntl()</function> rather than a lock file, and even then only when you are not
38827 delivering over NFS from more than one host.
38830 <indexterm role="concept">
38831 <primary>NFS</primary>
38832 <secondary>lock file</secondary>
38834 In order to append to an NFS file safely from more than one host, it is
38835 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
38836 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
38840 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
38841 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
38842 except when <option>mbx_format</option> is set.
38845 <indexterm role="option">
38846 <primary><option>use_mbx_lock</option></primary>
38849 <informaltable frame="all">
38850 <tgroup cols="4" colsep="0" rowsep="0">
38851 <colspec colwidth="8*" align="left"/>
38852 <colspec colwidth="6*" align="center"/>
38853 <colspec colwidth="6*" align="center"/>
38854 <colspec colwidth="6*" align="right"/>
38857 <entry><option>use_mbx_lock</option></entry>
38858 <entry>Use: <emphasis>appendfile</emphasis></entry>
38859 <entry>Type: <emphasis>boolean</emphasis></entry>
38860 <entry>Default: <emphasis>see below</emphasis></entry>
38866 This option is available only if Exim has been compiled with SUPPORT_MBX
38867 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
38868 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
38869 of the locking options are mentioned in the configuration. The locking rules
38870 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
38871 the IMAP4 and POP daemons that come with it (see the discussion below). The
38872 rules allow for shared access to the mailbox. However, this kind of locking
38873 does not work when the mailbox is NFS mounted.
38876 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
38877 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
38878 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
38879 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
38882 <section id="SECTopappend">
38883 <title>Operational details for appending</title>
38885 <indexterm role="concept">
38886 <primary>appending to a file</primary>
38888 <indexterm role="concept">
38889 <primary>file</primary>
38890 <secondary>appending</secondary>
38892 Before appending to a file, the following preparations are made:
38897 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
38903 <indexterm role="concept">
38904 <primary>directory creation</primary>
38906 If any directories on the file’s path are missing, Exim creates them if the
38907 <option>create_directory</option> option is set. A created directory’s mode is given by the
38908 <option>directory_mode</option> option.
38913 If <option>file_format</option> is set, the format of an existing file is checked. If this
38914 indicates that a different transport should be used, control is passed to that
38920 <indexterm role="concept">
38921 <primary>file</primary>
38922 <secondary>locking</secondary>
38924 <indexterm role="concept">
38925 <primary>locking files</primary>
38927 <indexterm role="concept">
38928 <primary>NFS</primary>
38929 <secondary>lock file</secondary>
38931 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
38932 reliably over NFS, as follows:
38934 <orderedlist numeration="arabic">
38937 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
38938 current time, primary host name, and process id added, by opening for writing
38939 as a new file. If this fails with an access error, delivery is deferred.
38944 Close the hitching post file, and hard link it to the lock file name.
38949 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
38950 Unlink the hitching post name.
38955 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
38956 then unlink hitching post name. If the number of links is exactly two, creation
38957 of the lock file succeeded but something (for example, an NFS server crash and
38958 restart) caused this fact not to be communicated to the <function>link()</function> call.
38963 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
38964 up to <option>lock_retries</option> times. However, since any program that writes to a
38965 mailbox should complete its task very quickly, it is reasonable to time out old
38966 lock files that are normally the result of user agent and system crashes. If an
38967 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
38968 it before trying again.
38975 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
38976 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
38977 than non-existence, delivery is deferred.
38982 <indexterm role="concept">
38983 <primary>symbolic link</primary>
38984 <secondary>to mailbox</secondary>
38986 <indexterm role="concept">
38987 <primary>mailbox</primary>
38988 <secondary>symbolic link</secondary>
38990 If the file does exist and is a symbolic link, delivery is deferred, unless the
38991 <option>allow_symlink</option> option is set, in which case the ownership of the link is
38992 checked, and then <function>stat()</function> is called to find out about the real file, which
38993 is then subjected to the checks below. The check on the top-level link
38994 ownership prevents one user creating a link for another’s mailbox in a sticky
38995 directory, though allowing symbolic links in this case is definitely not a good
38996 idea. If there is a chain of symbolic links, the intermediate ones are not
39002 If the file already exists but is not a regular file, or if the file’s owner
39003 and group (if the group is being checked – see <option>check_group</option> above) are
39004 different from the user and group under which the delivery is running,
39005 delivery is deferred.
39010 If the file’s permissions are more generous than specified, they are reduced.
39011 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
39012 is set false, in which case the delivery is tried using the existing
39018 The file’s inode number is saved, and the file is then opened for appending.
39019 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
39020 hadn’t existed (see below). For any other failures, delivery is deferred.
39025 If the file is opened successfully, check that the inode number hasn’t
39026 changed, that it is still a regular file, and that the owner and permissions
39027 have not changed. If anything is wrong, defer delivery and freeze the message.
39032 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
39033 option is set. Otherwise, check that the file is being created in a permitted
39034 directory if the <option>create_file</option> option is set (deferring on failure), and then
39035 open for writing as a new file, with the O_EXCL and O_CREAT options,
39036 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
39037 set). In this case, which can happen if the link points to a non-existent file,
39038 the file is opened for writing using O_CREAT but not O_EXCL, because
39039 that prevents link following.
39044 <indexterm role="concept">
39045 <primary>loop</primary>
39046 <secondary>while file testing</secondary>
39048 If opening fails because the file exists, obey the tests given above for
39049 existing files. However, to avoid looping in a situation where the file is
39050 being continuously created and destroyed, the exists/not-exists loop is broken
39051 after 10 repetitions, and the message is then frozen.
39056 If opening fails with any other error, defer delivery.
39061 <indexterm role="concept">
39062 <primary>file</primary>
39063 <secondary>locking</secondary>
39065 <indexterm role="concept">
39066 <primary>locking files</primary>
39068 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
39069 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
39070 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
39071 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
39072 file, and an exclusive lock on the file whose name is
39074 <literallayout class="monospaced">
39075 /tmp/.<device-number>.<inode-number>
39078 using the device and inode numbers of the open mailbox file, in accordance with
39079 the MBX locking rules. This file is created with a mode that is specified by
39080 the <option>lockfile_mode</option> option.
39083 If Exim fails to lock the file, there are two possible courses of action,
39084 depending on the value of the locking timeout. This is obtained from
39085 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
39088 If the timeout value is zero, the file is closed, Exim waits for
39089 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
39090 to lock it again. This happens up to <option>lock_retries</option> times, after which the
39091 delivery is deferred.
39094 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
39095 <function>flock()</function> are used (with the given timeout), so there has already been some
39096 waiting involved by the time locking fails. Nevertheless, Exim does not give up
39097 immediately. It retries up to
39099 <literallayout class="monospaced">
39100 (lock_retries * lock_interval) / <timeout>
39103 times (rounded up).
39108 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
39109 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
39112 <section id="SECTopdir">
39113 <title>Operational details for delivery to a new file</title>
39115 <indexterm role="concept">
39116 <primary>delivery</primary>
39117 <secondary>to single file</secondary>
39119 <indexterm role="concept">
39120 <primary><quote>From</quote> line</primary>
39122 When the <option>directory</option> option is set instead of <option>file</option>, each message is
39123 delivered into a newly-created file or set of files. When <command>appendfile</command> is
39124 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
39125 <option>directory</option> is normally set, because the path for delivery is supplied by the
39126 router. (See for example, the <command>address_file</command> transport in the default
39127 configuration.) In this case, delivery is to a new file if either the path name
39128 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
39131 No locking is required while writing the message to a new file, so the various
39132 locking options of the transport are ignored. The <quote>From</quote> line that by default
39133 separates messages in a single file is not normally needed, nor is the escaping
39134 of message lines that start with <quote>From</quote>, and there is no need to ensure a
39135 newline at the end of each message. Consequently, the default values for
39136 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
39137 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
39140 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
39141 the files in the delivery directory by default. However, you can specify a
39142 different directory by setting <option>quota_directory</option>. Also, for maildir
39143 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
39146 <indexterm role="concept">
39147 <primary>maildir format</primary>
39149 <indexterm role="concept">
39150 <primary>mailstore format</primary>
39152 There are three different ways in which delivery to individual files can be
39153 done, controlled by the settings of the <option>maildir_format</option> and
39154 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
39155 formats is not included in the binary unless SUPPORT_MAILDIR or
39156 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
39159 <indexterm role="concept">
39160 <primary>directory creation</primary>
39162 In all three cases an attempt is made to create the directory and any necessary
39163 sub-directories if they do not exist, provided that the <option>create_directory</option>
39164 option is set (the default). The location of a created directory can be
39165 constrained by setting <option>create_file</option>. A created directory’s mode is given by
39166 the <option>directory_mode</option> option. If creation fails, or if the
39167 <option>create_directory</option> option is not set when creation is required, delivery is
39171 <section id="SECTmaildirdelivery">
39172 <title>Maildir delivery</title>
39174 <indexterm role="concept">
39175 <primary>maildir format</primary>
39176 <secondary>description of</secondary>
39178 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
39179 it to a file whose name is <filename>tmp/<stime>.H<mtime>P<pid>.<host></filename> in the
39180 directory that is defined by the <option>directory</option> option (the <quote>delivery
39181 directory</quote>). If the delivery is successful, the file is renamed into the
39182 <filename>new</filename> subdirectory.
39185 In the file name, <<emphasis>stime</emphasis>> is the current time of day in seconds, and
39186 <<emphasis>mtime</emphasis>> is the microsecond fraction of the time. After a maildir delivery,
39187 Exim checks that the time-of-day clock has moved on by at least one microsecond
39188 before terminating the delivery process. This guarantees uniqueness for the
39189 file name. However, as a precaution, Exim calls <function>stat()</function> for the file before
39190 opening it. If any response other than ENOENT (does not exist) is given,
39191 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
39194 Before Exim carries out a maildir delivery, it ensures that subdirectories
39195 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
39196 do not exist, Exim tries to create them and any superior directories in their
39197 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
39198 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
39199 contains matches the delivery directory, Exim also ensures that a file called
39200 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
39201 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
39204 These features make it possible to use Exim to create all the necessary files
39205 and directories in a maildir mailbox, including subdirectories for maildir++
39206 folders. Consider this example:
39208 <literallayout class="monospaced">
39209 maildir_format = true
39210 directory = /var/mail/$local_part\
39211 ${if eq{$local_part_suffix}{}{}\
39212 {/.${substr_1:$local_part_suffix}}}
39213 maildirfolder_create_regex = /\.[^/]+$
39216 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
39217 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
39218 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
39219 not match this name, so Exim will not look for or create the file
39220 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
39221 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
39224 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
39225 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
39226 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
39227 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
39228 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
39231 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
39232 not inadvertently match the toplevel maildir directory, because a
39233 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
39236 <indexterm role="concept">
39237 <primary>quota</primary>
39238 <secondary>in maildir delivery</secondary>
39240 <indexterm role="concept">
39241 <primary>maildir++</primary>
39243 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
39244 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
39245 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
39246 Exim assumes the directory is a maildir++ folder directory, which is one level
39247 down from the user’s top level mailbox directory. This causes it to start at
39248 the parent directory instead of the current directory when calculating the
39249 amount of space used.
39252 One problem with delivering into a multi-file mailbox is that it is
39253 computationally expensive to compute the size of the mailbox for quota
39254 checking. Various approaches have been taken to reduce the amount of work
39255 needed. The next two sections describe two of them. A third alternative is to
39256 use some external process for maintaining the size data, and use the expansion
39257 of the <option>mailbox_size</option> option as a way of importing it into Exim.
39260 <section id="SECID135">
39261 <title>Using tags to record message sizes</title>
39263 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
39264 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
39265 tag is added to its name. However, if adding the tag takes the length of the
39266 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
39267 the tag is dropped and the maildir file is created with no tag.
39270 <indexterm role="variable">
39271 <primary><varname>$message_size</varname></primary>
39273 Tags can be used to encode the size of files in their names; see
39274 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
39275 happens after the message has been written. The value of the <varname>$message_size</varname>
39276 variable is set to the number of bytes actually written. If the expansion is
39277 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
39278 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
39279 Non-printing characters in the string are ignored; if the resulting string is
39280 empty, it is ignored. If it starts with an alphanumeric character, a leading
39284 <section id="SECID136">
39285 <title>Using a maildirsize file</title>
39287 <indexterm role="concept">
39288 <primary>quota</primary>
39289 <secondary>in maildir delivery</secondary>
39291 <indexterm role="concept">
39292 <primary>maildir format</primary>
39293 <secondary><filename>maildirsize</filename> file</secondary>
39295 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
39296 storing quota and message size information in a file called <filename>maildirsize</filename>
39297 within the toplevel maildir directory. If this file does not exist, Exim
39298 creates it, setting the quota from the <option>quota</option> option of the transport. If
39299 the maildir directory itself does not exist, it is created before any attempt
39300 to write a <filename>maildirsize</filename> file.
39303 The <filename>maildirsize</filename> file is used to hold information about the sizes of
39304 messages in the maildir, thus speeding up quota calculations. The quota value
39305 in the file is just a cache; if the quota is changed in the transport, the new
39306 value overrides the cached value when the next message is delivered. The cache
39307 is maintained for the benefit of other programs that access the maildir and
39308 need to know the quota.
39311 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
39312 file is maintained (with a zero quota setting), but no quota is imposed.
39315 A regular expression is available for controlling which directories in the
39316 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
39317 See the description of the <option>maildir_quota_directory_regex</option> option above for
39321 <section id="SECID137">
39322 <title>Mailstore delivery</title>
39324 <indexterm role="concept">
39325 <primary>mailstore format</primary>
39326 <secondary>description of</secondary>
39328 If the <option>mailstore_format</option> option is true, each message is written as two
39329 files in the given directory. A unique base name is constructed from the
39330 message id and the current delivery process, and the files that are written use
39331 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
39332 contains the message’s envelope, and the <filename>.msg</filename> file contains the message
39333 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
39336 During delivery, the envelope is first written to a file with the suffix
39337 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
39338 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
39339 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
39340 file before accessing either of them. An alternative approach is to wait for
39341 the absence of a <filename>.tmp</filename> file.
39344 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
39345 option, expanded and terminated by a newline if there isn’t one. Then follows
39346 the sender address on one line, then all the recipient addresses, one per line.
39347 There can be more than one recipient only if the <option>batch_max</option> option is set
39348 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
39349 appended to the file, followed by a newline if it does not end with one.
39352 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
39353 failure, it is ignored. Other expansion errors are treated as serious
39354 configuration errors, and delivery is deferred. The variable
39355 <varname>$mailstore_basename</varname> is available for use during these expansions.
39358 <section id="SECID138">
39359 <title>Non-special new file delivery</title>
39361 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
39362 file is created directly in the named directory. For example, when delivering
39363 messages into files in batched SMTP format for later delivery to some host (see
39364 section <xref linkend="SECTbatchSMTP"/>), a setting such as
39366 <literallayout class="monospaced">
39367 directory = /var/bsmtp/$host
39370 might be used. A message is written to a file with a temporary name, which is
39371 then renamed when the delivery is complete. The final name is obtained by
39372 expanding the contents of the <option>directory_file</option> option.
39373 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
39374 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
39379 <chapter id="CHID8">
39380 <title>The autoreply transport</title>
39382 <indexterm role="concept" id="IIDauttra1" class="startofrange">
39383 <primary>transports</primary>
39384 <secondary><command>autoreply</command></secondary>
39386 <indexterm role="concept" id="IIDauttra2" class="startofrange">
39387 <primary><command>autoreply</command> transport</primary>
39389 The <command>autoreply</command> transport is not a true transport in that it does not cause
39390 the message to be transmitted. Instead, it generates a new mail message as an
39391 automatic reply to the incoming message. <emphasis>References:</emphasis> and
39392 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
39393 to the rules in RFCs 2822 and 3834, respectively.
39396 If the router that passes the message to this transport does not have the
39397 <option>unseen</option> option set, the original message (for the current recipient) is not
39398 delivered anywhere. However, when the <option>unseen</option> option is set on the router
39399 that passes the message to this transport, routing of the address continues, so
39400 another router can set up a normal message delivery.
39403 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
39404 <quote>vacation</quote> message being the standard example. However, it can also be run
39405 directly from a router like any other transport. To reduce the possibility of
39406 message cascades, messages created by the <command>autoreply</command> transport always have
39407 empty envelope sender addresses, like bounce messages.
39410 The parameters of the message to be sent can be specified in the configuration
39411 by options described below. However, these are used only when the address
39412 passed to the transport does not contain its own reply information. When the
39413 transport is run as a consequence of a
39414 <option>mail</option>
39415 or <option>vacation</option> command in a filter file, the parameters of the message are
39416 supplied by the filter, and passed with the address. The transport’s options
39417 that define the message are then ignored (so they are not usually set in this
39418 case). The message is specified entirely by the filter or by the transport; it
39419 is never built from a mixture of options. However, the <option>file_optional</option>,
39420 <option>mode</option>, and <option>return_message</option> options apply in all cases.
39423 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
39424 command in a user’s filter file, <command>autoreply</command> normally runs under the uid and
39425 gid of the user, and with appropriate current and home directories (see chapter
39426 <xref linkend="CHAPenvironment"/>).
39429 There is a subtle difference between routing a message to a <command>pipe</command> transport
39430 that generates some text to be returned to the sender, and routing it to an
39431 <command>autoreply</command> transport. This difference is noticeable only if more than one
39432 address from the same message is so handled. In the case of a pipe, the
39433 separate outputs from the different addresses are gathered up and returned to
39434 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
39435 message is generated for each address that is passed to it.
39438 Non-printing characters are not permitted in the header lines generated for the
39439 message that <command>autoreply</command> creates, with the exception of newlines that are
39440 immediately followed by white space. If any non-printing characters are found,
39441 the transport defers.
39442 Whether characters with the top bit set count as printing characters or not is
39443 controlled by the <option>print_topbitchars</option> global option.
39446 If any of the generic options for manipulating headers (for example,
39447 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
39448 of the original message that is included in the generated message when
39449 <option>return_message</option> is set. They do not apply to the generated message itself.
39452 <indexterm role="variable">
39453 <primary><varname>$sender_address</varname></primary>
39455 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
39456 the message, indicating that there were no recipients, it does not treat this
39457 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
39458 is empty (because the incoming message is a bounce message) do not cause
39459 problems. They are just discarded.
39461 <section id="SECID139">
39462 <title>Private options for autoreply</title>
39464 <indexterm role="concept">
39465 <primary>options</primary>
39466 <secondary><command>autoreply</command> transport</secondary>
39470 <indexterm role="option">
39471 <primary><option>bcc</option></primary>
39474 <informaltable frame="all">
39475 <tgroup cols="4" colsep="0" rowsep="0">
39476 <colspec colwidth="8*" align="left"/>
39477 <colspec colwidth="6*" align="center"/>
39478 <colspec colwidth="6*" align="center"/>
39479 <colspec colwidth="6*" align="right"/>
39482 <entry><option>bcc</option></entry>
39483 <entry>Use: <emphasis>autoreply</emphasis></entry>
39484 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39485 <entry>Default: <emphasis>unset</emphasis></entry>
39491 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
39492 message when the message is specified by the transport.
39495 <indexterm role="option">
39496 <primary><option>cc</option></primary>
39499 <informaltable frame="all">
39500 <tgroup cols="4" colsep="0" rowsep="0">
39501 <colspec colwidth="8*" align="left"/>
39502 <colspec colwidth="6*" align="center"/>
39503 <colspec colwidth="6*" align="center"/>
39504 <colspec colwidth="6*" align="right"/>
39507 <entry><option>cc</option></entry>
39508 <entry>Use: <emphasis>autoreply</emphasis></entry>
39509 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39510 <entry>Default: <emphasis>unset</emphasis></entry>
39516 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
39517 when the message is specified by the transport.
39520 <indexterm role="option">
39521 <primary><option>file</option></primary>
39524 <informaltable frame="all">
39525 <tgroup cols="4" colsep="0" rowsep="0">
39526 <colspec colwidth="8*" align="left"/>
39527 <colspec colwidth="6*" align="center"/>
39528 <colspec colwidth="6*" align="center"/>
39529 <colspec colwidth="6*" align="right"/>
39532 <entry><option>file</option></entry>
39533 <entry>Use: <emphasis>autoreply</emphasis></entry>
39534 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39535 <entry>Default: <emphasis>unset</emphasis></entry>
39541 The contents of the file are sent as the body of the message when the message
39542 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
39543 string comes first.
39546 <indexterm role="option">
39547 <primary><option>file_expand</option></primary>
39550 <informaltable frame="all">
39551 <tgroup cols="4" colsep="0" rowsep="0">
39552 <colspec colwidth="8*" align="left"/>
39553 <colspec colwidth="6*" align="center"/>
39554 <colspec colwidth="6*" align="center"/>
39555 <colspec colwidth="6*" align="right"/>
39558 <entry><option>file_expand</option></entry>
39559 <entry>Use: <emphasis>autoreply</emphasis></entry>
39560 <entry>Type: <emphasis>boolean</emphasis></entry>
39561 <entry>Default: <emphasis>false</emphasis></entry>
39567 If this is set, the contents of the file named by the <option>file</option> option are
39568 subjected to string expansion as they are added to the message.
39571 <indexterm role="option">
39572 <primary><option>file_optional</option></primary>
39575 <informaltable frame="all">
39576 <tgroup cols="4" colsep="0" rowsep="0">
39577 <colspec colwidth="8*" align="left"/>
39578 <colspec colwidth="6*" align="center"/>
39579 <colspec colwidth="6*" align="center"/>
39580 <colspec colwidth="6*" align="right"/>
39583 <entry><option>file_optional</option></entry>
39584 <entry>Use: <emphasis>autoreply</emphasis></entry>
39585 <entry>Type: <emphasis>boolean</emphasis></entry>
39586 <entry>Default: <emphasis>false</emphasis></entry>
39592 If this option is true, no error is generated if the file named by the <option>file</option>
39593 option or passed with the address does not exist or cannot be read.
39596 <indexterm role="option">
39597 <primary><option>from</option></primary>
39600 <informaltable frame="all">
39601 <tgroup cols="4" colsep="0" rowsep="0">
39602 <colspec colwidth="8*" align="left"/>
39603 <colspec colwidth="6*" align="center"/>
39604 <colspec colwidth="6*" align="center"/>
39605 <colspec colwidth="6*" align="right"/>
39608 <entry><option>from</option></entry>
39609 <entry>Use: <emphasis>autoreply</emphasis></entry>
39610 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39611 <entry>Default: <emphasis>unset</emphasis></entry>
39617 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
39618 specified by the transport.
39621 <indexterm role="option">
39622 <primary><option>headers</option></primary>
39625 <informaltable frame="all">
39626 <tgroup cols="4" colsep="0" rowsep="0">
39627 <colspec colwidth="8*" align="left"/>
39628 <colspec colwidth="6*" align="center"/>
39629 <colspec colwidth="6*" align="center"/>
39630 <colspec colwidth="6*" align="right"/>
39633 <entry><option>headers</option></entry>
39634 <entry>Use: <emphasis>autoreply</emphasis></entry>
39635 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39636 <entry>Default: <emphasis>unset</emphasis></entry>
39642 This specifies additional RFC 2822 headers that are to be added to the message
39643 when the message is specified by the transport. Several can be given by using
39644 <quote>\n</quote> to separate them. There is no check on the format.
39647 <indexterm role="option">
39648 <primary><option>log</option></primary>
39651 <informaltable frame="all">
39652 <tgroup cols="4" colsep="0" rowsep="0">
39653 <colspec colwidth="8*" align="left"/>
39654 <colspec colwidth="6*" align="center"/>
39655 <colspec colwidth="6*" align="center"/>
39656 <colspec colwidth="6*" align="right"/>
39659 <entry><option>log</option></entry>
39660 <entry>Use: <emphasis>autoreply</emphasis></entry>
39661 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39662 <entry>Default: <emphasis>unset</emphasis></entry>
39668 This option names a file in which a record of every message sent is logged when
39669 the message is specified by the transport.
39672 <indexterm role="option">
39673 <primary><option>mode</option></primary>
39676 <informaltable frame="all">
39677 <tgroup cols="4" colsep="0" rowsep="0">
39678 <colspec colwidth="8*" align="left"/>
39679 <colspec colwidth="6*" align="center"/>
39680 <colspec colwidth="6*" align="center"/>
39681 <colspec colwidth="6*" align="right"/>
39684 <entry><option>mode</option></entry>
39685 <entry>Use: <emphasis>autoreply</emphasis></entry>
39686 <entry>Type: <emphasis>octal integer</emphasis></entry>
39687 <entry>Default: <emphasis>0600</emphasis></entry>
39693 If either the log file or the <quote>once</quote> file has to be created, this mode is
39697 <indexterm role="option">
39698 <primary><option>never_mail</option></primary>
39701 <informaltable frame="all">
39702 <tgroup cols="4" colsep="0" rowsep="0">
39703 <colspec colwidth="8*" align="left"/>
39704 <colspec colwidth="6*" align="center"/>
39705 <colspec colwidth="6*" align="center"/>
39706 <colspec colwidth="6*" align="right"/>
39709 <entry><option>never_mail</option></entry>
39710 <entry>Use: <emphasis>autoreply</emphasis></entry>
39711 <entry>Type: <emphasis>address list</emphasis>†<emphasis></emphasis></entry>
39712 <entry>Default: <emphasis>unset</emphasis></entry>
39718 If any run of the transport creates a message with a recipient that matches any
39719 item in the list, that recipient is quietly discarded. If all recipients are
39720 discarded, no message is created. This applies both when the recipients are
39721 generated by a filter and when they are specified in the transport.
39724 <indexterm role="option">
39725 <primary><option>once</option></primary>
39728 <informaltable frame="all">
39729 <tgroup cols="4" colsep="0" rowsep="0">
39730 <colspec colwidth="8*" align="left"/>
39731 <colspec colwidth="6*" align="center"/>
39732 <colspec colwidth="6*" align="center"/>
39733 <colspec colwidth="6*" align="right"/>
39736 <entry><option>once</option></entry>
39737 <entry>Use: <emphasis>autoreply</emphasis></entry>
39738 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39739 <entry>Default: <emphasis>unset</emphasis></entry>
39745 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
39746 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
39747 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
39750 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
39751 By default, if <option>once</option> is set to a non-empty file name, the message
39752 is not sent if a potential recipient is already listed in the database.
39753 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
39754 message is sent if that much time has elapsed since a message was last sent to
39755 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
39756 prevents a message from being sent a second time – in this case, zero means
39760 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
39761 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
39762 greater than zero, it changes the way Exim implements the <option>once</option> option.
39763 Instead of using a DBM file to record every recipient it sends to, it uses a
39764 regular file, whose size will never get larger than the given value.
39767 In the file, Exim keeps a linear list of recipient addresses and the times at
39768 which they were sent messages. If the file is full when a new address needs to
39769 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
39770 means that a given recipient may receive multiple messages, but at
39771 unpredictable intervals that depend on the rate of turnover of addresses in the
39772 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
39775 <indexterm role="option">
39776 <primary><option>once_file_size</option></primary>
39779 <informaltable frame="all">
39780 <tgroup cols="4" colsep="0" rowsep="0">
39781 <colspec colwidth="8*" align="left"/>
39782 <colspec colwidth="6*" align="center"/>
39783 <colspec colwidth="6*" align="center"/>
39784 <colspec colwidth="6*" align="right"/>
39787 <entry><option>once_file_size</option></entry>
39788 <entry>Use: <emphasis>autoreply</emphasis></entry>
39789 <entry>Type: <emphasis>integer</emphasis></entry>
39790 <entry>Default: <emphasis>0</emphasis></entry>
39796 See <option>once</option> above.
39799 <indexterm role="option">
39800 <primary><option>once_repeat</option></primary>
39803 <informaltable frame="all">
39804 <tgroup cols="4" colsep="0" rowsep="0">
39805 <colspec colwidth="8*" align="left"/>
39806 <colspec colwidth="6*" align="center"/>
39807 <colspec colwidth="6*" align="center"/>
39808 <colspec colwidth="6*" align="right"/>
39811 <entry><option>once_repeat</option></entry>
39812 <entry>Use: <emphasis>autoreply</emphasis></entry>
39813 <entry>Type: <emphasis>time</emphasis>†<emphasis></emphasis></entry>
39814 <entry>Default: <emphasis>0s</emphasis></entry>
39820 See <option>once</option> above.
39821 After expansion, the value of this option must be a valid time value.
39824 <indexterm role="option">
39825 <primary><option>reply_to</option></primary>
39828 <informaltable frame="all">
39829 <tgroup cols="4" colsep="0" rowsep="0">
39830 <colspec colwidth="8*" align="left"/>
39831 <colspec colwidth="6*" align="center"/>
39832 <colspec colwidth="6*" align="center"/>
39833 <colspec colwidth="6*" align="right"/>
39836 <entry><option>reply_to</option></entry>
39837 <entry>Use: <emphasis>autoreply</emphasis></entry>
39838 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39839 <entry>Default: <emphasis>unset</emphasis></entry>
39845 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
39846 specified by the transport.
39849 <indexterm role="option">
39850 <primary><option>return_message</option></primary>
39853 <informaltable frame="all">
39854 <tgroup cols="4" colsep="0" rowsep="0">
39855 <colspec colwidth="8*" align="left"/>
39856 <colspec colwidth="6*" align="center"/>
39857 <colspec colwidth="6*" align="center"/>
39858 <colspec colwidth="6*" align="right"/>
39861 <entry><option>return_message</option></entry>
39862 <entry>Use: <emphasis>autoreply</emphasis></entry>
39863 <entry>Type: <emphasis>boolean</emphasis></entry>
39864 <entry>Default: <emphasis>false</emphasis></entry>
39870 If this is set, a copy of the original message is returned with the new
39871 message, subject to the maximum size set in the <option>return_size_limit</option> global
39872 configuration option.
39875 <indexterm role="option">
39876 <primary><option>subject</option></primary>
39879 <informaltable frame="all">
39880 <tgroup cols="4" colsep="0" rowsep="0">
39881 <colspec colwidth="8*" align="left"/>
39882 <colspec colwidth="6*" align="center"/>
39883 <colspec colwidth="6*" align="center"/>
39884 <colspec colwidth="6*" align="right"/>
39887 <entry><option>subject</option></entry>
39888 <entry>Use: <emphasis>autoreply</emphasis></entry>
39889 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39890 <entry>Default: <emphasis>unset</emphasis></entry>
39896 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
39897 specified by the transport. It is tempting to quote the original subject in
39898 automatic responses. For example:
39900 <literallayout class="monospaced">
39901 subject = Re: $h_subject:
39904 There is a danger in doing this, however. It may allow a third party to
39905 subscribe your users to an opt-in mailing list, provided that the list accepts
39906 bounce messages as subscription confirmations. Well-managed lists require a
39907 non-bounce message to confirm a subscription, so the danger is relatively
39911 <indexterm role="option">
39912 <primary><option>text</option></primary>
39915 <informaltable frame="all">
39916 <tgroup cols="4" colsep="0" rowsep="0">
39917 <colspec colwidth="8*" align="left"/>
39918 <colspec colwidth="6*" align="center"/>
39919 <colspec colwidth="6*" align="center"/>
39920 <colspec colwidth="6*" align="right"/>
39923 <entry><option>text</option></entry>
39924 <entry>Use: <emphasis>autoreply</emphasis></entry>
39925 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39926 <entry>Default: <emphasis>unset</emphasis></entry>
39932 This specifies a single string to be used as the body of the message when the
39933 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
39934 the text comes first.
39937 <indexterm role="option">
39938 <primary><option>to</option></primary>
39941 <informaltable frame="all">
39942 <tgroup cols="4" colsep="0" rowsep="0">
39943 <colspec colwidth="8*" align="left"/>
39944 <colspec colwidth="6*" align="center"/>
39945 <colspec colwidth="6*" align="center"/>
39946 <colspec colwidth="6*" align="right"/>
39949 <entry><option>to</option></entry>
39950 <entry>Use: <emphasis>autoreply</emphasis></entry>
39951 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39952 <entry>Default: <emphasis>unset</emphasis></entry>
39958 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
39959 when the message is specified by the transport.
39960 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
39961 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
39966 <chapter id="CHAPLMTP">
39967 <title>The lmtp transport</title>
39969 <indexterm role="concept">
39970 <primary>transports</primary>
39971 <secondary><command>lmtp</command></secondary>
39973 <indexterm role="concept">
39974 <primary><command>lmtp</command> transport</primary>
39976 <indexterm role="concept">
39977 <primary>LMTP</primary>
39978 <secondary>over a pipe</secondary>
39980 <indexterm role="concept">
39981 <primary>LMTP</primary>
39982 <secondary>over a socket</secondary>
39984 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
39986 or by interacting with a Unix domain socket.
39987 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
39988 transports. Exim also has support for using LMTP over TCP/IP; this is
39989 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
39990 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
39991 has it commented out. You need to ensure that
39993 <literallayout class="monospaced">
39997 <indexterm role="concept">
39998 <primary>options</primary>
39999 <secondary><command>lmtp</command> transport</secondary>
40001 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
40002 included in the Exim binary. The private options of the <command>lmtp</command> transport are
40006 <indexterm role="option">
40007 <primary><option>batch_id</option></primary>
40010 <informaltable frame="all">
40011 <tgroup cols="4" colsep="0" rowsep="0">
40012 <colspec colwidth="8*" align="left"/>
40013 <colspec colwidth="6*" align="center"/>
40014 <colspec colwidth="6*" align="center"/>
40015 <colspec colwidth="6*" align="right"/>
40018 <entry><option>batch_id</option></entry>
40019 <entry>Use: <emphasis>lmtp</emphasis></entry>
40020 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
40021 <entry>Default: <emphasis>unset</emphasis></entry>
40027 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
40030 <indexterm role="option">
40031 <primary><option>batch_max</option></primary>
40034 <informaltable frame="all">
40035 <tgroup cols="4" colsep="0" rowsep="0">
40036 <colspec colwidth="8*" align="left"/>
40037 <colspec colwidth="6*" align="center"/>
40038 <colspec colwidth="6*" align="center"/>
40039 <colspec colwidth="6*" align="right"/>
40042 <entry><option>batch_max</option></entry>
40043 <entry>Use: <emphasis>lmtp</emphasis></entry>
40044 <entry>Type: <emphasis>integer</emphasis></entry>
40045 <entry>Default: <emphasis>1</emphasis></entry>
40051 This limits the number of addresses that can be handled in a single delivery.
40052 Most LMTP servers can handle several addresses at once, so it is normally a
40053 good idea to increase this value. See the description of local delivery
40054 batching in chapter <xref linkend="CHAPbatching"/>.
40057 <indexterm role="option">
40058 <primary><option>command</option></primary>
40061 <informaltable frame="all">
40062 <tgroup cols="4" colsep="0" rowsep="0">
40063 <colspec colwidth="8*" align="left"/>
40064 <colspec colwidth="6*" align="center"/>
40065 <colspec colwidth="6*" align="center"/>
40066 <colspec colwidth="6*" align="right"/>
40069 <entry><option>command</option></entry>
40070 <entry>Use: <emphasis>lmtp</emphasis></entry>
40071 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
40072 <entry>Default: <emphasis>unset</emphasis></entry>
40078 This option must be set if <option>socket</option> is not set. The string is a command which
40079 is run in a separate process. It is split up into a command name and list of
40080 arguments, each of which is separately expanded (so expansion cannot change the
40081 number of arguments). The command is run directly, not via a shell. The message
40082 is passed to the new process using the standard input and output to operate the
40086 <indexterm role="option">
40087 <primary><option>ignore_quota</option></primary>
40090 <informaltable frame="all">
40091 <tgroup cols="4" colsep="0" rowsep="0">
40092 <colspec colwidth="8*" align="left"/>
40093 <colspec colwidth="6*" align="center"/>
40094 <colspec colwidth="6*" align="center"/>
40095 <colspec colwidth="6*" align="right"/>
40098 <entry><option>ignore_quota</option></entry>
40099 <entry>Use: <emphasis>lmtp</emphasis></entry>
40100 <entry>Type: <emphasis>boolean</emphasis></entry>
40101 <entry>Default: <emphasis>false</emphasis></entry>
40107 <indexterm role="concept">
40108 <primary>LMTP</primary>
40109 <secondary>ignoring quota errors</secondary>
40111 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
40112 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
40113 in its response to the LHLO command.
40116 <indexterm role="option">
40117 <primary><option>socket</option></primary>
40120 <informaltable frame="all">
40121 <tgroup cols="4" colsep="0" rowsep="0">
40122 <colspec colwidth="8*" align="left"/>
40123 <colspec colwidth="6*" align="center"/>
40124 <colspec colwidth="6*" align="center"/>
40125 <colspec colwidth="6*" align="right"/>
40128 <entry><option>socket</option></entry>
40129 <entry>Use: <emphasis>lmtp</emphasis></entry>
40130 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
40131 <entry>Default: <emphasis>unset</emphasis></entry>
40137 This option must be set if <option>command</option> is not set. The result of expansion must
40138 be the name of a Unix domain socket. The transport connects to the socket and
40139 delivers the message to it using the LMTP protocol.
40142 <indexterm role="option">
40143 <primary><option>timeout</option></primary>
40146 <informaltable frame="all">
40147 <tgroup cols="4" colsep="0" rowsep="0">
40148 <colspec colwidth="8*" align="left"/>
40149 <colspec colwidth="6*" align="center"/>
40150 <colspec colwidth="6*" align="center"/>
40151 <colspec colwidth="6*" align="right"/>
40154 <entry><option>timeout</option></entry>
40155 <entry>Use: <emphasis>lmtp</emphasis></entry>
40156 <entry>Type: <emphasis>time</emphasis></entry>
40157 <entry>Default: <emphasis>5m</emphasis></entry>
40163 The transport is aborted if the created process or Unix domain socket does not
40164 respond to LMTP commands or message input within this timeout. Delivery
40165 is deferred, and will be tried again later. Here is an example of a typical
40168 <literallayout class="monospaced">
40171 command = /some/local/lmtp/delivery/program
40176 This delivers up to 20 addresses at a time, in a mixture of domains if
40177 necessary, running as the user <emphasis>exim</emphasis>.
40181 <chapter id="CHAPpipetransport">
40182 <title>The pipe transport</title>
40184 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
40185 <primary>transports</primary>
40186 <secondary><command>pipe</command></secondary>
40188 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
40189 <primary><command>pipe</command> transport</primary>
40191 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
40192 running in another process. One example is the use of <command>pipe</command> as a
40193 pseudo-remote transport for passing messages to some other delivery mechanism
40194 (such as UUCP). Another is the use by individual users to automatically process
40195 their incoming messages. The <command>pipe</command> transport can be used in one of the
40201 <indexterm role="variable">
40202 <primary><varname>$local_part</varname></primary>
40204 A router routes one address to a transport in the normal way, and the
40205 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
40206 contains the local part of the address (as usual), and the command that is run
40207 is specified by the <option>command</option> option on the transport.
40212 <indexterm role="variable">
40213 <primary><varname>$pipe_addresses</varname></primary>
40215 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
40216 transport can handle more than one address in a single run. In this case, when
40217 more than one address is routed to the transport, <varname>$local_part</varname> is not set
40218 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
40219 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
40220 that are routed to the transport.
40225 <indexterm role="variable">
40226 <primary><varname>$address_pipe</varname></primary>
40228 A router redirects an address directly to a pipe command (for example, from an
40229 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
40230 pipe command, and the <option>command</option> option on the transport is ignored. If only
40231 one address is being transported (<option>batch_max</option> is not greater than one, or
40232 only one address was redirected to this pipe command), <varname>$local_part</varname> contains
40233 the local part that was redirected.
40238 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
40239 deliver messages over pipes using the LMTP interactive protocol. This is
40240 implemented by the <command>lmtp</command> transport.
40243 In the case when <command>pipe</command> is run as a consequence of an entry in a local user’s
40244 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
40245 other cases, the uid and gid have to be specified explicitly, either on the
40246 transport or on the router that handles the address. Current and <quote>home</quote>
40247 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
40248 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
40249 for a discussion of local delivery batching.
40251 <section id="SECID140">
40252 <title>Concurrent delivery</title>
40254 If two messages arrive at almost the same time, and both are routed to a pipe
40255 delivery, the two pipe transports may be run concurrently. You must ensure that
40256 any pipe commands you set up are robust against this happening. If the commands
40257 write to a file, the <option>exim_lock</option> utility might be of use.
40260 <section id="SECID141">
40261 <title>Returned status and data</title>
40263 <indexterm role="concept">
40264 <primary><command>pipe</command> transport</primary>
40265 <secondary>returned data</secondary>
40267 If the command exits with a non-zero return code, the delivery is deemed to
40268 have failed, unless either the <option>ignore_status</option> option is set (in which case
40269 the return code is treated as zero), or the return code is one of those listed
40270 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
40271 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
40272 logged, but are not included in the bounce message, which merely contains
40273 <quote>local delivery failed</quote>.
40276 If the return code is greater than 128 and the command being run is a shell
40277 script, it normally means that the script was terminated by a signal whose
40278 value is the return code minus 128.
40281 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
40282 return code is set to 127. This is the value that a shell returns if it is
40283 asked to run a non-existent command. The wording for the log line suggests that
40284 a non-existent command may be the problem.
40287 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
40288 set and the command produces any output on its standard output or standard
40289 error streams, the command is considered to have failed, even if it gave a zero
40290 return code or if <option>ignore_status</option> is set. The output from the command is
40291 included as part of the bounce message. The <option>return_fail_output</option> option is
40292 similar, except that output is returned only when the command exits with a
40293 failure return code, that is, a value other than zero or a code that matches
40294 <option>temp_errors</option>.
40297 <section id="SECThowcommandrun">
40298 <title>How the command is run</title>
40300 <indexterm role="concept">
40301 <primary><command>pipe</command> transport</primary>
40302 <secondary>path for command</secondary>
40304 The command line is (by default) broken down into a command name and arguments
40305 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
40306 <option>restrict_to_path</option> options can be used to restrict the commands that may be
40310 <indexterm role="concept">
40311 <primary>quoting</primary>
40312 <secondary>in pipe command</secondary>
40314 Unquoted arguments are delimited by white space. If an argument appears in
40315 double quotes, backslash is interpreted as an escape character in the usual
40316 way. If an argument appears in single quotes, no escaping is done.
40319 String expansion is applied to the command line except when it comes from a
40320 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
40321 expansion is applied to each argument in turn rather than to the whole line.
40322 For this reason, any string expansion item that contains white space must be
40323 quoted so as to be contained within a single argument. A setting such as
40325 <literallayout class="monospaced">
40326 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
40329 will not work, because the expansion item gets split between several
40330 arguments. You have to write
40332 <literallayout class="monospaced">
40333 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
40336 to ensure that it is all in one argument. The expansion is done in this way,
40337 argument by argument, so that the number of arguments cannot be changed as a
40338 result of expansion, and quotes or backslashes in inserted variables do not
40339 interact with external quoting. However, this leads to problems if you want to
40340 generate multiple arguments (or the command name plus arguments) from a single
40341 expansion. In this situation, the simplest solution is to use a shell. For
40344 <literallayout class="monospaced">
40345 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
40348 <indexterm role="concept">
40349 <primary>transport</primary>
40350 <secondary>filter</secondary>
40352 <indexterm role="concept">
40353 <primary>filter</primary>
40354 <secondary>transport filter</secondary>
40356 <indexterm role="variable">
40357 <primary><varname>$pipe_addresses</varname></primary>
40359 Special handling takes place when an argument consists of precisely the text
40360 <literal>$pipe_addresses</literal>. This is not a general expansion variable; the only
40361 place this string is recognized is when it appears as an argument for a pipe or
40362 transport filter command. It causes each address that is being handled to be
40363 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
40364 avoids any problems with spaces or shell metacharacters, and is of use when a
40365 <command>pipe</command> transport is handling groups of addresses in a batch.
40368 After splitting up into arguments and expansion, the resulting command is run
40369 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
40370 message that is being delivered is supplied on the standard input, and the
40371 standard output and standard error are both connected to a single pipe that is
40372 read by Exim. The <option>max_output</option> option controls how much output the command
40373 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
40374 control what is done with it.
40377 Not running the command under a shell (by default) lessens the security risks
40378 in cases when a command from a user’s filter file is built out of data that was
40379 taken from an incoming message. If a shell is required, it can of course be
40380 explicitly specified as the command to be run. However, there are circumstances
40381 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
40382 under a shell and cannot easily be modified. To allow for these cases, there is
40383 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
40384 works. Instead of breaking up the command line as just described, it expands it
40385 as a single string and passes the result to <filename>/bin/sh</filename>. The
40386 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
40387 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
40390 <section id="SECTpipeenv">
40391 <title>Environment variables</title>
40393 <indexterm role="concept">
40394 <primary><command>pipe</command> transport</primary>
40395 <secondary>environment for command</secondary>
40397 <indexterm role="concept">
40398 <primary>environment for pipe transport</primary>
40400 The environment variables listed below are set up when the command is invoked.
40401 This list is a compromise for maximum compatibility with other MTAs. Note that
40402 the <option>environment</option> option can be used to add additional variables to this
40406 <literal>DOMAIN </literal> the domain of the address
40407 <literal>HOME </literal> the home directory, if set
40408 <literal>HOST </literal> the host name when called from a router (see below)
40409 <literal>LOCAL_PART </literal> see below
40410 <literal>LOCAL_PART_PREFIX </literal> see below
40411 <literal>LOCAL_PART_SUFFIX </literal> see below
40412 <literal>LOGNAME </literal> see below
40413 <literal>MESSAGE_ID </literal> Exim’s local ID for the message
40414 <literal>PATH </literal> as specified by the <option>path</option> option below
40415 <literal>QUALIFY_DOMAIN </literal> the sender qualification domain
40416 <literal>RECIPIENT </literal> the complete recipient address
40417 <literal>SENDER </literal> the sender of the message (empty if a bounce)
40418 <literal>SHELL </literal> <literal>/bin/sh</literal>
40419 <literal>TZ </literal> the value of the <option>timezone</option> option, if set
40420 <literal>USER </literal> see below
40423 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
40424 router, LOCAL_PART is set to the local part of the address. When it is
40425 called as a result of a forward or alias expansion, LOCAL_PART is set to
40426 the local part of the address that was expanded. In both cases, any affixes are
40427 removed from the local part, and made available in LOCAL_PART_PREFIX and
40428 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
40429 same value as LOCAL_PART for compatibility with other MTAs.
40432 <indexterm role="concept">
40433 <primary>HOST</primary>
40435 HOST is set only when a <command>pipe</command> transport is called from a router that
40436 associates hosts with an address, typically when using <command>pipe</command> as a
40437 pseudo-remote transport. HOST is set to the first host name specified by
40441 <indexterm role="concept">
40442 <primary>HOME</primary>
40444 If the transport’s generic <option>home_directory</option> option is set, its value is used
40445 for the HOME environment variable. Otherwise, a home directory may be set
40446 by the router’s <option>transport_home_directory</option> option, which defaults to the
40447 user’s home directory if <option>check_local_user</option> is set.
40450 <section id="SECID142">
40451 <title>Private options for pipe</title>
40453 <indexterm role="concept">
40454 <primary>options</primary>
40455 <secondary><command>pipe</command> transport</secondary>
40459 <indexterm role="option">
40460 <primary><option>allow_commands</option></primary>
40463 <informaltable frame="all">
40464 <tgroup cols="4" colsep="0" rowsep="0">
40465 <colspec colwidth="8*" align="left"/>
40466 <colspec colwidth="6*" align="center"/>
40467 <colspec colwidth="6*" align="center"/>
40468 <colspec colwidth="6*" align="right"/>
40471 <entry><option>allow_commands</option></entry>
40472 <entry>Use: <emphasis>pipe</emphasis></entry>
40473 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
40474 <entry>Default: <emphasis>unset</emphasis></entry>
40480 <indexterm role="concept">
40481 <primary><command>pipe</command> transport</primary>
40482 <secondary>permitted commands</secondary>
40484 The string is expanded, and is then interpreted as a colon-separated list of
40485 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
40486 permitted are those in the <option>allow_commands</option> list. They need not be absolute
40487 paths; the <option>path</option> option is still used for relative paths. If
40488 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
40489 in the <option>allow_commands</option> list, or a name without any slashes that is found on
40490 the path. In other words, if neither <option>allow_commands</option> nor
40491 <option>restrict_to_path</option> is set, there is no restriction on the command, but
40492 otherwise only commands that are permitted by one or the other are allowed. For
40495 <literallayout class="monospaced">
40496 allow_commands = /usr/bin/vacation
40499 and <option>restrict_to_path</option> is not set, the only permitted command is
40500 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
40501 <option>use_shell</option> is set.
40504 <indexterm role="option">
40505 <primary><option>batch_id</option></primary>
40508 <informaltable frame="all">
40509 <tgroup cols="4" colsep="0" rowsep="0">
40510 <colspec colwidth="8*" align="left"/>
40511 <colspec colwidth="6*" align="center"/>
40512 <colspec colwidth="6*" align="center"/>
40513 <colspec colwidth="6*" align="right"/>
40516 <entry><option>batch_id</option></entry>
40517 <entry>Use: <emphasis>pipe</emphasis></entry>
40518 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
40519 <entry>Default: <emphasis>unset</emphasis></entry>
40525 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
40528 <indexterm role="option">
40529 <primary><option>batch_max</option></primary>
40532 <informaltable frame="all">
40533 <tgroup cols="4" colsep="0" rowsep="0">
40534 <colspec colwidth="8*" align="left"/>
40535 <colspec colwidth="6*" align="center"/>
40536 <colspec colwidth="6*" align="center"/>
40537 <colspec colwidth="6*" align="right"/>
40540 <entry><option>batch_max</option></entry>
40541 <entry>Use: <emphasis>pipe</emphasis></entry>
40542 <entry>Type: <emphasis>integer</emphasis></entry>
40543 <entry>Default: <emphasis>1</emphasis></entry>
40549 This limits the number of addresses that can be handled in a single delivery.
40550 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
40553 <indexterm role="option">
40554 <primary><option>check_string</option></primary>
40557 <informaltable frame="all">
40558 <tgroup cols="4" colsep="0" rowsep="0">
40559 <colspec colwidth="8*" align="left"/>
40560 <colspec colwidth="6*" align="center"/>
40561 <colspec colwidth="6*" align="center"/>
40562 <colspec colwidth="6*" align="right"/>
40565 <entry><option>check_string</option></entry>
40566 <entry>Use: <emphasis>pipe</emphasis></entry>
40567 <entry>Type: <emphasis>string</emphasis></entry>
40568 <entry>Default: <emphasis>unset</emphasis></entry>
40574 As <command>pipe</command> writes the message, the start of each line is tested for matching
40575 <option>check_string</option>, and if it does, the initial matching characters are replaced
40576 by the contents of <option>escape_string</option>, provided both are set. The value of
40577 <option>check_string</option> is a literal string, not a regular expression, and the case of
40578 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
40579 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
40580 the SMTP escaping protocol. Any settings made in the configuration file are
40584 <indexterm role="option">
40585 <primary><option>command</option></primary>
40588 <informaltable frame="all">
40589 <tgroup cols="4" colsep="0" rowsep="0">
40590 <colspec colwidth="8*" align="left"/>
40591 <colspec colwidth="6*" align="center"/>
40592 <colspec colwidth="6*" align="center"/>
40593 <colspec colwidth="6*" align="right"/>
40596 <entry><option>command</option></entry>
40597 <entry>Use: <emphasis>pipe</emphasis></entry>
40598 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
40599 <entry>Default: <emphasis>unset</emphasis></entry>
40605 This option need not be set when <command>pipe</command> is being used to deliver to pipes
40606 obtained directly from address redirections. In other cases, the option must be
40607 set, to provide a command to be run. It need not yield an absolute path (see
40608 the <option>path</option> option below). The command is split up into separate arguments by
40609 Exim, and each argument is separately expanded, as described in section
40610 <xref linkend="SECThowcommandrun"/> above.
40613 <indexterm role="option">
40614 <primary><option>environment</option></primary>
40617 <informaltable frame="all">
40618 <tgroup cols="4" colsep="0" rowsep="0">
40619 <colspec colwidth="8*" align="left"/>
40620 <colspec colwidth="6*" align="center"/>
40621 <colspec colwidth="6*" align="center"/>
40622 <colspec colwidth="6*" align="right"/>
40625 <entry><option>environment</option></entry>
40626 <entry>Use: <emphasis>pipe</emphasis></entry>
40627 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
40628 <entry>Default: <emphasis>unset</emphasis></entry>
40634 <indexterm role="concept">
40635 <primary><command>pipe</command> transport</primary>
40636 <secondary>environment for command</secondary>
40638 <indexterm role="concept">
40639 <primary>environment for <command>pipe</command> transport</primary>
40641 This option is used to add additional variables to the environment in which the
40642 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
40643 a string which is expanded, and then interpreted as a colon-separated list of
40644 environment settings of the form <<emphasis>name</emphasis>>=<<emphasis>value</emphasis>>.
40647 <indexterm role="option">
40648 <primary><option>escape_string</option></primary>
40651 <informaltable frame="all">
40652 <tgroup cols="4" colsep="0" rowsep="0">
40653 <colspec colwidth="8*" align="left"/>
40654 <colspec colwidth="6*" align="center"/>
40655 <colspec colwidth="6*" align="center"/>
40656 <colspec colwidth="6*" align="right"/>
40659 <entry><option>escape_string</option></entry>
40660 <entry>Use: <emphasis>pipe</emphasis></entry>
40661 <entry>Type: <emphasis>string</emphasis></entry>
40662 <entry>Default: <emphasis>unset</emphasis></entry>
40668 See <option>check_string</option> above.
40671 <indexterm role="option">
40672 <primary><option>freeze_exec_fail</option></primary>
40675 <informaltable frame="all">
40676 <tgroup cols="4" colsep="0" rowsep="0">
40677 <colspec colwidth="8*" align="left"/>
40678 <colspec colwidth="6*" align="center"/>
40679 <colspec colwidth="6*" align="center"/>
40680 <colspec colwidth="6*" align="right"/>
40683 <entry><option>freeze_exec_fail</option></entry>
40684 <entry>Use: <emphasis>pipe</emphasis></entry>
40685 <entry>Type: <emphasis>boolean</emphasis></entry>
40686 <entry>Default: <emphasis>false</emphasis></entry>
40692 <indexterm role="concept">
40693 <primary>exec failure</primary>
40695 <indexterm role="concept">
40696 <primary>failure of exec</primary>
40698 <indexterm role="concept">
40699 <primary><command>pipe</command> transport</primary>
40700 <secondary>failure of exec</secondary>
40702 Failure to exec the command in a pipe transport is by default treated like
40703 any other failure while running the command. However, if <option>freeze_exec_fail</option>
40704 is set, failure to exec is treated specially, and causes the message to be
40705 frozen, whatever the setting of <option>ignore_status</option>.
40708 <indexterm role="option">
40709 <primary><option>ignore_status</option></primary>
40712 <informaltable frame="all">
40713 <tgroup cols="4" colsep="0" rowsep="0">
40714 <colspec colwidth="8*" align="left"/>
40715 <colspec colwidth="6*" align="center"/>
40716 <colspec colwidth="6*" align="center"/>
40717 <colspec colwidth="6*" align="right"/>
40720 <entry><option>ignore_status</option></entry>
40721 <entry>Use: <emphasis>pipe</emphasis></entry>
40722 <entry>Type: <emphasis>boolean</emphasis></entry>
40723 <entry>Default: <emphasis>false</emphasis></entry>
40729 If this option is true, the status returned by the subprocess that is set up to
40730 run the command is ignored, and Exim behaves as if zero had been returned.
40731 Otherwise, a non-zero status or termination by signal causes an error return
40732 from the transport unless the status value is one of those listed in
40733 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
40736 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
40737 See the <option>timeout_defer</option> option for how timeouts are handled.
40740 <indexterm role="option">
40741 <primary><option>log_defer_output</option></primary>
40744 <informaltable frame="all">
40745 <tgroup cols="4" colsep="0" rowsep="0">
40746 <colspec colwidth="8*" align="left"/>
40747 <colspec colwidth="6*" align="center"/>
40748 <colspec colwidth="6*" align="center"/>
40749 <colspec colwidth="6*" align="right"/>
40752 <entry><option>log_defer_output</option></entry>
40753 <entry>Use: <emphasis>pipe</emphasis></entry>
40754 <entry>Type: <emphasis>boolean</emphasis></entry>
40755 <entry>Default: <emphasis>false</emphasis></entry>
40761 <indexterm role="concept">
40762 <primary><command>pipe</command> transport</primary>
40763 <secondary>logging output</secondary>
40765 If this option is set, and the status returned by the command is
40766 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
40767 and any output was produced, the first line of it is written to the main log.
40770 <indexterm role="option">
40771 <primary><option>log_fail_output</option></primary>
40774 <informaltable frame="all">
40775 <tgroup cols="4" colsep="0" rowsep="0">
40776 <colspec colwidth="8*" align="left"/>
40777 <colspec colwidth="6*" align="center"/>
40778 <colspec colwidth="6*" align="center"/>
40779 <colspec colwidth="6*" align="right"/>
40782 <entry><option>log_fail_output</option></entry>
40783 <entry>Use: <emphasis>pipe</emphasis></entry>
40784 <entry>Type: <emphasis>boolean</emphasis></entry>
40785 <entry>Default: <emphasis>false</emphasis></entry>
40791 If this option is set, and the command returns any output, and also ends with a
40792 return code that is neither zero nor one of the return codes listed in
40793 <option>temp_errors</option> (that is, the delivery failed), the first line of output is
40794 written to the main log. This option and <option>log_output</option> are mutually exclusive.
40795 Only one of them may be set.
40798 <indexterm role="option">
40799 <primary><option>log_output</option></primary>
40802 <informaltable frame="all">
40803 <tgroup cols="4" colsep="0" rowsep="0">
40804 <colspec colwidth="8*" align="left"/>
40805 <colspec colwidth="6*" align="center"/>
40806 <colspec colwidth="6*" align="center"/>
40807 <colspec colwidth="6*" align="right"/>
40810 <entry><option>log_output</option></entry>
40811 <entry>Use: <emphasis>pipe</emphasis></entry>
40812 <entry>Type: <emphasis>boolean</emphasis></entry>
40813 <entry>Default: <emphasis>false</emphasis></entry>
40819 If this option is set and the command returns any output, the first line of
40820 output is written to the main log, whatever the return code. This option and
40821 <option>log_fail_output</option> are mutually exclusive. Only one of them may be set.
40824 <indexterm role="option">
40825 <primary><option>max_output</option></primary>
40828 <informaltable frame="all">
40829 <tgroup cols="4" colsep="0" rowsep="0">
40830 <colspec colwidth="8*" align="left"/>
40831 <colspec colwidth="6*" align="center"/>
40832 <colspec colwidth="6*" align="center"/>
40833 <colspec colwidth="6*" align="right"/>
40836 <entry><option>max_output</option></entry>
40837 <entry>Use: <emphasis>pipe</emphasis></entry>
40838 <entry>Type: <emphasis>integer</emphasis></entry>
40839 <entry>Default: <emphasis>20K</emphasis></entry>
40845 This specifies the maximum amount of output that the command may produce on its
40846 standard output and standard error file combined. If the limit is exceeded, the
40847 process running the command is killed. This is intended as a safety measure to
40848 catch runaway processes. The limit is applied independently of the settings of
40849 the options that control what is done with such output (for example,
40850 <option>return_output</option>). Because of buffering effects, the amount of output may
40851 exceed the limit by a small amount before Exim notices.
40854 <indexterm role="option">
40855 <primary><option>message_prefix</option></primary>
40858 <informaltable frame="all">
40859 <tgroup cols="4" colsep="0" rowsep="0">
40860 <colspec colwidth="8*" align="left"/>
40861 <colspec colwidth="6*" align="center"/>
40862 <colspec colwidth="6*" align="center"/>
40863 <colspec colwidth="6*" align="right"/>
40866 <entry><option>message_prefix</option></entry>
40867 <entry>Use: <emphasis>pipe</emphasis></entry>
40868 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
40869 <entry>Default: <emphasis>see below</emphasis></entry>
40875 The string specified here is expanded and output at the start of every message.
40876 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
40878 <literallayout class="monospaced">
40880 From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
40884 <indexterm role="concept">
40885 <primary>Cyrus</primary>
40887 <indexterm role="concept">
40888 <primary><option>tmail</option></primary>
40890 <indexterm role="concept">
40891 <primary><quote>From</quote> line</primary>
40893 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
40894 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
40895 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
40898 <literallayout class="monospaced">
40902 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
40903 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
40906 <indexterm role="option">
40907 <primary><option>message_suffix</option></primary>
40910 <informaltable frame="all">
40911 <tgroup cols="4" colsep="0" rowsep="0">
40912 <colspec colwidth="8*" align="left"/>
40913 <colspec colwidth="6*" align="center"/>
40914 <colspec colwidth="6*" align="center"/>
40915 <colspec colwidth="6*" align="right"/>
40918 <entry><option>message_suffix</option></entry>
40919 <entry>Use: <emphasis>pipe</emphasis></entry>
40920 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
40921 <entry>Default: <emphasis>see below</emphasis></entry>
40927 The string specified here is expanded and output at the end of every message.
40928 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
40929 The suffix can be suppressed by setting
40931 <literallayout class="monospaced">
40935 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
40936 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
40939 <indexterm role="option">
40940 <primary><option>path</option></primary>
40943 <informaltable frame="all">
40944 <tgroup cols="4" colsep="0" rowsep="0">
40945 <colspec colwidth="8*" align="left"/>
40946 <colspec colwidth="6*" align="center"/>
40947 <colspec colwidth="6*" align="center"/>
40948 <colspec colwidth="6*" align="right"/>
40951 <entry><option>path</option></entry>
40952 <entry>Use: <emphasis>pipe</emphasis></entry>
40953 <entry>Type: <emphasis>string</emphasis></entry>
40954 <entry>Default: <emphasis>see below</emphasis></entry>
40960 This option specifies the string that is set up in the PATH environment
40961 variable of the subprocess. The default is:
40963 <literallayout class="monospaced">
40967 If the <option>command</option> option does not yield an absolute path name, the command is
40968 sought in the PATH directories, in the usual way. <emphasis role="bold">Warning</emphasis>: This does not
40969 apply to a command specified as a transport filter.
40972 <indexterm role="option">
40973 <primary><option>permit_coredump</option></primary>
40976 <informaltable frame="all">
40977 <tgroup cols="4" colsep="0" rowsep="0">
40978 <colspec colwidth="8*" align="left"/>
40979 <colspec colwidth="6*" align="center"/>
40980 <colspec colwidth="6*" align="center"/>
40981 <colspec colwidth="6*" align="right"/>
40984 <entry><option>permit_coredump</option></entry>
40985 <entry>Use: <emphasis>pipe</emphasis></entry>
40986 <entry>Type: <emphasis>boolean</emphasis></entry>
40987 <entry>Default: <emphasis>false</emphasis></entry>
40993 Normally Exim inhibits core-dumps during delivery. If you have a need to get
40994 a core-dump of a pipe command, enable this command. This enables core-dumps
40995 during delivery and affects both the Exim binary and the pipe command run.
40996 It is recommended that this option remain off unless and until you have a need
40997 for it and that this only be enabled when needed, as the risk of excessive
40998 resource consumption can be quite high. Note also that Exim is typically
40999 installed as a setuid binary and most operating systems will inhibit coredumps
41000 of these by default, so further OS-specific action may be required.
41003 <indexterm role="option">
41004 <primary><option>pipe_as_creator</option></primary>
41007 <informaltable frame="all">
41008 <tgroup cols="4" colsep="0" rowsep="0">
41009 <colspec colwidth="8*" align="left"/>
41010 <colspec colwidth="6*" align="center"/>
41011 <colspec colwidth="6*" align="center"/>
41012 <colspec colwidth="6*" align="right"/>
41015 <entry><option>pipe_as_creator</option></entry>
41016 <entry>Use: <emphasis>pipe</emphasis></entry>
41017 <entry>Type: <emphasis>boolean</emphasis></entry>
41018 <entry>Default: <emphasis>false</emphasis></entry>
41024 <indexterm role="concept">
41025 <primary>uid (user id)</primary>
41026 <secondary>local delivery</secondary>
41028 If the generic <option>user</option> option is not set and this option is true, the delivery
41029 process is run under the uid that was in force when Exim was originally called
41030 to accept the message. If the group id is not otherwise set (via the generic
41031 <option>group</option> option), the gid that was in force when Exim was originally called to
41032 accept the message is used.
41035 <indexterm role="option">
41036 <primary><option>restrict_to_path</option></primary>
41039 <informaltable frame="all">
41040 <tgroup cols="4" colsep="0" rowsep="0">
41041 <colspec colwidth="8*" align="left"/>
41042 <colspec colwidth="6*" align="center"/>
41043 <colspec colwidth="6*" align="center"/>
41044 <colspec colwidth="6*" align="right"/>
41047 <entry><option>restrict_to_path</option></entry>
41048 <entry>Use: <emphasis>pipe</emphasis></entry>
41049 <entry>Type: <emphasis>boolean</emphasis></entry>
41050 <entry>Default: <emphasis>false</emphasis></entry>
41056 When this option is set, any command name not listed in <option>allow_commands</option> must
41057 contain no slashes. The command is searched for only in the directories listed
41058 in the <option>path</option> option. This option is intended for use in the case when a pipe
41059 command has been generated from a user’s <filename>.forward</filename> file. This is usually
41060 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
41063 <indexterm role="option">
41064 <primary><option>return_fail_output</option></primary>
41067 <informaltable frame="all">
41068 <tgroup cols="4" colsep="0" rowsep="0">
41069 <colspec colwidth="8*" align="left"/>
41070 <colspec colwidth="6*" align="center"/>
41071 <colspec colwidth="6*" align="center"/>
41072 <colspec colwidth="6*" align="right"/>
41075 <entry><option>return_fail_output</option></entry>
41076 <entry>Use: <emphasis>pipe</emphasis></entry>
41077 <entry>Type: <emphasis>boolean</emphasis></entry>
41078 <entry>Default: <emphasis>false</emphasis></entry>
41084 If this option is true, and the command produced any output and ended with a
41085 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
41086 is, the delivery failed), the output is returned in the bounce message.
41087 However, if the message has a null sender (that is, it is itself a bounce
41088 message), output from the command is discarded. This option and
41089 <option>return_output</option> are mutually exclusive. Only one of them may be set.
41092 <indexterm role="option">
41093 <primary><option>return_output</option></primary>
41096 <informaltable frame="all">
41097 <tgroup cols="4" colsep="0" rowsep="0">
41098 <colspec colwidth="8*" align="left"/>
41099 <colspec colwidth="6*" align="center"/>
41100 <colspec colwidth="6*" align="center"/>
41101 <colspec colwidth="6*" align="right"/>
41104 <entry><option>return_output</option></entry>
41105 <entry>Use: <emphasis>pipe</emphasis></entry>
41106 <entry>Type: <emphasis>boolean</emphasis></entry>
41107 <entry>Default: <emphasis>false</emphasis></entry>
41113 If this option is true, and the command produced any output, the delivery is
41114 deemed to have failed whatever the return code from the command, and the output
41115 is returned in the bounce message. Otherwise, the output is just discarded.
41116 However, if the message has a null sender (that is, it is a bounce message),
41117 output from the command is always discarded, whatever the setting of this
41118 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
41119 of them may be set.
41122 <indexterm role="option">
41123 <primary><option>temp_errors</option></primary>
41126 <informaltable frame="all">
41127 <tgroup cols="4" colsep="0" rowsep="0">
41128 <colspec colwidth="8*" align="left"/>
41129 <colspec colwidth="6*" align="center"/>
41130 <colspec colwidth="6*" align="center"/>
41131 <colspec colwidth="6*" align="right"/>
41134 <entry><option>temp_errors</option></entry>
41135 <entry>Use: <emphasis>pipe</emphasis></entry>
41136 <entry>Type: <emphasis>string list</emphasis></entry>
41137 <entry>Default: <emphasis>see below</emphasis></entry>
41143 <indexterm role="concept">
41144 <primary><command>pipe</command> transport</primary>
41145 <secondary>temporary failure</secondary>
41147 This option contains either a colon-separated list of numbers, or a single
41148 asterisk. If <option>ignore_status</option> is false
41149 and <option>return_output</option> is not set,
41150 and the command exits with a non-zero return code, the failure is treated as
41151 temporary and the delivery is deferred if the return code matches one of the
41152 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
41153 codes are treated as permanent errors. The default setting contains the codes
41154 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
41155 compiled on a system that does not define these macros, it assumes values of 75
41156 and 73, respectively.
41159 <indexterm role="option">
41160 <primary><option>timeout</option></primary>
41163 <informaltable frame="all">
41164 <tgroup cols="4" colsep="0" rowsep="0">
41165 <colspec colwidth="8*" align="left"/>
41166 <colspec colwidth="6*" align="center"/>
41167 <colspec colwidth="6*" align="center"/>
41168 <colspec colwidth="6*" align="right"/>
41171 <entry><option>timeout</option></entry>
41172 <entry>Use: <emphasis>pipe</emphasis></entry>
41173 <entry>Type: <emphasis>time</emphasis></entry>
41174 <entry>Default: <emphasis>1h</emphasis></entry>
41180 If the command fails to complete within this time, it is killed. This normally
41181 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
41182 specifies no timeout. In order to ensure that any subprocesses created by the
41183 command are also killed, Exim makes the initial process a process group leader,
41184 and kills the whole process group on a timeout. However, this can be defeated
41185 if one of the processes starts a new process group.
41188 <indexterm role="option">
41189 <primary><option>timeout_defer</option></primary>
41192 <informaltable frame="all">
41193 <tgroup cols="4" colsep="0" rowsep="0">
41194 <colspec colwidth="8*" align="left"/>
41195 <colspec colwidth="6*" align="center"/>
41196 <colspec colwidth="6*" align="center"/>
41197 <colspec colwidth="6*" align="right"/>
41200 <entry><option>timeout_defer</option></entry>
41201 <entry>Use: <emphasis>pipe</emphasis></entry>
41202 <entry>Type: <emphasis>boolean</emphasis></entry>
41203 <entry>Default: <emphasis>false</emphasis></entry>
41209 A timeout in a <command>pipe</command> transport, either in the command that the transport
41210 runs, or in a transport filter that is associated with it, is by default
41211 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
41212 is set true, both kinds of timeout become temporary errors, causing the
41213 delivery to be deferred.
41216 <indexterm role="option">
41217 <primary><option>umask</option></primary>
41220 <informaltable frame="all">
41221 <tgroup cols="4" colsep="0" rowsep="0">
41222 <colspec colwidth="8*" align="left"/>
41223 <colspec colwidth="6*" align="center"/>
41224 <colspec colwidth="6*" align="center"/>
41225 <colspec colwidth="6*" align="right"/>
41228 <entry><option>umask</option></entry>
41229 <entry>Use: <emphasis>pipe</emphasis></entry>
41230 <entry>Type: <emphasis>octal integer</emphasis></entry>
41231 <entry>Default: <emphasis>022</emphasis></entry>
41237 This specifies the umask setting for the subprocess that runs the command.
41240 <indexterm role="option">
41241 <primary><option>use_bsmtp</option></primary>
41244 <informaltable frame="all">
41245 <tgroup cols="4" colsep="0" rowsep="0">
41246 <colspec colwidth="8*" align="left"/>
41247 <colspec colwidth="6*" align="center"/>
41248 <colspec colwidth="6*" align="center"/>
41249 <colspec colwidth="6*" align="right"/>
41252 <entry><option>use_bsmtp</option></entry>
41253 <entry>Use: <emphasis>pipe</emphasis></entry>
41254 <entry>Type: <emphasis>boolean</emphasis></entry>
41255 <entry>Default: <emphasis>false</emphasis></entry>
41261 <indexterm role="concept">
41262 <primary>envelope sender</primary>
41264 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
41265 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
41266 commands. If you want to include a leading HELO command with such messages,
41267 you can do so by setting the <option>message_prefix</option> option. See section
41268 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
41271 <indexterm role="option">
41272 <primary><option>use_classresources</option></primary>
41275 <informaltable frame="all">
41276 <tgroup cols="4" colsep="0" rowsep="0">
41277 <colspec colwidth="8*" align="left"/>
41278 <colspec colwidth="6*" align="center"/>
41279 <colspec colwidth="6*" align="center"/>
41280 <colspec colwidth="6*" align="right"/>
41283 <entry><option>use_classresources</option></entry>
41284 <entry>Use: <emphasis>pipe</emphasis></entry>
41285 <entry>Type: <emphasis>boolean</emphasis></entry>
41286 <entry>Default: <emphasis>false</emphasis></entry>
41292 <indexterm role="concept">
41293 <primary>class resources (BSD)</primary>
41295 This option is available only when Exim is running on FreeBSD, NetBSD, or
41296 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
41297 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
41298 limits for the uid under which the pipe is to run are obtained from the login
41302 <indexterm role="option">
41303 <primary><option>use_crlf</option></primary>
41306 <informaltable frame="all">
41307 <tgroup cols="4" colsep="0" rowsep="0">
41308 <colspec colwidth="8*" align="left"/>
41309 <colspec colwidth="6*" align="center"/>
41310 <colspec colwidth="6*" align="center"/>
41311 <colspec colwidth="6*" align="right"/>
41314 <entry><option>use_crlf</option></entry>
41315 <entry>Use: <emphasis>pipe</emphasis></entry>
41316 <entry>Type: <emphasis>boolean</emphasis></entry>
41317 <entry>Default: <emphasis>false</emphasis></entry>
41323 <indexterm role="concept">
41324 <primary>carriage return</primary>
41326 <indexterm role="concept">
41327 <primary>linefeed</primary>
41329 This option causes lines to be terminated with the two-character CRLF sequence
41330 (carriage return, linefeed) instead of just a linefeed character. In the case
41331 of batched SMTP, the byte sequence written to the pipe is then an exact image
41332 of what would be sent down a real SMTP connection.
41335 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
41336 written verbatim, so must contain their own carriage return characters if these
41337 are needed. When <option>use_bsmtp</option> is not set, the default values for both
41338 <option>message_prefix</option> and <option>message_suffix</option> end with a single linefeed, so their
41339 values must be changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
41342 <indexterm role="option">
41343 <primary><option>use_shell</option></primary>
41346 <informaltable frame="all">
41347 <tgroup cols="4" colsep="0" rowsep="0">
41348 <colspec colwidth="8*" align="left"/>
41349 <colspec colwidth="6*" align="center"/>
41350 <colspec colwidth="6*" align="center"/>
41351 <colspec colwidth="6*" align="right"/>
41354 <entry><option>use_shell</option></entry>
41355 <entry>Use: <emphasis>pipe</emphasis></entry>
41356 <entry>Type: <emphasis>boolean</emphasis></entry>
41357 <entry>Default: <emphasis>false</emphasis></entry>
41363 <indexterm role="variable">
41364 <primary><varname>$pipe_addresses</varname></primary>
41366 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
41367 instead of being run directly from the transport, as described in section
41368 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
41369 where the command is expected to be run under a shell and cannot easily be
41370 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
41371 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
41372 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
41373 its <option>-c</option> option.
41376 <section id="SECID143">
41377 <title>Using an external local delivery agent</title>
41379 <indexterm role="concept">
41380 <primary>local delivery</primary>
41381 <secondary>using an external agent</secondary>
41383 <indexterm role="concept">
41384 <primary><emphasis>procmail</emphasis></primary>
41386 <indexterm role="concept">
41387 <primary>external local delivery</primary>
41389 <indexterm role="concept">
41390 <primary>delivery</primary>
41391 <secondary><emphasis>procmail</emphasis></secondary>
41393 <indexterm role="concept">
41394 <primary>delivery</primary>
41395 <secondary>by external agent</secondary>
41397 The <command>pipe</command> transport can be used to pass all messages that require local
41398 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
41399 this, care must be taken to ensure that the pipe is run under an appropriate
41400 uid and gid. In some configurations one wants this to be a uid that is trusted
41401 by the delivery agent to supply the correct sender of the message. It may be
41402 necessary to recompile or reconfigure the delivery agent so that it trusts an
41403 appropriate user. The following is an example transport and router
41404 configuration for <option>procmail</option>:
41406 <literallayout class="monospaced">
41410 command = /usr/local/bin/procmail -d $local_part
41414 check_string = "From "
41415 escape_string = ">From "
41424 transport = procmail_pipe
41427 In this example, the pipe is run as the local user, but with the group set to
41428 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
41429 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
41430 user to supply a correct sender address. If you do not specify either a
41431 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
41432 home directory is the user’s home directory by default.
41435 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
41437 <literallayout class="monospaced">
41441 as shown in some <option>procmail</option> documentation, because Exim does not by default
41442 use a shell to run pipe commands.
41445 <indexterm role="concept">
41446 <primary>Cyrus</primary>
41448 The next example shows a transport and a router for a system where local
41449 deliveries are handled by the Cyrus IMAP server.
41451 <literallayout class="monospaced">
41453 local_delivery_cyrus:
41455 command = /usr/cyrus/bin/deliver \
41456 -m ${substr_1:$local_part_suffix} -- $local_part
41468 local_part_suffix = .*
41469 transport = local_delivery_cyrus
41472 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
41473 <option>return_output</option> to cause any text written by Cyrus to be returned to the
41475 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
41476 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
41481 <chapter id="CHAPsmtptrans">
41482 <title>The smtp transport</title>
41484 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
41485 <primary>transports</primary>
41486 <secondary><command>smtp</command></secondary>
41488 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
41489 <primary><command>smtp</command> transport</primary>
41491 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
41492 or LMTP protocol. The list of hosts to try can either be taken from the address
41493 that is being processed (having been set up by the router), or specified
41494 explicitly for the transport. Timeout and retry processing (see chapter
41495 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
41497 <section id="SECID144">
41498 <title>Multiple messages on a single connection</title>
41500 The sending of multiple messages over a single TCP/IP connection can arise in
41506 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
41507 routed to the same host, more than one copy of the message has to be sent to
41508 that host. In this situation, multiple copies may be sent in a single run of
41509 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
41510 does when it has too many addresses to send in one message also depends on the
41511 value of the global <option>remote_max_parallel</option> option. Details are given in
41512 section <xref linkend="SECToutSMTPTCP"/>.)
41517 <indexterm role="concept">
41518 <primary>hints database</primary>
41519 <secondary>remembering routing</secondary>
41521 When a message has been successfully delivered over a TCP/IP connection, Exim
41522 looks in its hints database to see if there are any other messages awaiting a
41523 connection to the same host. If there are, a new delivery process is started
41524 for one of them, and the current TCP/IP connection is passed on to it. The new
41525 process may in turn send multiple copies and possibly create yet another
41531 For each copy sent over the same TCP/IP connection, a sequence counter is
41532 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
41533 no further messages are sent over that connection.
41536 <section id="SECID145">
41537 <title>Use of the $host and $host_address variables</title>
41539 <indexterm role="variable">
41540 <primary><varname>$host</varname></primary>
41542 <indexterm role="variable">
41543 <primary><varname>$host_address</varname></primary>
41545 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
41546 <varname>$host_address</varname> are the name and IP address of the first host on the host list
41547 passed by the router. However, when the transport is about to connect to a
41548 specific host, and while it is connected to that host, <varname>$host</varname> and
41549 <varname>$host_address</varname> are set to the values for that host. These are the values
41550 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
41551 <option>serialize_hosts</option>, and the various TLS options are expanded.
41554 <section id="usecippeer">
41555 <title>Use of $tls_cipher and $tls_peerdn</title>
41557 <indexterm role="variable">
41558 <primary><varname>$tls_cipher</varname></primary>
41560 <indexterm role="variable">
41561 <primary><varname>$tls_peerdn</varname></primary>
41563 At the start of a run of the <command>smtp</command> transport, the values of <varname>$tls_cipher</varname>
41564 and <varname>$tls_peerdn</varname> are the values that were set when the message was received.
41565 These are the values that are used for options that are expanded before any
41566 SMTP connections are made. Just before each connection is made, these two
41567 variables are emptied. If TLS is subsequently started, they are set to the
41568 appropriate values for the outgoing connection, and these are the values that
41569 are in force when any authenticators are run and when the
41570 <option>authenticated_sender</option> option is expanded.
41573 <section id="SECID146">
41574 <title>Private options for smtp</title>
41576 <indexterm role="concept">
41577 <primary>options</primary>
41578 <secondary><command>smtp</command> transport</secondary>
41580 The private options of the <command>smtp</command> transport are as follows:
41583 <indexterm role="option">
41584 <primary><option>address_retry_include_sender</option></primary>
41587 <informaltable frame="all">
41588 <tgroup cols="4" colsep="0" rowsep="0">
41589 <colspec colwidth="8*" align="left"/>
41590 <colspec colwidth="6*" align="center"/>
41591 <colspec colwidth="6*" align="center"/>
41592 <colspec colwidth="6*" align="right"/>
41595 <entry><option>address_retry_include_sender</option></entry>
41596 <entry>Use: <emphasis>smtp</emphasis></entry>
41597 <entry>Type: <emphasis>boolean</emphasis></entry>
41598 <entry>Default: <emphasis>true</emphasis></entry>
41604 <indexterm role="concept">
41605 <primary>4<emphasis>xx</emphasis> responses</primary>
41606 <secondary>retrying after</secondary>
41608 When an address is delayed because of a 4<emphasis>xx</emphasis> response to a RCPT command, it
41609 is the combination of sender and recipient that is delayed in subsequent queue
41610 runs until the retry time is reached. You can delay the recipient without
41611 reference to the sender (which is what earlier versions of Exim did), by
41612 setting <option>address_retry_include_sender</option> false. However, this can lead to
41613 problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT commands.
41616 <indexterm role="option">
41617 <primary><option>allow_localhost</option></primary>
41620 <informaltable frame="all">
41621 <tgroup cols="4" colsep="0" rowsep="0">
41622 <colspec colwidth="8*" align="left"/>
41623 <colspec colwidth="6*" align="center"/>
41624 <colspec colwidth="6*" align="center"/>
41625 <colspec colwidth="6*" align="right"/>
41628 <entry><option>allow_localhost</option></entry>
41629 <entry>Use: <emphasis>smtp</emphasis></entry>
41630 <entry>Type: <emphasis>boolean</emphasis></entry>
41631 <entry>Default: <emphasis>false</emphasis></entry>
41637 <indexterm role="concept">
41638 <primary>local host</primary>
41639 <secondary>sending to</secondary>
41641 <indexterm role="concept">
41642 <primary>fallback</primary>
41643 <secondary>hosts specified on transport</secondary>
41645 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
41646 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
41647 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
41648 the delivery anyway. This should be used only in special cases when the
41649 configuration ensures that no looping will result (for example, a differently
41650 configured Exim is listening on the port to which the message is sent).
41653 <indexterm role="option">
41654 <primary><option>authenticated_sender</option></primary>
41657 <informaltable frame="all">
41658 <tgroup cols="4" colsep="0" rowsep="0">
41659 <colspec colwidth="8*" align="left"/>
41660 <colspec colwidth="6*" align="center"/>
41661 <colspec colwidth="6*" align="center"/>
41662 <colspec colwidth="6*" align="right"/>
41665 <entry><option>authenticated_sender</option></entry>
41666 <entry>Use: <emphasis>smtp</emphasis></entry>
41667 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
41668 <entry>Default: <emphasis>unset</emphasis></entry>
41674 <indexterm role="concept">
41675 <primary>Cyrus</primary>
41677 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
41678 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
41679 overriding any existing authenticated sender value. If the string expansion is
41680 forced to fail, the option is ignored. Other expansion failures cause delivery
41681 to be deferred. If the result of expansion is an empty string, that is also
41685 The expansion happens after the outgoing connection has been made and TLS
41686 started, if required. This means that the <varname>$host</varname>, <varname>$host_address</varname>,
41687 <varname>$tls_cipher</varname>, and <varname>$tls_peerdn</varname> variables are set according to the
41688 particular connection.
41691 If the SMTP session is not authenticated, the expansion of
41692 <option>authenticated_sender</option> still happens (and can cause the delivery to be
41693 deferred if it fails), but no AUTH= item is added to MAIL commands
41694 unless <option>authenticated_sender_force</option> is true.
41697 This option allows you to use the <command>smtp</command> transport in LMTP mode to
41698 deliver mail to Cyrus IMAP and provide the proper local part as the
41699 <quote>authenticated sender</quote>, via a setting such as:
41701 <literallayout class="monospaced">
41702 authenticated_sender = $local_part
41705 This removes the need for IMAP subfolders to be assigned special ACLs to
41706 allow direct delivery to those subfolders.
41709 Because of expected uses such as that just described for Cyrus (when no
41710 domain is involved), there is no checking on the syntax of the provided
41714 <indexterm role="option">
41715 <primary><option>authenticated_sender_force</option></primary>
41718 <informaltable frame="all">
41719 <tgroup cols="4" colsep="0" rowsep="0">
41720 <colspec colwidth="8*" align="left"/>
41721 <colspec colwidth="6*" align="center"/>
41722 <colspec colwidth="6*" align="center"/>
41723 <colspec colwidth="6*" align="right"/>
41726 <entry><option>authenticated_sender_force</option></entry>
41727 <entry>Use: <emphasis>smtp</emphasis></entry>
41728 <entry>Type: <emphasis>boolean</emphasis></entry>
41729 <entry>Default: <emphasis>false</emphasis></entry>
41735 If this option is set true, the <option>authenticated_sender</option> option’s value
41736 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
41737 authenticated as a client.
41740 <indexterm role="option">
41741 <primary><option>command_timeout</option></primary>
41744 <informaltable frame="all">
41745 <tgroup cols="4" colsep="0" rowsep="0">
41746 <colspec colwidth="8*" align="left"/>
41747 <colspec colwidth="6*" align="center"/>
41748 <colspec colwidth="6*" align="center"/>
41749 <colspec colwidth="6*" align="right"/>
41752 <entry><option>command_timeout</option></entry>
41753 <entry>Use: <emphasis>smtp</emphasis></entry>
41754 <entry>Type: <emphasis>time</emphasis></entry>
41755 <entry>Default: <emphasis>5m</emphasis></entry>
41761 This sets a timeout for receiving a response to an SMTP command that has been
41762 sent out. It is also used when waiting for the initial banner line from the
41763 remote host. Its value must not be zero.
41766 <indexterm role="option">
41767 <primary><option>connect_timeout</option></primary>
41770 <informaltable frame="all">
41771 <tgroup cols="4" colsep="0" rowsep="0">
41772 <colspec colwidth="8*" align="left"/>
41773 <colspec colwidth="6*" align="center"/>
41774 <colspec colwidth="6*" align="center"/>
41775 <colspec colwidth="6*" align="right"/>
41778 <entry><option>connect_timeout</option></entry>
41779 <entry>Use: <emphasis>smtp</emphasis></entry>
41780 <entry>Type: <emphasis>time</emphasis></entry>
41781 <entry>Default: <emphasis>5m</emphasis></entry>
41787 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
41788 to a remote host. A setting of zero allows the system timeout (typically
41789 several minutes) to act. To have any effect, the value of this option must be
41790 less than the system timeout. However, it has been observed that on some
41791 systems there is no system timeout, which is why the default value for this
41792 option is 5 minutes, a value recommended by RFC 1123.
41795 <indexterm role="option">
41796 <primary><option>connection_max_messages</option></primary>
41799 <informaltable frame="all">
41800 <tgroup cols="4" colsep="0" rowsep="0">
41801 <colspec colwidth="8*" align="left"/>
41802 <colspec colwidth="6*" align="center"/>
41803 <colspec colwidth="6*" align="center"/>
41804 <colspec colwidth="6*" align="right"/>
41807 <entry><option>connection_max_messages</option></entry>
41808 <entry>Use: <emphasis>smtp</emphasis></entry>
41809 <entry>Type: <emphasis>integer</emphasis></entry>
41810 <entry>Default: <emphasis>500</emphasis></entry>
41816 <indexterm role="concept">
41817 <primary>SMTP</primary>
41818 <secondary>passed connection</secondary>
41820 <indexterm role="concept">
41821 <primary>SMTP</primary>
41822 <secondary>multiple deliveries</secondary>
41824 <indexterm role="concept">
41825 <primary>multiple SMTP deliveries</primary>
41827 This controls the maximum number of separate message deliveries that are sent
41828 over a single TCP/IP connection. If the value is zero, there is no limit.
41829 For testing purposes, this value can be overridden by the <option>-oB</option> command line
41833 <indexterm role="option">
41834 <primary><option>data_timeout</option></primary>
41837 <informaltable frame="all">
41838 <tgroup cols="4" colsep="0" rowsep="0">
41839 <colspec colwidth="8*" align="left"/>
41840 <colspec colwidth="6*" align="center"/>
41841 <colspec colwidth="6*" align="center"/>
41842 <colspec colwidth="6*" align="right"/>
41845 <entry><option>data_timeout</option></entry>
41846 <entry>Use: <emphasis>smtp</emphasis></entry>
41847 <entry>Type: <emphasis>time</emphasis></entry>
41848 <entry>Default: <emphasis>5m</emphasis></entry>
41854 This sets a timeout for the transmission of each block in the data portion of
41855 the message. As a result, the overall timeout for a message depends on the size
41856 of the message. Its value must not be zero. See also <option>final_timeout</option>.
41859 <indexterm role="option">
41860 <primary><option>delay_after_cutoff</option></primary>
41863 <informaltable frame="all">
41864 <tgroup cols="4" colsep="0" rowsep="0">
41865 <colspec colwidth="8*" align="left"/>
41866 <colspec colwidth="6*" align="center"/>
41867 <colspec colwidth="6*" align="center"/>
41868 <colspec colwidth="6*" align="right"/>
41871 <entry><option>delay_after_cutoff</option></entry>
41872 <entry>Use: <emphasis>smtp</emphasis></entry>
41873 <entry>Type: <emphasis>boolean</emphasis></entry>
41874 <entry>Default: <emphasis>true</emphasis></entry>
41880 This option controls what happens when all remote IP addresses for a given
41881 domain have been inaccessible for so long that they have passed their retry
41885 In the default state, if the next retry time has not been reached for any of
41886 them, the address is bounced without trying any deliveries. In other words,
41887 Exim delays retrying an IP address after the final cutoff time until a new
41888 retry time is reached, and can therefore bounce an address without ever trying
41889 a delivery, when machines have been down for a long time. Some people are
41890 unhappy at this prospect, so...
41893 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
41894 addresses are past their final cutoff time, Exim tries to deliver to those
41895 IP addresses that have not been tried since the message arrived. If there are
41896 none, of if they all fail, the address is bounced. In other words, it does not
41897 delay when a new message arrives, but immediately tries those expired IP
41898 addresses that haven’t been tried since the message arrived. If there is a
41899 continuous stream of messages for the dead hosts, unsetting
41900 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
41904 <indexterm role="option">
41905 <primary><option>dns_qualify_single</option></primary>
41908 <informaltable frame="all">
41909 <tgroup cols="4" colsep="0" rowsep="0">
41910 <colspec colwidth="8*" align="left"/>
41911 <colspec colwidth="6*" align="center"/>
41912 <colspec colwidth="6*" align="center"/>
41913 <colspec colwidth="6*" align="right"/>
41916 <entry><option>dns_qualify_single</option></entry>
41917 <entry>Use: <emphasis>smtp</emphasis></entry>
41918 <entry>Type: <emphasis>boolean</emphasis></entry>
41919 <entry>Default: <emphasis>true</emphasis></entry>
41925 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
41926 and the <option>gethostbyname</option> option is false,
41927 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
41928 in chapter <xref linkend="CHAPdnslookup"/> for more details.
41931 <indexterm role="option">
41932 <primary><option>dns_search_parents</option></primary>
41935 <informaltable frame="all">
41936 <tgroup cols="4" colsep="0" rowsep="0">
41937 <colspec colwidth="8*" align="left"/>
41938 <colspec colwidth="6*" align="center"/>
41939 <colspec colwidth="6*" align="center"/>
41940 <colspec colwidth="6*" align="right"/>
41943 <entry><option>dns_search_parents</option></entry>
41944 <entry>Use: <emphasis>smtp</emphasis></entry>
41945 <entry>Type: <emphasis>boolean</emphasis></entry>
41946 <entry>Default: <emphasis>false</emphasis></entry>
41952 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
41953 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
41954 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
41958 <indexterm role="option">
41959 <primary><option>fallback_hosts</option></primary>
41962 <informaltable frame="all">
41963 <tgroup cols="4" colsep="0" rowsep="0">
41964 <colspec colwidth="8*" align="left"/>
41965 <colspec colwidth="6*" align="center"/>
41966 <colspec colwidth="6*" align="center"/>
41967 <colspec colwidth="6*" align="right"/>
41970 <entry><option>fallback_hosts</option></entry>
41971 <entry>Use: <emphasis>smtp</emphasis></entry>
41972 <entry>Type: <emphasis>string list</emphasis></entry>
41973 <entry>Default: <emphasis>unset</emphasis></entry>
41979 <indexterm role="concept">
41980 <primary>fallback</primary>
41981 <secondary>hosts specified on transport</secondary>
41983 String expansion is not applied to this option. The argument must be a
41984 colon-separated list of host names or IP addresses, optionally also including
41985 port numbers, though the separator can be changed, as described in section
41986 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
41987 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
41988 in section <xref linkend="SECTformatonehostitem"/>.
41991 Fallback hosts can also be specified on routers, which associate them with the
41992 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
41993 <option>fallback_hosts</option> specified on the transport is used only if the address does
41994 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
41995 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
41996 However, <option>hosts_randomize</option> does apply to fallback host lists.
41999 If Exim is unable to deliver to any of the hosts for a particular address, and
42000 the errors are not permanent rejections, the address is put on a separate
42001 transport queue with its host list replaced by the fallback hosts, unless the
42002 address was routed via MX records and the current host was in the original MX
42003 list. In that situation, the fallback host list is not used.
42006 Once normal deliveries are complete, the fallback queue is delivered by
42007 re-running the same transports with the new host lists. If several failing
42008 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
42009 copy of the message is sent.
42012 The resolution of the host names on the fallback list is controlled by the
42013 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
42014 both to cases when the host list comes with the address and when it is taken
42015 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
42016 fails</quote> facility.
42019 <indexterm role="option">
42020 <primary><option>final_timeout</option></primary>
42023 <informaltable frame="all">
42024 <tgroup cols="4" colsep="0" rowsep="0">
42025 <colspec colwidth="8*" align="left"/>
42026 <colspec colwidth="6*" align="center"/>
42027 <colspec colwidth="6*" align="center"/>
42028 <colspec colwidth="6*" align="right"/>
42031 <entry><option>final_timeout</option></entry>
42032 <entry>Use: <emphasis>smtp</emphasis></entry>
42033 <entry>Type: <emphasis>time</emphasis></entry>
42034 <entry>Default: <emphasis>10m</emphasis></entry>
42040 This is the timeout that applies while waiting for the response to the final
42041 line containing just <quote>.</quote> that terminates a message. Its value must not be
42045 <indexterm role="option">
42046 <primary><option>gethostbyname</option></primary>
42049 <informaltable frame="all">
42050 <tgroup cols="4" colsep="0" rowsep="0">
42051 <colspec colwidth="8*" align="left"/>
42052 <colspec colwidth="6*" align="center"/>
42053 <colspec colwidth="6*" align="center"/>
42054 <colspec colwidth="6*" align="right"/>
42057 <entry><option>gethostbyname</option></entry>
42058 <entry>Use: <emphasis>smtp</emphasis></entry>
42059 <entry>Type: <emphasis>boolean</emphasis></entry>
42060 <entry>Default: <emphasis>false</emphasis></entry>
42066 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
42067 being used, names are looked up using <function>gethostbyname()</function>
42068 (or <function>getipnodebyname()</function> when available)
42069 instead of using the DNS. Of course, that function may in fact use the DNS, but
42070 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
42073 <indexterm role="option">
42074 <primary><option>gnutls_require_kx</option></primary>
42077 <informaltable frame="all">
42078 <tgroup cols="4" colsep="0" rowsep="0">
42079 <colspec colwidth="8*" align="left"/>
42080 <colspec colwidth="6*" align="center"/>
42081 <colspec colwidth="6*" align="center"/>
42082 <colspec colwidth="6*" align="right"/>
42085 <entry><option>gnutls_require_kx</option></entry>
42086 <entry>Use: <emphasis>smtp</emphasis></entry>
42087 <entry>Type: <emphasis>string</emphasis></entry>
42088 <entry>Default: <emphasis>unset</emphasis></entry>
42094 This option controls the key exchange mechanisms when GnuTLS is used in an Exim
42095 client. For details, see section <xref linkend="SECTreqciphgnu"/>.
42098 <indexterm role="option">
42099 <primary><option>gnutls_require_mac</option></primary>
42102 <informaltable frame="all">
42103 <tgroup cols="4" colsep="0" rowsep="0">
42104 <colspec colwidth="8*" align="left"/>
42105 <colspec colwidth="6*" align="center"/>
42106 <colspec colwidth="6*" align="center"/>
42107 <colspec colwidth="6*" align="right"/>
42110 <entry><option>gnutls_require_mac</option></entry>
42111 <entry>Use: <emphasis>smtp</emphasis></entry>
42112 <entry>Type: <emphasis>string</emphasis></entry>
42113 <entry>Default: <emphasis>unset</emphasis></entry>
42119 This option controls the MAC algorithms when GnuTLS is used in an Exim
42120 client. For details, see section <xref linkend="SECTreqciphgnu"/>.
42123 <indexterm role="option">
42124 <primary><option>gnutls_require_protocols</option></primary>
42127 <informaltable frame="all">
42128 <tgroup cols="4" colsep="0" rowsep="0">
42129 <colspec colwidth="8*" align="left"/>
42130 <colspec colwidth="6*" align="center"/>
42131 <colspec colwidth="6*" align="center"/>
42132 <colspec colwidth="6*" align="right"/>
42135 <entry><option>gnutls_require_protocols</option></entry>
42136 <entry>Use: <emphasis>smtp</emphasis></entry>
42137 <entry>Type: <emphasis>string</emphasis></entry>
42138 <entry>Default: <emphasis>unset</emphasis></entry>
42144 This option controls the protocols when GnuTLS is used in an Exim
42145 client. For details, see section <xref linkend="SECTreqciphgnu"/>.
42148 <indexterm role="option">
42149 <primary><option>gnutls_compat_mode</option></primary>
42152 <informaltable frame="all">
42153 <tgroup cols="4" colsep="0" rowsep="0">
42154 <colspec colwidth="8*" align="left"/>
42155 <colspec colwidth="6*" align="center"/>
42156 <colspec colwidth="6*" align="center"/>
42157 <colspec colwidth="6*" align="right"/>
42160 <entry><option>gnutls_compat_mode</option></entry>
42161 <entry>Use: <emphasis>smtp</emphasis></entry>
42162 <entry>Type: <emphasis>boolean</emphasis></entry>
42163 <entry>Default: <emphasis>unset</emphasis></entry>
42169 This option controls whether GnuTLS is used in compatibility mode in an Exim
42170 server. This reduces security slightly, but improves interworking with older
42171 implementations of TLS.
42174 <indexterm role="option">
42175 <primary><option>helo_data</option></primary>
42178 <informaltable frame="all">
42179 <tgroup cols="4" colsep="0" rowsep="0">
42180 <colspec colwidth="8*" align="left"/>
42181 <colspec colwidth="6*" align="center"/>
42182 <colspec colwidth="6*" align="center"/>
42183 <colspec colwidth="6*" align="right"/>
42186 <entry><option>helo_data</option></entry>
42187 <entry>Use: <emphasis>smtp</emphasis></entry>
42188 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
42189 <entry>Default: <emphasis>see below</emphasis></entry>
42195 <indexterm role="concept">
42196 <primary>HELO</primary>
42197 <secondary>argument, setting</secondary>
42199 <indexterm role="concept">
42200 <primary>EHLO</primary>
42201 <secondary>argument, setting</secondary>
42203 <indexterm role="concept">
42204 <primary>LHLO argument setting</primary>
42206 The value of this option is expanded after a connection to a another host has
42207 been set up. The result is used as the argument for the EHLO, HELO, or LHLO
42208 command that starts the outgoing SMTP or LMTP session. The default value of the
42211 <literallayout class="monospaced">
42215 During the expansion, the variables <varname>$host</varname> and <varname>$host_address</varname> are set to
42216 the identity of the remote host, and the variables <varname>$sending_ip_address</varname> and
42217 <varname>$sending_port</varname> are set to the local IP address and port number that are being
42218 used. These variables can be used to generate different values for different
42219 servers or different local IP addresses. For example, if you want the string
42220 that is used for <option>helo_data</option> to be obtained by a DNS lookup of the outgoing
42221 interface address, you could use this:
42223 <literallayout class="monospaced">
42224 helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}\
42225 {$primary_hostname}}
42228 The use of <option>helo_data</option> applies both to sending messages and when doing
42232 <indexterm role="option">
42233 <primary><option>hosts</option></primary>
42236 <informaltable frame="all">
42237 <tgroup cols="4" colsep="0" rowsep="0">
42238 <colspec colwidth="8*" align="left"/>
42239 <colspec colwidth="6*" align="center"/>
42240 <colspec colwidth="6*" align="center"/>
42241 <colspec colwidth="6*" align="right"/>
42244 <entry><option>hosts</option></entry>
42245 <entry>Use: <emphasis>smtp</emphasis></entry>
42246 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
42247 <entry>Default: <emphasis>unset</emphasis></entry>
42253 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
42254 finds the hosts by looking up the address domain in the DNS, or by
42255 <command>manualroute</command>, which has lists of hosts in its configuration. However,
42256 email addresses can be passed to the <command>smtp</command> transport by any router, and not
42257 all of them can provide an associated list of hosts.
42260 The <option>hosts</option> option specifies a list of hosts to be used if the address being
42261 processed does not have any hosts associated with it. The hosts specified by
42262 <option>hosts</option> are also used, whether or not the address has its own hosts, if
42263 <option>hosts_override</option> is set.
42266 The string is first expanded, before being interpreted as a colon-separated
42267 list of host names or IP addresses, possibly including port numbers. The
42268 separator may be changed to something other than colon, as described in section
42269 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
42270 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
42271 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
42272 of the <command>manualroute</command> router is not available here.
42275 If the expansion fails, delivery is deferred. Unless the failure was caused by
42276 the inability to complete a lookup, the error is logged to the panic log as
42277 well as the main log. Host names are looked up either by searching directly for
42278 address records in the DNS or by calling <function>gethostbyname()</function> (or
42279 <function>getipnodebyname()</function> when available), depending on the setting of the
42280 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
42281 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
42285 During delivery, the hosts are tried in order, subject to their retry status,
42286 unless <option>hosts_randomize</option> is set.
42289 <indexterm role="option">
42290 <primary><option>hosts_avoid_esmtp</option></primary>
42293 <informaltable frame="all">
42294 <tgroup cols="4" colsep="0" rowsep="0">
42295 <colspec colwidth="8*" align="left"/>
42296 <colspec colwidth="6*" align="center"/>
42297 <colspec colwidth="6*" align="center"/>
42298 <colspec colwidth="6*" align="right"/>
42301 <entry><option>hosts_avoid_esmtp</option></entry>
42302 <entry>Use: <emphasis>smtp</emphasis></entry>
42303 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
42304 <entry>Default: <emphasis>unset</emphasis></entry>
42310 <indexterm role="concept">
42311 <primary>ESMTP, avoiding use of</primary>
42313 <indexterm role="concept">
42314 <primary>HELO</primary>
42315 <secondary>forcing use of</secondary>
42317 <indexterm role="concept">
42318 <primary>EHLO</primary>
42319 <secondary>avoiding use of</secondary>
42321 <indexterm role="concept">
42322 <primary>PIPELINING</primary>
42323 <secondary>avoiding the use of</secondary>
42325 This option is for use with broken hosts that announce ESMTP facilities (for
42326 example, PIPELINING) and then fail to implement them properly. When a host
42327 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
42328 start of the SMTP session. This means that it cannot use any of the ESMTP
42329 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
42332 <indexterm role="option">
42333 <primary><option>hosts_avoid_pipelining</option></primary>
42336 <informaltable frame="all">
42337 <tgroup cols="4" colsep="0" rowsep="0">
42338 <colspec colwidth="8*" align="left"/>
42339 <colspec colwidth="6*" align="center"/>
42340 <colspec colwidth="6*" align="center"/>
42341 <colspec colwidth="6*" align="right"/>
42344 <entry><option>hosts_avoid_pipelining</option></entry>
42345 <entry>Use: <emphasis>smtp</emphasis></entry>
42346 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
42347 <entry>Default: <emphasis>unset</emphasis></entry>
42353 <indexterm role="concept">
42354 <primary>PIPELINING</primary>
42355 <secondary>avoiding the use of</secondary>
42357 Exim will not use the SMTP PIPELINING extension when delivering to any host
42358 that matches this list, even if the server host advertises PIPELINING support.
42361 <indexterm role="option">
42362 <primary><option>hosts_avoid_tls</option></primary>
42365 <informaltable frame="all">
42366 <tgroup cols="4" colsep="0" rowsep="0">
42367 <colspec colwidth="8*" align="left"/>
42368 <colspec colwidth="6*" align="center"/>
42369 <colspec colwidth="6*" align="center"/>
42370 <colspec colwidth="6*" align="right"/>
42373 <entry><option>hosts_avoid_tls</option></entry>
42374 <entry>Use: <emphasis>smtp</emphasis></entry>
42375 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
42376 <entry>Default: <emphasis>unset</emphasis></entry>
42382 <indexterm role="concept">
42383 <primary>TLS</primary>
42384 <secondary>avoiding for certain hosts</secondary>
42386 Exim will not try to start a TLS session when delivering to any host that
42387 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
42390 <indexterm role="option">
42391 <primary><option>hosts_max_try</option></primary>
42394 <informaltable frame="all">
42395 <tgroup cols="4" colsep="0" rowsep="0">
42396 <colspec colwidth="8*" align="left"/>
42397 <colspec colwidth="6*" align="center"/>
42398 <colspec colwidth="6*" align="center"/>
42399 <colspec colwidth="6*" align="right"/>
42402 <entry><option>hosts_max_try</option></entry>
42403 <entry>Use: <emphasis>smtp</emphasis></entry>
42404 <entry>Type: <emphasis>integer</emphasis></entry>
42405 <entry>Default: <emphasis>5</emphasis></entry>
42411 <indexterm role="concept">
42412 <primary>host</primary>
42413 <secondary>maximum number to try</secondary>
42415 <indexterm role="concept">
42416 <primary>limit</primary>
42417 <secondary>number of hosts tried</secondary>
42419 <indexterm role="concept">
42420 <primary>limit</primary>
42421 <secondary>number of MX tried</secondary>
42423 <indexterm role="concept">
42424 <primary>MX record</primary>
42425 <secondary>maximum tried</secondary>
42427 This option limits the number of IP addresses that are tried for any one
42428 delivery in cases where there are temporary delivery errors. Section
42429 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
42432 <indexterm role="option">
42433 <primary><option>hosts_max_try_hardlimit</option></primary>
42436 <informaltable frame="all">
42437 <tgroup cols="4" colsep="0" rowsep="0">
42438 <colspec colwidth="8*" align="left"/>
42439 <colspec colwidth="6*" align="center"/>
42440 <colspec colwidth="6*" align="center"/>
42441 <colspec colwidth="6*" align="right"/>
42444 <entry><option>hosts_max_try_hardlimit</option></entry>
42445 <entry>Use: <emphasis>smtp</emphasis></entry>
42446 <entry>Type: <emphasis>integer</emphasis></entry>
42447 <entry>Default: <emphasis>50</emphasis></entry>
42453 This is an additional check on the maximum number of IP addresses that Exim
42454 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
42458 <indexterm role="option">
42459 <primary><option>hosts_nopass_tls</option></primary>
42462 <informaltable frame="all">
42463 <tgroup cols="4" colsep="0" rowsep="0">
42464 <colspec colwidth="8*" align="left"/>
42465 <colspec colwidth="6*" align="center"/>
42466 <colspec colwidth="6*" align="center"/>
42467 <colspec colwidth="6*" align="right"/>
42470 <entry><option>hosts_nopass_tls</option></entry>
42471 <entry>Use: <emphasis>smtp</emphasis></entry>
42472 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
42473 <entry>Default: <emphasis>unset</emphasis></entry>
42479 <indexterm role="concept">
42480 <primary>TLS</primary>
42481 <secondary>passing connection</secondary>
42483 <indexterm role="concept">
42484 <primary>multiple SMTP deliveries</primary>
42486 <indexterm role="concept">
42487 <primary>TLS</primary>
42488 <secondary>multiple message deliveries</secondary>
42490 For any host that matches this list, a connection on which a TLS session has
42491 been started will not be passed to a new delivery process for sending another
42492 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
42493 explanation of when this might be needed.
42496 <indexterm role="option">
42497 <primary><option>hosts_override</option></primary>
42500 <informaltable frame="all">
42501 <tgroup cols="4" colsep="0" rowsep="0">
42502 <colspec colwidth="8*" align="left"/>
42503 <colspec colwidth="6*" align="center"/>
42504 <colspec colwidth="6*" align="center"/>
42505 <colspec colwidth="6*" align="right"/>
42508 <entry><option>hosts_override</option></entry>
42509 <entry>Use: <emphasis>smtp</emphasis></entry>
42510 <entry>Type: <emphasis>boolean</emphasis></entry>
42511 <entry>Default: <emphasis>false</emphasis></entry>
42517 If this option is set and the <option>hosts</option> option is also set, any hosts that are
42518 attached to the address are ignored, and instead the hosts specified by the
42519 <option>hosts</option> option are always used. This option does not apply to
42520 <option>fallback_hosts</option>.
42523 <indexterm role="option">
42524 <primary><option>hosts_randomize</option></primary>
42527 <informaltable frame="all">
42528 <tgroup cols="4" colsep="0" rowsep="0">
42529 <colspec colwidth="8*" align="left"/>
42530 <colspec colwidth="6*" align="center"/>
42531 <colspec colwidth="6*" align="center"/>
42532 <colspec colwidth="6*" align="right"/>
42535 <entry><option>hosts_randomize</option></entry>
42536 <entry>Use: <emphasis>smtp</emphasis></entry>
42537 <entry>Type: <emphasis>boolean</emphasis></entry>
42538 <entry>Default: <emphasis>false</emphasis></entry>
42544 <indexterm role="concept">
42545 <primary>randomized host list</primary>
42547 <indexterm role="concept">
42548 <primary>host</primary>
42549 <secondary>list of; randomized</secondary>
42551 <indexterm role="concept">
42552 <primary>fallback</primary>
42553 <secondary>randomized hosts</secondary>
42555 If this option is set, and either the list of hosts is taken from the
42556 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
42557 were not obtained from MX records (this includes fallback hosts from the
42558 router), and were not randomized by the router, the order of trying the hosts
42559 is randomized each time the transport runs. Randomizing the order of a host
42560 list can be used to do crude load sharing.
42563 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
42564 order is separately randomized. This makes it possible to set up MX-like
42565 behaviour. The boundaries between groups are indicated by an item that is just
42566 <literal>+</literal> in the host list. For example:
42568 <literallayout class="monospaced">
42569 hosts = host1:host2:host3:+:host4:host5
42572 The order of the first three hosts and the order of the last two hosts is
42573 randomized for each use, but the first three always end up before the last two.
42574 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
42577 <indexterm role="option">
42578 <primary><option>hosts_require_auth</option></primary>
42581 <informaltable frame="all">
42582 <tgroup cols="4" colsep="0" rowsep="0">
42583 <colspec colwidth="8*" align="left"/>
42584 <colspec colwidth="6*" align="center"/>
42585 <colspec colwidth="6*" align="center"/>
42586 <colspec colwidth="6*" align="right"/>
42589 <entry><option>hosts_require_auth</option></entry>
42590 <entry>Use: <emphasis>smtp</emphasis></entry>
42591 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
42592 <entry>Default: <emphasis>unset</emphasis></entry>
42598 <indexterm role="concept">
42599 <primary>authentication</primary>
42600 <secondary>required by client</secondary>
42602 This option provides a list of servers for which authentication must succeed
42603 before Exim will try to transfer a message. If authentication fails for
42604 servers which are not in this list, Exim tries to send unauthenticated. If
42605 authentication fails for one of these servers, delivery is deferred. This
42606 temporary error is detectable in the retry rules, so it can be turned into a
42607 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
42608 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
42611 <indexterm role="option">
42612 <primary><option>hosts_require_tls</option></primary>
42615 <informaltable frame="all">
42616 <tgroup cols="4" colsep="0" rowsep="0">
42617 <colspec colwidth="8*" align="left"/>
42618 <colspec colwidth="6*" align="center"/>
42619 <colspec colwidth="6*" align="center"/>
42620 <colspec colwidth="6*" align="right"/>
42623 <entry><option>hosts_require_tls</option></entry>
42624 <entry>Use: <emphasis>smtp</emphasis></entry>
42625 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
42626 <entry>Default: <emphasis>unset</emphasis></entry>
42632 <indexterm role="concept">
42633 <primary>TLS</primary>
42634 <secondary>requiring for certain servers</secondary>
42636 Exim will insist on using a TLS session when delivering to any host that
42637 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
42638 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
42639 incoming messages, use an appropriate ACL.
42642 <indexterm role="option">
42643 <primary><option>hosts_try_auth</option></primary>
42646 <informaltable frame="all">
42647 <tgroup cols="4" colsep="0" rowsep="0">
42648 <colspec colwidth="8*" align="left"/>
42649 <colspec colwidth="6*" align="center"/>
42650 <colspec colwidth="6*" align="center"/>
42651 <colspec colwidth="6*" align="right"/>
42654 <entry><option>hosts_try_auth</option></entry>
42655 <entry>Use: <emphasis>smtp</emphasis></entry>
42656 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
42657 <entry>Default: <emphasis>unset</emphasis></entry>
42663 <indexterm role="concept">
42664 <primary>authentication</primary>
42665 <secondary>optional in client</secondary>
42667 This option provides a list of servers to which, provided they announce
42668 authentication support, Exim will attempt to authenticate as a client when it
42669 connects. If authentication fails, Exim will try to transfer the message
42670 unauthenticated. See also <option>hosts_require_auth</option>, and chapter
42671 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
42674 <indexterm role="option">
42675 <primary><option>interface</option></primary>
42678 <informaltable frame="all">
42679 <tgroup cols="4" colsep="0" rowsep="0">
42680 <colspec colwidth="8*" align="left"/>
42681 <colspec colwidth="6*" align="center"/>
42682 <colspec colwidth="6*" align="center"/>
42683 <colspec colwidth="6*" align="right"/>
42686 <entry><option>interface</option></entry>
42687 <entry>Use: <emphasis>smtp</emphasis></entry>
42688 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
42689 <entry>Default: <emphasis>unset</emphasis></entry>
42695 <indexterm role="concept">
42696 <primary>bind IP address</primary>
42698 <indexterm role="concept">
42699 <primary>IP address</primary>
42700 <secondary>binding</secondary>
42702 <indexterm role="variable">
42703 <primary><varname>$host</varname></primary>
42705 <indexterm role="variable">
42706 <primary><varname>$host_address</varname></primary>
42708 This option specifies which interface to bind to when making an outgoing SMTP
42709 call. The value is an IP address, not an interface name such as
42710 <literal>eth0</literal>. Do not confuse this with the interface address that was used when a
42711 message was received, which is in <varname>$received_ip_address</varname>, formerly known as
42712 <varname>$interface_address</varname>. The name was changed to minimize confusion with the
42713 outgoing interface address. There is no variable that contains an outgoing
42714 interface address because, unless it is set by this option, its value is
42718 During the expansion of the <option>interface</option> option the variables <varname>$host</varname> and
42719 <varname>$host_address</varname> refer to the host to which a connection is about to be made
42720 during the expansion of the string. Forced expansion failure, or an empty
42721 string result causes the option to be ignored. Otherwise, after expansion, the
42722 string must be a list of IP addresses, colon-separated by default, but the
42723 separator can be changed in the usual way. For example:
42725 <literallayout class="monospaced">
42726 interface = <; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
42729 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
42730 connection. If none of them are the correct type, the option is ignored. If
42731 <option>interface</option> is not set, or is ignored, the system’s IP functions choose which
42732 interface to use if the host has more than one.
42735 <indexterm role="option">
42736 <primary><option>keepalive</option></primary>
42739 <informaltable frame="all">
42740 <tgroup cols="4" colsep="0" rowsep="0">
42741 <colspec colwidth="8*" align="left"/>
42742 <colspec colwidth="6*" align="center"/>
42743 <colspec colwidth="6*" align="center"/>
42744 <colspec colwidth="6*" align="right"/>
42747 <entry><option>keepalive</option></entry>
42748 <entry>Use: <emphasis>smtp</emphasis></entry>
42749 <entry>Type: <emphasis>boolean</emphasis></entry>
42750 <entry>Default: <emphasis>true</emphasis></entry>
42756 <indexterm role="concept">
42757 <primary>keepalive</primary>
42758 <secondary>on outgoing connection</secondary>
42760 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
42761 connections. When set, it causes the kernel to probe idle connections
42762 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
42763 of the connection should send a acknowledgment if the connection is still okay
42764 or a reset if the connection has been aborted. The reason for doing this is
42765 that it has the beneficial effect of freeing up certain types of connection
42766 that can get stuck when the remote host is disconnected without tidying up the
42767 TCP/IP call properly. The keepalive mechanism takes several hours to detect
42771 <indexterm role="option">
42772 <primary><option>lmtp_ignore_quota</option></primary>
42775 <informaltable frame="all">
42776 <tgroup cols="4" colsep="0" rowsep="0">
42777 <colspec colwidth="8*" align="left"/>
42778 <colspec colwidth="6*" align="center"/>
42779 <colspec colwidth="6*" align="center"/>
42780 <colspec colwidth="6*" align="right"/>
42783 <entry><option>lmtp_ignore_quota</option></entry>
42784 <entry>Use: <emphasis>smtp</emphasis></entry>
42785 <entry>Type: <emphasis>boolean</emphasis></entry>
42786 <entry>Default: <emphasis>false</emphasis></entry>
42792 <indexterm role="concept">
42793 <primary>LMTP</primary>
42794 <secondary>ignoring quota errors</secondary>
42796 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
42797 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
42798 has advertised support for IGNOREQUOTA in its response to the LHLO command.
42801 <indexterm role="option">
42802 <primary><option>max_rcpt</option></primary>
42805 <informaltable frame="all">
42806 <tgroup cols="4" colsep="0" rowsep="0">
42807 <colspec colwidth="8*" align="left"/>
42808 <colspec colwidth="6*" align="center"/>
42809 <colspec colwidth="6*" align="center"/>
42810 <colspec colwidth="6*" align="right"/>
42813 <entry><option>max_rcpt</option></entry>
42814 <entry>Use: <emphasis>smtp</emphasis></entry>
42815 <entry>Type: <emphasis>integer</emphasis></entry>
42816 <entry>Default: <emphasis>100</emphasis></entry>
42822 <indexterm role="concept">
42823 <primary>RCPT</primary>
42824 <secondary>maximum number of outgoing</secondary>
42826 This option limits the number of RCPT commands that are sent in a single
42827 SMTP message transaction. Each set of addresses is treated independently, and
42828 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
42832 <indexterm role="option">
42833 <primary><option>multi_domain</option></primary>
42836 <informaltable frame="all">
42837 <tgroup cols="4" colsep="0" rowsep="0">
42838 <colspec colwidth="8*" align="left"/>
42839 <colspec colwidth="6*" align="center"/>
42840 <colspec colwidth="6*" align="center"/>
42841 <colspec colwidth="6*" align="right"/>
42844 <entry><option>multi_domain</option></entry>
42845 <entry>Use: <emphasis>smtp</emphasis></entry>
42846 <entry>Type: <emphasis>boolean</emphasis></entry>
42847 <entry>Default: <emphasis>true</emphasis></entry>
42853 <indexterm role="variable">
42854 <primary><varname>$domain</varname></primary>
42856 When this option is set, the <command>smtp</command> transport can handle a number of
42857 addresses containing a mixture of different domains provided they all resolve
42858 to the same list of hosts. Turning the option off restricts the transport to
42859 handling only one domain at a time. This is useful if you want to use
42860 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
42861 is a single domain involved in a remote delivery.
42864 <indexterm role="option">
42865 <primary><option>port</option></primary>
42868 <informaltable frame="all">
42869 <tgroup cols="4" colsep="0" rowsep="0">
42870 <colspec colwidth="8*" align="left"/>
42871 <colspec colwidth="6*" align="center"/>
42872 <colspec colwidth="6*" align="center"/>
42873 <colspec colwidth="6*" align="right"/>
42876 <entry><option>port</option></entry>
42877 <entry>Use: <emphasis>smtp</emphasis></entry>
42878 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
42879 <entry>Default: <emphasis>see below</emphasis></entry>
42885 <indexterm role="concept">
42886 <primary>port</primary>
42887 <secondary>sending TCP/IP</secondary>
42889 <indexterm role="concept">
42890 <primary>TCP/IP</primary>
42891 <secondary>setting outgoing port</secondary>
42893 This option specifies the TCP/IP port on the server to which Exim connects.
42894 <emphasis role="bold">Note:</emphasis> Do not confuse this with the port that was used when a message was
42895 received, which is in <varname>$received_port</varname>, formerly known as <varname>$interface_port</varname>.
42896 The name was changed to minimize confusion with the outgoing port. There is no
42897 variable that contains an outgoing port.
42900 If the value of this option begins with a digit it is taken as a port number;
42901 otherwise it is looked up using <function>getservbyname()</function>. The default value is
42902 normally <quote>smtp</quote>, but if <option>protocol</option> is set to <quote>lmtp</quote>, the default is
42903 <quote>lmtp</quote>. If the expansion fails, or if a port number cannot be found, delivery
42907 <indexterm role="option">
42908 <primary><option>protocol</option></primary>
42911 <informaltable frame="all">
42912 <tgroup cols="4" colsep="0" rowsep="0">
42913 <colspec colwidth="8*" align="left"/>
42914 <colspec colwidth="6*" align="center"/>
42915 <colspec colwidth="6*" align="center"/>
42916 <colspec colwidth="6*" align="right"/>
42919 <entry><option>protocol</option></entry>
42920 <entry>Use: <emphasis>smtp</emphasis></entry>
42921 <entry>Type: <emphasis>string</emphasis></entry>
42922 <entry>Default: <emphasis>smtp</emphasis></entry>
42928 <indexterm role="concept">
42929 <primary>LMTP</primary>
42930 <secondary>over TCP/IP</secondary>
42932 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
42933 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
42934 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
42935 deliveries into closed message stores. Exim also has support for running LMTP
42936 over a pipe to a local process – see chapter <xref linkend="CHAPLMTP"/>.
42939 <indexterm role="option">
42940 <primary><option>retry_include_ip_address</option></primary>
42943 <informaltable frame="all">
42944 <tgroup cols="4" colsep="0" rowsep="0">
42945 <colspec colwidth="8*" align="left"/>
42946 <colspec colwidth="6*" align="center"/>
42947 <colspec colwidth="6*" align="center"/>
42948 <colspec colwidth="6*" align="right"/>
42951 <entry><option>retry_include_ip_address</option></entry>
42952 <entry>Use: <emphasis>smtp</emphasis></entry>
42953 <entry>Type: <emphasis>boolean</emphasis></entry>
42954 <entry>Default: <emphasis>true</emphasis></entry>
42960 Exim normally includes both the host name and the IP address in the key it
42961 constructs for indexing retry data after a temporary delivery failure. This
42962 means that when one of several IP addresses for a host is failing, it gets
42963 tried periodically (controlled by the retry rules), but use of the other IP
42964 addresses is not affected.
42967 However, in some dialup environments hosts are assigned a different IP address
42968 each time they connect. In this situation the use of the IP address as part of
42969 the retry key leads to undesirable behaviour. Setting this option false causes
42970 Exim to use only the host name. This should normally be done on a separate
42971 instance of the <command>smtp</command> transport, set up specially to handle the dialup
42975 <indexterm role="option">
42976 <primary><option>serialize_hosts</option></primary>
42979 <informaltable frame="all">
42980 <tgroup cols="4" colsep="0" rowsep="0">
42981 <colspec colwidth="8*" align="left"/>
42982 <colspec colwidth="6*" align="center"/>
42983 <colspec colwidth="6*" align="center"/>
42984 <colspec colwidth="6*" align="right"/>
42987 <entry><option>serialize_hosts</option></entry>
42988 <entry>Use: <emphasis>smtp</emphasis></entry>
42989 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
42990 <entry>Default: <emphasis>unset</emphasis></entry>
42996 <indexterm role="concept">
42997 <primary>serializing connections</primary>
42999 <indexterm role="concept">
43000 <primary>host</primary>
43001 <secondary>serializing connections</secondary>
43003 Because Exim operates in a distributed manner, if several messages for the same
43004 host arrive at around the same time, more than one simultaneous connection to
43005 the remote host can occur. This is not usually a problem except when there is a
43006 slow link between the hosts. In that situation it may be helpful to restrict
43007 Exim to one connection at a time. This can be done by setting
43008 <option>serialize_hosts</option> to match the relevant hosts.
43011 <indexterm role="concept">
43012 <primary>hints database</primary>
43013 <secondary>serializing deliveries to a host</secondary>
43015 Exim implements serialization by means of a hints database in which a record is
43016 written whenever a process connects to one of the restricted hosts. The record
43017 is deleted when the connection is completed. Obviously there is scope for
43018 records to get left lying around if there is a system or program crash. To
43019 guard against this, Exim ignores any records that are more than six hours old.
43022 If you set up this kind of serialization, you should also arrange to delete the
43023 relevant hints database whenever your system reboots. The names of the files
43024 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
43025 may be one or two files, depending on the type of DBM in use. The same files
43026 are used for ETRN serialization.
43029 <indexterm role="option">
43030 <primary><option>size_addition</option></primary>
43033 <informaltable frame="all">
43034 <tgroup cols="4" colsep="0" rowsep="0">
43035 <colspec colwidth="8*" align="left"/>
43036 <colspec colwidth="6*" align="center"/>
43037 <colspec colwidth="6*" align="center"/>
43038 <colspec colwidth="6*" align="right"/>
43041 <entry><option>size_addition</option></entry>
43042 <entry>Use: <emphasis>smtp</emphasis></entry>
43043 <entry>Type: <emphasis>integer</emphasis></entry>
43044 <entry>Default: <emphasis>1024</emphasis></entry>
43050 <indexterm role="concept">
43051 <primary>SMTP</primary>
43052 <secondary>SIZE</secondary>
43054 <indexterm role="concept">
43055 <primary>message</primary>
43056 <secondary>size issue for transport filter</secondary>
43058 <indexterm role="concept">
43059 <primary>size</primary>
43060 <secondary>of message</secondary>
43062 <indexterm role="concept">
43063 <primary>transport</primary>
43064 <secondary>filter</secondary>
43066 <indexterm role="concept">
43067 <primary>filter</primary>
43068 <secondary>transport filter</secondary>
43070 If a remote SMTP server indicates that it supports the SIZE option of the
43071 MAIL command, Exim uses this to pass over the message size at the start of
43072 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
43073 sends, to allow for headers and other text that may be added during delivery by
43074 configuration options or in a transport filter. It may be necessary to increase
43075 this if a lot of text is added to messages.
43078 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
43079 the use of the SIZE option altogether.
43082 <indexterm role="option">
43083 <primary><option>tls_certificate</option></primary>
43086 <informaltable frame="all">
43087 <tgroup cols="4" colsep="0" rowsep="0">
43088 <colspec colwidth="8*" align="left"/>
43089 <colspec colwidth="6*" align="center"/>
43090 <colspec colwidth="6*" align="center"/>
43091 <colspec colwidth="6*" align="right"/>
43094 <entry><option>tls_certificate</option></entry>
43095 <entry>Use: <emphasis>smtp</emphasis></entry>
43096 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
43097 <entry>Default: <emphasis>unset</emphasis></entry>
43103 <indexterm role="concept">
43104 <primary>TLS</primary>
43105 <secondary>client certificate, location of</secondary>
43107 <indexterm role="concept">
43108 <primary>certificate</primary>
43109 <secondary>client, location of</secondary>
43111 <indexterm role="variable">
43112 <primary><varname>$host</varname></primary>
43114 <indexterm role="variable">
43115 <primary><varname>$host_address</varname></primary>
43117 The value of this option must be the absolute path to a file which contains the
43118 client’s certificate, for possible use when sending a message over an encrypted
43119 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
43120 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
43124 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
43125 certificate when sending messages as a client. The global option of the same
43126 name specifies the certificate for Exim as a server; it is not automatically
43127 assumed that the same certificate should be used when Exim is operating as a
43131 <indexterm role="option">
43132 <primary><option>tls_crl</option></primary>
43135 <informaltable frame="all">
43136 <tgroup cols="4" colsep="0" rowsep="0">
43137 <colspec colwidth="8*" align="left"/>
43138 <colspec colwidth="6*" align="center"/>
43139 <colspec colwidth="6*" align="center"/>
43140 <colspec colwidth="6*" align="right"/>
43143 <entry><option>tls_crl</option></entry>
43144 <entry>Use: <emphasis>smtp</emphasis></entry>
43145 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
43146 <entry>Default: <emphasis>unset</emphasis></entry>
43152 <indexterm role="concept">
43153 <primary>TLS</primary>
43154 <secondary>client certificate revocation list</secondary>
43156 <indexterm role="concept">
43157 <primary>certificate</primary>
43158 <secondary>revocation list for client</secondary>
43160 This option specifies a certificate revocation list. The expanded value must
43161 be the name of a file that contains a CRL in PEM format.
43164 <indexterm role="option">
43165 <primary><option>tls_privatekey</option></primary>
43168 <informaltable frame="all">
43169 <tgroup cols="4" colsep="0" rowsep="0">
43170 <colspec colwidth="8*" align="left"/>
43171 <colspec colwidth="6*" align="center"/>
43172 <colspec colwidth="6*" align="center"/>
43173 <colspec colwidth="6*" align="right"/>
43176 <entry><option>tls_privatekey</option></entry>
43177 <entry>Use: <emphasis>smtp</emphasis></entry>
43178 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
43179 <entry>Default: <emphasis>unset</emphasis></entry>
43185 <indexterm role="concept">
43186 <primary>TLS</primary>
43187 <secondary>client private key, location of</secondary>
43189 <indexterm role="variable">
43190 <primary><varname>$host</varname></primary>
43192 <indexterm role="variable">
43193 <primary><varname>$host_address</varname></primary>
43195 The value of this option must be the absolute path to a file which contains the
43196 client’s private key. This is used when sending a message over an encrypted
43197 connection using a client certificate. The values of <varname>$host</varname> and
43198 <varname>$host_address</varname> are set to the name and address of the server during the
43199 expansion. If this option is unset, or the expansion is forced to fail, or the
43200 result is an empty string, the private key is assumed to be in the same file as
43201 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
43204 <indexterm role="option">
43205 <primary><option>tls_require_ciphers</option></primary>
43208 <informaltable frame="all">
43209 <tgroup cols="4" colsep="0" rowsep="0">
43210 <colspec colwidth="8*" align="left"/>
43211 <colspec colwidth="6*" align="center"/>
43212 <colspec colwidth="6*" align="center"/>
43213 <colspec colwidth="6*" align="right"/>
43216 <entry><option>tls_require_ciphers</option></entry>
43217 <entry>Use: <emphasis>smtp</emphasis></entry>
43218 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
43219 <entry>Default: <emphasis>unset</emphasis></entry>
43225 <indexterm role="concept">
43226 <primary>TLS</primary>
43227 <secondary>requiring specific ciphers</secondary>
43229 <indexterm role="concept">
43230 <primary>cipher</primary>
43231 <secondary>requiring specific</secondary>
43233 <indexterm role="variable">
43234 <primary><varname>$host</varname></primary>
43236 <indexterm role="variable">
43237 <primary><varname>$host_address</varname></primary>
43239 The value of this option must be a list of permitted cipher suites, for use
43240 when setting up an outgoing encrypted connection. (There is a global option of
43241 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
43242 <varname>$host_address</varname> are set to the name and address of the server during the
43243 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
43244 is used in different ways by OpenSSL and GnuTLS (see sections
43245 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
43246 ciphers is a preference order.
43249 <indexterm role="option">
43250 <primary><option>tls_tempfail_tryclear</option></primary>
43253 <informaltable frame="all">
43254 <tgroup cols="4" colsep="0" rowsep="0">
43255 <colspec colwidth="8*" align="left"/>
43256 <colspec colwidth="6*" align="center"/>
43257 <colspec colwidth="6*" align="center"/>
43258 <colspec colwidth="6*" align="right"/>
43261 <entry><option>tls_tempfail_tryclear</option></entry>
43262 <entry>Use: <emphasis>smtp</emphasis></entry>
43263 <entry>Type: <emphasis>boolean</emphasis></entry>
43264 <entry>Default: <emphasis>true</emphasis></entry>
43270 <indexterm role="concept">
43271 <primary>4<emphasis>xx</emphasis> responses</primary>
43272 <secondary>to STARTTLS</secondary>
43274 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
43275 setting up a TLS session, this option determines whether or not Exim should try
43276 to deliver the message unencrypted. If it is set false, delivery to the
43277 current host is deferred; if there are other hosts, they are tried. If this
43278 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
43279 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
43280 TLS negotiation fails, Exim closes the current connection (because it is in an
43281 unknown state), opens a new one to the same host, and then tries the delivery
43285 <indexterm role="option">
43286 <primary><option>tls_verify_certificates</option></primary>
43289 <informaltable frame="all">
43290 <tgroup cols="4" colsep="0" rowsep="0">
43291 <colspec colwidth="8*" align="left"/>
43292 <colspec colwidth="6*" align="center"/>
43293 <colspec colwidth="6*" align="center"/>
43294 <colspec colwidth="6*" align="right"/>
43297 <entry><option>tls_verify_certificates</option></entry>
43298 <entry>Use: <emphasis>smtp</emphasis></entry>
43299 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
43300 <entry>Default: <emphasis>unset</emphasis></entry>
43306 <indexterm role="concept">
43307 <primary>TLS</primary>
43308 <secondary>server certificate verification</secondary>
43310 <indexterm role="concept">
43311 <primary>certificate</primary>
43312 <secondary>verification of server</secondary>
43314 <indexterm role="variable">
43315 <primary><varname>$host</varname></primary>
43317 <indexterm role="variable">
43318 <primary><varname>$host_address</varname></primary>
43320 The value of this option must be the absolute path to a file containing
43321 permitted server certificates, for use when setting up an encrypted connection.
43322 Alternatively, if you are using OpenSSL, you can set
43323 <option>tls_verify_certificates</option> to the name of a directory containing certificate
43324 files. This does not work with GnuTLS; the option must be set to the name of a
43325 single file if you are using GnuTLS. The values of <varname>$host</varname> and
43326 <varname>$host_address</varname> are set to the name and address of the server during the
43327 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
43330 <section id="SECTvalhosmax">
43331 <title>How the limits for the number of hosts to try are used</title>
43333 <indexterm role="concept">
43334 <primary>host</primary>
43335 <secondary>maximum number to try</secondary>
43337 <indexterm role="concept">
43338 <primary>limit</primary>
43339 <secondary>hosts; maximum number tried</secondary>
43341 There are two options that are concerned with the number of hosts that are
43342 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
43343 <option>hosts_max_try_hardlimit</option>.
43346 The <option>hosts_max_try</option> option limits the number of hosts that are tried
43347 for a single delivery. However, despite the term <quote>host</quote> in its name, the
43348 option actually applies to each IP address independently. In other words, a
43349 multihomed host is treated as several independent hosts, just as it is for
43353 Many of the larger ISPs have multiple MX records which often point to
43354 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
43355 created as a result of routing one of these domains.
43358 Trying every single IP address on such a long list does not seem sensible; if
43359 several at the top of the list fail, it is reasonable to assume there is some
43360 problem that is likely to affect all of them. Roughly speaking, the value of
43361 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
43362 delivery. However, the logic cannot be quite that simple.
43365 Firstly, IP addresses that are skipped because their retry times have not
43366 arrived do not count, and in addition, addresses that are past their retry
43367 limits are also not counted, even when they are tried. This means that when
43368 some IP addresses are past their retry limits, more than the value of
43369 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
43370 that all IP addresses are considered before timing out an email address (but
43371 see below for an exception).
43374 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
43375 list to see if there is a subsequent host with a different (higher valued) MX.
43376 If there is, that host is considered next, and the current IP address is used
43377 but not counted. This behaviour helps in the case of a domain with a retry rule
43378 that hardly ever delays any hosts, as is now explained:
43381 Consider the case of a long list of hosts with one MX value, and a few with a
43382 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
43383 hosts at the top of the list are tried at first. With the default retry rule,
43384 which specifies increasing retry times, the higher MX hosts are eventually
43385 tried when those at the top of the list are skipped because they have not
43386 reached their retry times.
43389 However, it is common practice to put a fixed short retry time on domains for
43390 large ISPs, on the grounds that their servers are rarely down for very long.
43391 Unfortunately, these are exactly the domains that tend to resolve to long lists
43392 of hosts. The short retry time means that the lowest MX hosts are tried every
43393 time. The attempts may be in a different order because of random sorting, but
43394 without the special MX check, the higher MX hosts would never be tried until
43395 all the lower MX hosts had timed out (which might be several days), because
43396 there are always some lower MX hosts that have reached their retry times. With
43397 the special check, Exim considers at least one IP address from each MX value at
43398 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
43402 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
43403 particular, Exim normally eventually tries all the IP addresses before timing
43404 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
43405 reasonable thing to do. Recently, however, some lunatic DNS configurations have
43406 been set up with hundreds of IP addresses for some domains. It can
43407 take a very long time indeed for an address to time out in these cases.
43410 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
43411 Exim never tries more than this number of IP addresses; if it hits this limit
43412 and they are all timed out, the email address is bounced, even though not all
43413 possible IP addresses have been tried.
43414 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
43415 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
43420 <chapter id="CHAPrewrite">
43421 <title>Address rewriting</title>
43423 <indexterm role="concept" id="IIDaddrew" class="startofrange">
43424 <primary>rewriting</primary>
43425 <secondary>addresses</secondary>
43427 There are some circumstances in which Exim automatically rewrites domains in
43428 addresses. The two most common are when an address is given without a domain
43429 (referred to as an <quote>unqualified address</quote>) or when an address contains an
43430 abbreviated domain that is expanded by DNS lookup.
43433 Unqualified envelope addresses are accepted only for locally submitted
43434 messages, or for messages that are received from hosts matching
43435 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
43436 appropriate. Unqualified addresses in header lines are qualified if they are in
43437 locally submitted messages, or messages from hosts that are permitted to send
43438 unqualified envelope addresses. Otherwise, unqualified addresses in header
43439 lines are neither qualified nor rewritten.
43442 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
43443 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
43444 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
43445 do this. The new RFCs do not contain this suggestion.
43447 <section id="SECID147">
43448 <title>Explicitly configured address rewriting</title>
43450 This chapter describes the rewriting rules that can be used in the
43451 main rewrite section of the configuration file, and also in the generic
43452 <option>headers_rewrite</option> option that can be set on any transport.
43455 Some people believe that configured address rewriting is a Mortal Sin.
43456 Others believe that life is not possible without it. Exim provides the
43457 facility; you do not have to use it.
43460 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
43461 configuration file are applied to addresses in incoming messages, both envelope
43462 addresses and addresses in header lines. Each rule specifies the types of
43463 address to which it applies.
43466 Whether or not addresses in header lines are rewritten depends on the origin of
43467 the headers and the type of rewriting. Global rewriting, that is, rewriting
43468 rules from the rewrite section of the configuration file, is applied only to
43469 those headers that were received with the message. Header lines that are added
43470 by ACLs or by a system filter or by individual routers or transports (which
43471 are specific to individual recipient addresses) are not rewritten by the global
43475 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
43476 applies all headers except those added by routers and transports. That is, as
43477 well as the headers that were received with the message, it also applies to
43478 headers that were added by an ACL or a system filter.
43481 In general, rewriting addresses from your own system or domain has some
43482 legitimacy. Rewriting other addresses should be done only with great care and
43483 in special circumstances. The author of Exim believes that rewriting should be
43484 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
43485 Although it can sometimes be used as a routing tool, this is very strongly
43489 There are two commonly encountered circumstances where rewriting is used, as
43490 illustrated by these examples:
43495 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
43496 exchange mail with each other behind a firewall, but there is only a single
43497 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
43498 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
43503 A host rewrites the local parts of its own users so that, for example,
43504 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
43509 <section id="SECID148">
43510 <title>When does rewriting happen?</title>
43512 <indexterm role="concept">
43513 <primary>rewriting</primary>
43514 <secondary>timing of</secondary>
43516 <indexterm role="concept">
43517 <primary>access control lists (ACLs)</primary>
43518 <secondary>rewriting addresses in</secondary>
43520 Configured address rewriting can take place at several different stages of a
43521 message’s processing.
43524 <indexterm role="variable">
43525 <primary><varname>$sender_address</varname></primary>
43527 At the start of an ACL for MAIL, the sender address may have been rewritten
43528 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
43529 ordinary rewrite rules have yet been applied. If, however, the sender address
43530 is verified in the ACL, it is rewritten before verification, and remains
43531 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
43532 rewritten address. This also applies if sender verification happens in a
43533 RCPT ACL. Otherwise, when the sender address is not verified, it is
43534 rewritten as soon as a message’s header lines have been received.
43537 <indexterm role="variable">
43538 <primary><varname>$domain</varname></primary>
43540 <indexterm role="variable">
43541 <primary><varname>$local_part</varname></primary>
43543 Similarly, at the start of an ACL for RCPT, the current recipient’s address
43544 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
43545 rewrite rules have yet been applied to it. However, the behaviour is different
43546 from the sender address when a recipient is verified. The address is rewritten
43547 for the verification, but the rewriting is not remembered at this stage. The
43548 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
43549 as they were before (that is, they contain the unrewritten – except for
43550 SMTP-time rewriting – address).
43553 As soon as a message’s header lines have been received, all the envelope
43554 recipient addresses are permanently rewritten, and rewriting is also applied to
43555 the addresses in the header lines (if configured). This happens before adding
43556 any header lines that were specified in MAIL or RCPT ACLs, and
43557 <indexterm role="concept">
43558 <primary><function>local_scan()</function> function</primary>
43559 <secondary>address rewriting; timing of</secondary>
43561 before the DATA ACL and <function>local_scan()</function> functions are run.
43564 When an address is being routed, either for delivery or for verification,
43565 rewriting is applied immediately to child addresses that are generated by
43566 redirection, unless <option>no_rewrite</option> is set on the router.
43569 <indexterm role="concept">
43570 <primary>envelope sender</primary>
43571 <secondary>rewriting at transport time</secondary>
43573 <indexterm role="concept">
43574 <primary>rewriting</primary>
43575 <secondary>at transport time</secondary>
43577 <indexterm role="concept">
43578 <primary>header lines</primary>
43579 <secondary>rewriting at transport time</secondary>
43581 At transport time, additional rewriting of addresses in header lines can be
43582 specified by setting the generic <option>headers_rewrite</option> option on a transport.
43583 This option contains rules that are identical in form to those in the rewrite
43584 section of the configuration file. They are applied to the original message
43585 header lines and any that were added by ACLs or a system filter. They are not
43586 applied to header lines that are added by routers or the transport.
43589 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
43590 transport option. However, it is not possible to rewrite envelope recipients at
43594 <section id="SECID149">
43595 <title>Testing the rewriting rules that apply on input</title>
43597 <indexterm role="concept">
43598 <primary>rewriting</primary>
43599 <secondary>testing</secondary>
43601 <indexterm role="concept">
43602 <primary>testing</primary>
43603 <secondary>rewriting</secondary>
43605 Exim’s input rewriting configuration appears in a part of the run time
43606 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
43607 <option>-brw</option> command line option. This takes an address (which can be a full RFC
43608 2822 address) as its argument. The output is a list of how the address would be
43609 transformed by the rewriting rules for each of the different places it might
43610 appear in an incoming message, that is, for each different header and for the
43611 envelope sender and recipient fields. For example,
43613 <literallayout class="monospaced">
43614 exim -brw ph10@exim.workshop.example
43617 might produce the output
43619 <literallayout class="monospaced">
43620 sender: Philip.Hazel@exim.workshop.example
43621 from: Philip.Hazel@exim.workshop.example
43622 to: ph10@exim.workshop.example
43623 cc: ph10@exim.workshop.example
43624 bcc: ph10@exim.workshop.example
43625 reply-to: Philip.Hazel@exim.workshop.example
43626 env-from: Philip.Hazel@exim.workshop.example
43627 env-to: ph10@exim.workshop.example
43630 which shows that rewriting has been set up for that address when used in any of
43631 the source fields, but not when it appears as a recipient address. At the
43632 present time, there is no equivalent way of testing rewriting rules that are
43633 set for a particular transport.
43636 <section id="SECID150">
43637 <title>Rewriting rules</title>
43639 <indexterm role="concept">
43640 <primary>rewriting</primary>
43641 <secondary>rules</secondary>
43643 The rewrite section of the configuration file consists of lines of rewriting
43647 <<emphasis>source pattern</emphasis>> <<emphasis>replacement</emphasis>> <<emphasis>flags</emphasis>>
43650 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
43651 transport option are given as a colon-separated list. Each item in the list
43652 takes the same form as a line in the main rewriting configuration (except that
43653 any colons must be doubled, of course).
43656 The formats of source patterns and replacement strings are described below.
43657 Each is terminated by white space, unless enclosed in double quotes, in which
43658 case normal quoting conventions apply inside the quotes. The flags are single
43659 characters which may appear in any order. Spaces and tabs between them are
43663 For each address that could potentially be rewritten, the rules are scanned in
43664 order, and replacements for the address from earlier rules can themselves be
43665 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
43668 The order in which addresses are rewritten is undefined, may change between
43669 releases, and must not be relied on, with one exception: when a message is
43670 received, the envelope sender is always rewritten first, before any header
43671 lines are rewritten. For example, the replacement string for a rewrite of an
43672 address in <emphasis>To:</emphasis> must not assume that the message’s address in <emphasis>From:</emphasis> has
43673 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
43674 that the envelope sender has already been rewritten.
43677 <indexterm role="variable">
43678 <primary><varname>$domain</varname></primary>
43680 <indexterm role="variable">
43681 <primary><varname>$local_part</varname></primary>
43683 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
43684 string to refer to the address that is being rewritten. Note that lookup-driven
43685 rewriting can be done by a rule of the form
43687 <literallayout class="monospaced">
43691 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
43692 refer to the address that is being rewritten.
43695 <section id="SECID151">
43696 <title>Rewriting patterns</title>
43698 <indexterm role="concept">
43699 <primary>rewriting</primary>
43700 <secondary>patterns</secondary>
43702 <indexterm role="concept">
43703 <primary>address list</primary>
43704 <secondary>in a rewriting pattern</secondary>
43706 The source pattern in a rewriting rule is any item which may appear in an
43707 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
43708 single-item address list, which means that it is expanded before being tested
43709 against the address. As always, if you use a regular expression as a pattern,
43710 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
43711 facility to suppress string expansion within the regular expression.
43714 Domains in patterns should be given in lower case. Local parts in patterns are
43715 case-sensitive. If you want to do case-insensitive matching of local parts, you
43716 can use a regular expression that starts with <literal>^(?i)</literal>.
43719 <indexterm role="concept">
43720 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
43721 <secondary>in rewriting rules</secondary>
43723 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
43724 depending on the type of match which occurred. These can be used in the
43725 replacement string to insert portions of the incoming address. <varname>$0</varname> always
43726 refers to the complete incoming address. When a regular expression is used, the
43727 numerical variables are set from its capturing subexpressions. For other types
43728 of pattern they are set as follows:
43733 If a local part or domain starts with an asterisk, the numerical variables
43734 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
43735 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
43738 <literallayout class="monospaced">
43739 *queen@*.fict.example
43742 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
43744 <literallayout class="monospaced">
43745 $0 = hearts-queen@wonderland.fict.example
43750 Note that if the local part does not start with an asterisk, but the domain
43751 does, it is <varname>$1</varname> that contains the wild part of the domain.
43756 If the domain part of the pattern is a partial lookup, the wild and fixed parts
43757 of the domain are placed in the next available numerical variables. Suppose,
43758 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
43759 rewriting rule of the form
43762 <literal>*@partial-dbm;/some/dbm/file</literal> <<emphasis>replacement string</emphasis>>
43765 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
43767 <literallayout class="monospaced">
43773 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
43774 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
43775 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
43776 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
43777 whole domain. For non-partial domain lookups, no numerical variables are set.
43782 <section id="SECID152">
43783 <title>Rewriting replacements</title>
43785 <indexterm role="concept">
43786 <primary>rewriting</primary>
43787 <secondary>replacements</secondary>
43789 If the replacement string for a rule is a single asterisk, addresses that
43790 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
43791 rewriting rules are scanned. For example,
43793 <literallayout class="monospaced">
43794 hatta@lookingglass.fict.example * f
43797 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
43798 <emphasis>From:</emphasis> headers.
43801 <indexterm role="variable">
43802 <primary><varname>$domain</varname></primary>
43804 <indexterm role="variable">
43805 <primary><varname>$local_part</varname></primary>
43807 If the replacement string is not a single asterisk, it is expanded, and must
43808 yield a fully qualified address. Within the expansion, the variables
43809 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
43810 Any letters they contain retain their original case – they are not lower
43811 cased. The numerical variables are set up according to the type of pattern that
43812 matched the address, as described above. If the expansion is forced to fail by
43813 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
43814 current rule is abandoned, but subsequent rules may take effect. Any other
43815 expansion failure causes the entire rewriting operation to be abandoned, and an
43816 entry written to the panic log.
43819 <section id="SECID153">
43820 <title>Rewriting flags</title>
43822 There are three different kinds of flag that may appear on rewriting rules:
43827 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
43833 A flag that specifies rewriting at SMTP time: S.
43838 Flags that control the rewriting process: Q, q, R, w.
43843 For rules that are part of the <option>headers_rewrite</option> generic transport option,
43844 E, F, T, and S are not permitted.
43847 <section id="SECID154">
43848 <title>Flags specifying which headers and envelope addresses to rewrite</title>
43850 <indexterm role="concept">
43851 <primary>rewriting</primary>
43852 <secondary>flags</secondary>
43854 If none of the following flag letters, nor the <quote>S</quote> flag (see section
43855 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
43856 and to both the sender and recipient fields of the envelope, whereas a
43857 transport-time rewriting rule just applies to all headers. Otherwise, the
43858 rewriting rule is skipped unless the relevant addresses are being processed.
43861 <literal>E</literal> rewrite all envelope fields
43862 <literal>F</literal> rewrite the envelope From field
43863 <literal>T</literal> rewrite the envelope To field
43864 <literal>b</literal> rewrite the <emphasis>Bcc:</emphasis> header
43865 <literal>c</literal> rewrite the <emphasis>Cc:</emphasis> header
43866 <literal>f</literal> rewrite the <emphasis>From:</emphasis> header
43867 <literal>h</literal> rewrite all headers
43868 <literal>r</literal> rewrite the <emphasis>Reply-To:</emphasis> header
43869 <literal>s</literal> rewrite the <emphasis>Sender:</emphasis> header
43870 <literal>t</literal> rewrite the <emphasis>To:</emphasis> header
43873 "All headers" means all of the headers listed above that can be selected
43874 individually, plus their <emphasis>Resent-</emphasis> versions. It does not include
43875 other headers such as <emphasis>Subject:</emphasis> etc.
43878 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
43879 restrict this to special known cases in your own domains.
43882 <section id="SECTrewriteS">
43883 <title>The SMTP-time rewriting flag</title>
43885 <indexterm role="concept">
43886 <primary>SMTP</primary>
43887 <secondary>rewriting malformed addresses</secondary>
43889 <indexterm role="concept">
43890 <primary>RCPT</primary>
43891 <secondary>rewriting argument of</secondary>
43893 <indexterm role="concept">
43894 <primary>MAIL</primary>
43895 <secondary>rewriting argument of</secondary>
43897 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
43898 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
43899 before any other processing; even before syntax checking. The pattern is
43900 required to be a regular expression, and it is matched against the whole of the
43901 data for the command, including any surrounding angle brackets.
43904 <indexterm role="variable">
43905 <primary><varname>$domain</varname></primary>
43907 <indexterm role="variable">
43908 <primary><varname>$local_part</varname></primary>
43910 This form of rewrite rule allows for the handling of addresses that are not
43911 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
43912 input). Because the input is not required to be a syntactically valid address,
43913 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
43914 expansion of the replacement string. The result of rewriting replaces the
43915 original address in the MAIL or RCPT command.
43918 <section id="SECID155">
43919 <title>Flags controlling the rewriting process</title>
43921 There are four flags which control the way the rewriting process works. These
43922 take effect only when a rule is invoked, that is, when the address is of the
43923 correct type (matches the flags) and matches the pattern:
43928 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
43929 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
43930 absence of <quote>Q</quote> the rewritten address must always include a domain.
43935 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
43936 even if no rewriting actually takes place because of a <quote>fail</quote> in the
43937 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
43938 (does not match the flags) or does not match the pattern.
43943 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
43944 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
43945 rewriting once it fails to match (after at least one successful rewrite).
43950 <indexterm role="concept">
43951 <primary>rewriting</primary>
43952 <secondary>whole addresses</secondary>
43954 When an address in a header is rewritten, the rewriting normally applies only
43955 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
43956 left unchanged. For example, rewriting might change
43958 <literallayout class="monospaced">
43959 From: Ford Prefect <fp42@restaurant.hitch.fict.example>
43964 <literallayout class="monospaced">
43965 From: Ford Prefect <prefectf@hitch.fict.example>
43968 <indexterm role="concept">
43969 <primary>RFC 2047</primary>
43971 Sometimes there is a need to replace the whole address item, and this can be
43972 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
43973 causes an address in a header line to be rewritten, the entire address is
43974 replaced, not just the working part. The replacement must be a complete RFC
43975 2822 address, including the angle brackets if necessary. If text outside angle
43976 brackets contains a character whose value is greater than 126 or less than 32
43977 (except for tab), the text is encoded according to RFC 2047. The character set
43978 is taken from <option>headers_charset</option>, which defaults to ISO-8859-1.
43981 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
43982 rewritten, all but the working part of the replacement address is discarded.
43987 <section id="SECID156">
43988 <title>Rewriting examples</title>
43990 Here is an example of the two common rewriting paradigms:
43992 <literallayout class="monospaced">
43993 *@*.hitch.fict.example $1@hitch.fict.example
43994 *@hitch.fict.example ${lookup{$1}dbm{/etc/realnames}\
43995 {$value}fail}@hitch.fict.example bctfrF
43998 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
43999 the string expansion to fail if the lookup does not succeed. In this context it
44000 has the effect of leaving the original address unchanged, but Exim goes on to
44001 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
44002 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
44003 explicitly, which would cause the rewritten address to be the same as before,
44004 at the cost of a small bit of processing. Not supplying either of these is an
44005 error, since the rewritten address would then contain no local part.
44008 The first example above replaces the domain with a superior, more general
44009 domain. This may not be desirable for certain local parts. If the rule
44011 <literallayout class="monospaced">
44012 root@*.hitch.fict.example *
44015 were inserted before the first rule, rewriting would be suppressed for the
44016 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
44019 Rewriting can be made conditional on a number of tests, by making use of
44020 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
44021 messages that originate outside the local host:
44023 <literallayout class="monospaced">
44024 *@*.hitch.fict.example "${if !eq {$sender_host_address}{}\
44025 {$1@hitch.fict.example}fail}"
44028 The replacement string is quoted in this example because it contains white
44032 <indexterm role="concept">
44033 <primary>rewriting</primary>
44034 <secondary>bang paths</secondary>
44036 <indexterm role="concept">
44037 <primary>bang paths</primary>
44038 <secondary>rewriting</secondary>
44040 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
44041 an address it treats it as an unqualified local part which it qualifies with
44042 the local qualification domain (if the source of the message is local or if the
44043 remote host is permitted to send unqualified addresses). Rewriting can
44044 sometimes be used to handle simple bang paths with a fixed number of
44045 components. For example, the rule
44047 <literallayout class="monospaced">
44048 \N^([^!]+)!(.*)@your.domain.example$\N $2@$1
44051 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
44052 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
44053 a global rewriting rule for envelope addresses. It can provide a backdoor
44054 method for using your system as a relay, because the incoming addresses appear
44055 to be local. If the bang path addresses are received via SMTP, it is safer to
44056 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
44057 can be done on the rewritten addresses.
44058 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
44063 <chapter id="CHAPretry">
44064 <title>Retry configuration</title>
44066 <indexterm role="concept" id="IIDretconf1" class="startofrange">
44067 <primary>retry</primary>
44068 <secondary>configuration, description of</secondary>
44070 <indexterm role="concept" id="IIDregconf2" class="startofrange">
44071 <primary>configuration file</primary>
44072 <secondary>retry section</secondary>
44074 The <quote>retry</quote> section of the runtime configuration file contains a list of
44075 retry rules that control how often Exim tries to deliver messages that cannot
44076 be delivered at the first attempt. If there are no retry rules (the section is
44077 empty or not present), there are no retries. In this situation, temporary
44078 errors are treated as permanent. The default configuration contains a single,
44079 general-purpose retry rule (see section <xref linkend="SECID57"/>). The <option>-brt</option> command
44080 line option can be used to test which retry rule will be used for a given
44081 address, domain and error.
44084 The most common cause of retries is temporary failure to deliver to a remote
44085 host because the host is down, or inaccessible because of a network problem.
44086 Exim’s retry processing in this case is applied on a per-host (strictly, per IP
44087 address) basis, not on a per-message basis. Thus, if one message has recently
44088 been delayed, delivery of a new message to the same host is not immediately
44089 tried, but waits for the host’s retry time to arrive. If the <option>retry_defer</option>
44090 log selector is set, the message
44091 <indexterm role="concept">
44092 <primary>retry</primary>
44093 <secondary>time not reached</secondary>
44095 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
44096 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
44097 the handling of errors during remote deliveries.
44100 Retry processing applies to routing as well as to delivering, except as covered
44101 in the next paragraph. The retry rules do not distinguish between these
44102 actions. It is not possible, for example, to specify different behaviour for
44103 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
44104 the host <emphasis>snark.fict.example</emphasis>. I didn’t think anyone would ever need this
44105 added complication, so did not implement it. However, although they share the
44106 same retry rule, the actual retry times for routing and transporting a given
44107 domain are maintained independently.
44110 When a delivery is not part of a queue run (typically an immediate delivery on
44111 receipt of a message), the routers are always run, and local deliveries are
44112 always attempted, even if retry times are set for them. This makes for better
44113 behaviour if one particular message is causing problems (for example, causing
44114 quota overflow, or provoking an error in a filter file). If such a delivery
44115 suffers a temporary failure, the retry data is updated as normal, and
44116 subsequent delivery attempts from queue runs occur only when the retry time for
44117 the local address is reached.
44119 <section id="SECID157">
44120 <title>Changing retry rules</title>
44122 If you change the retry rules in your configuration, you should consider
44123 whether or not to delete the retry data that is stored in Exim’s spool area in
44124 files with names like <filename>db/retry</filename>. Deleting any of Exim’s hints files is
44125 always safe; that is why they are called <quote>hints</quote>.
44128 The hints retry data contains suggested retry times based on the previous
44129 rules. In the case of a long-running problem with a remote host, it might
44130 record the fact that the host has timed out. If your new rules increase the
44131 timeout time for such a host, you should definitely remove the old retry data
44132 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
44133 messages that it should now be retaining.
44136 <section id="SECID158">
44137 <title>Format of retry rules</title>
44139 <indexterm role="concept">
44140 <primary>retry</primary>
44141 <secondary>rules</secondary>
44143 Each retry rule occupies one line and consists of three or four parts,
44144 separated by white space: a pattern, an error name, an optional list of sender
44145 addresses, and a list of retry parameters. The pattern and sender lists must be
44146 enclosed in double quotes if they contain white space. The rules are searched
44147 in order until one is found where the pattern, error name, and sender list (if
44148 present) match the failing host or address, the error that occurred, and the
44149 message’s sender, respectively.
44152 The pattern is any single item that may appear in an address list (see section
44153 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
44154 which means that it is expanded before being tested against the address that
44155 has been delayed. A negated address list item is permitted. Address
44156 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
44157 which makes it possible for many retry rules to start with just a domain. For
44160 <literallayout class="monospaced">
44161 lookingglass.fict.example * F,24h,30m;
44164 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
44167 <literallayout class="monospaced">
44168 alice@lookingglass.fict.example * F,24h,30m;
44171 applies only to temporary failures involving the local part <option>alice</option>.
44172 In practice, almost all rules start with a domain name pattern without a local
44176 <indexterm role="concept">
44177 <primary>regular expressions</primary>
44178 <secondary>in retry rules</secondary>
44180 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a routing rule pattern, it
44181 must match a complete address, not just a domain, because that is how regular
44182 expressions work in address lists.
44185 <literal>^\Nxyz\d+\.abc\.example$\N * G,1h,10m,2</literal> <option>Wrong</option>
44186 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N * G,1h,10m,2</literal> <option>Right</option>
44189 <section id="SECID159">
44190 <title>Choosing which retry rule to use for address errors</title>
44192 When Exim is looking for a retry rule after a routing attempt has failed (for
44193 example, after a DNS timeout), each line in the retry configuration is tested
44194 against the complete address only if <option>retry_use_local_part</option> is set for the
44195 router. Otherwise, only the domain is used, except when matching against a
44196 regular expression, when the local part of the address is replaced with <quote>*</quote>.
44197 A domain on its own can match a domain pattern, or a pattern that starts with
44198 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
44199 <option>check_local_user</option> is true, and false for other routers.
44202 Similarly, when Exim is looking for a retry rule after a local delivery has
44203 failed (for example, after a mailbox full error), each line in the retry
44204 configuration is tested against the complete address only if
44205 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
44209 <indexterm role="concept">
44210 <primary>4<emphasis>xx</emphasis> responses</primary>
44211 <secondary>retry rules for</secondary>
44213 However, when Exim is looking for a retry rule after a remote delivery attempt
44214 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
44215 whole address is always used as the key when searching the retry rules. The
44216 rule that is found is used to create a retry time for the combination of the
44217 failing address and the message’s sender. It is the combination of sender and
44218 recipient that is delayed in subsequent queue runs until its retry time is
44219 reached. You can delay the recipient without regard to the sender by setting
44220 <option>address_retry_include_sender</option> false in the <command>smtp</command> transport but this can
44221 lead to problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT
44225 <section id="SECID160">
44226 <title>Choosing which retry rule to use for host and message errors</title>
44228 For a temporary error that is not related to an individual address (for
44229 example, a connection timeout), each line in the retry configuration is checked
44230 twice. First, the name of the remote host is used as a domain name (preceded by
44231 <quote>*@</quote> when matching a regular expression). If this does not match the line,
44232 the domain from the email address is tried in a similar fashion. For example,
44233 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
44235 <literallayout class="monospaced">
44236 a.b.c.example MX 5 x.y.z.example
44241 and the retry rules are
44243 <literallayout class="monospaced">
44244 p.q.r.example * F,24h,30m;
44245 a.b.c.example * F,4d,45m;
44248 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
44249 first rule matches neither the host nor the domain, so Exim looks at the second
44250 rule. This does not match the host, but it does match the domain, so it is used
44251 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
44252 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
44253 first retry rule is used, because it matches the host.
44256 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
44257 first rule to determine retry times, but for all the other hosts for the domain
44258 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
44259 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
44262 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
44263 However, if a message is routed directly to an IP address without the use of a
44264 host name, for example, if a <command>manualroute</command> router contains a setting such as:
44266 <literallayout class="monospaced">
44267 route_list = *.a.example 192.168.34.23
44270 then the <quote>host name</quote> that is used when searching for a retry rule is the
44271 textual form of the IP address.
44274 <section id="SECID161">
44275 <title>Retry rules for specific errors</title>
44277 <indexterm role="concept">
44278 <primary>retry</primary>
44279 <secondary>specific errors; specifying</secondary>
44281 The second field in a retry rule is the name of a particular error, or an
44282 asterisk, which matches any error. The errors that can be tested for are:
44286 <term><option>auth_failed</option></term>
44289 Authentication failed when trying to send to a host in the
44290 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
44292 </listitem></varlistentry>
44294 <term><option>data_4xx</option></term>
44297 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
44298 after the command, or after sending the message’s data.
44300 </listitem></varlistentry>
44302 <term><option>mail_4xx</option></term>
44305 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
44307 </listitem></varlistentry>
44309 <term><option>rcpt_4xx</option></term>
44312 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
44314 </listitem></varlistentry>
44317 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x’s can be given
44318 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
44319 recognize 452 errors given to RCPT commands for addresses in a certain domain,
44320 and have retries every ten minutes with a one-hour timeout, you could set up a
44321 retry rule of this form:
44323 <literallayout class="monospaced">
44324 the.domain.name rcpt_452 F,1h,10m
44327 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
44328 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
44332 <term><option>lost_connection</option></term>
44335 A server unexpectedly closed the SMTP connection. There may, of course,
44336 legitimate reasons for this (host died, network died), but if it repeats a lot
44337 for the same host, it indicates something odd.
44339 </listitem></varlistentry>
44341 <term><option>refused_MX</option></term>
44344 A connection to a host obtained from an MX record was refused.
44346 </listitem></varlistentry>
44348 <term><option>refused_A</option></term>
44351 A connection to a host not obtained from an MX record was refused.
44353 </listitem></varlistentry>
44355 <term><option>refused</option></term>
44358 A connection was refused.
44360 </listitem></varlistentry>
44362 <term><option>timeout_connect_MX</option></term>
44365 A connection attempt to a host obtained from an MX record timed out.
44367 </listitem></varlistentry>
44369 <term><option>timeout_connect_A</option></term>
44372 A connection attempt to a host not obtained from an MX record timed out.
44374 </listitem></varlistentry>
44376 <term><option>timeout_connect</option></term>
44379 A connection attempt timed out.
44381 </listitem></varlistentry>
44383 <term><option>timeout_MX</option></term>
44386 There was a timeout while connecting or during an SMTP session with a host
44387 obtained from an MX record.
44389 </listitem></varlistentry>
44391 <term><option>timeout_A</option></term>
44394 There was a timeout while connecting or during an SMTP session with a host not
44395 obtained from an MX record.
44397 </listitem></varlistentry>
44399 <term><option>timeout</option></term>
44402 There was a timeout while connecting or during an SMTP session.
44404 </listitem></varlistentry>
44406 <term><option>tls_required</option></term>
44409 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
44410 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
44411 to STARTTLS, or there was a problem setting up the TLS connection.
44413 </listitem></varlistentry>
44415 <term><option>quota</option></term>
44418 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
44421 </listitem></varlistentry>
44423 <term><option>quota_</option><<emphasis>time</emphasis>></term>
44426 <indexterm role="concept">
44427 <primary>quota</primary>
44428 <secondary>error testing in retry rule</secondary>
44430 <indexterm role="concept">
44431 <primary>retry</primary>
44432 <secondary>quota error testing</secondary>
44434 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
44435 transport, and the mailbox has not been accessed for <<emphasis>time</emphasis>>. For example,
44436 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
44439 </listitem></varlistentry>
44442 <indexterm role="concept">
44443 <primary>mailbox</primary>
44444 <secondary>time of last read</secondary>
44446 The idea of <option>quota_</option><<emphasis>time</emphasis>> is to make it possible to have shorter
44447 timeouts when the mailbox is full and is not being read by its owner. Ideally,
44448 it should be based on the last time that the user accessed the mailbox.
44449 However, it is not always possible to determine this. Exim uses the following
44455 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
44456 used. As no new messages are being delivered (because the mailbox is over
44457 quota), Exim does not access the file, so this is the time of last user access.
44462 <indexterm role="concept">
44463 <primary>maildir format</primary>
44464 <secondary>time of last read</secondary>
44466 For a maildir delivery, the time of last modification of the <filename>new</filename>
44467 subdirectory is used. As the mailbox is over quota, no new files are created in
44468 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
44469 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
44470 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
44471 time that is used is therefore the last time that the user read a new message.
44476 For other kinds of multi-file mailbox, the time of last access cannot be
44477 obtained, so a retry rule that uses this type of error field is never matched.
44482 The quota errors apply both to system-enforced quotas and to Exim’s own quota
44483 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
44484 when a local delivery is deferred because a partition is full (the ENOSPC
44488 <section id="SECID162">
44489 <title>Retry rules for specified senders</title>
44491 <indexterm role="concept">
44492 <primary>retry</primary>
44493 <secondary>rules; sender-specific</secondary>
44495 You can specify retry rules that apply only when the failing message has a
44496 specific sender. In particular, this can be used to define retry rules that
44497 apply only to bounce messages. The third item in a retry rule can be of this
44501 <literal>senders=</literal><<emphasis>address list</emphasis>>
44504 The retry timings themselves are then the fourth item. For example:
44506 <literallayout class="monospaced">
44507 * rcpt_4xx senders=: F,1h,30m
44510 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
44511 host. If the address list contains white space, it must be enclosed in quotes.
44514 <literallayout class="monospaced">
44515 a.domain rcpt_452 senders="xb.dom : yc.dom" G,8h,10m,1.5
44518 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
44519 (which do not depend on the recipient). The reason is that the sender is used
44520 only to match the retry rule. Once the rule has been found for a host error,
44521 its contents are used to set a retry time for the host, and this will apply to
44522 all messages, not just those with specific senders.
44525 When testing retry rules using <option>-brt</option>, you can supply a sender using the
44526 <option>-f</option> command line option, like this:
44528 <literallayout class="monospaced">
44529 exim -f "" -brt user@dom.ain
44532 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
44533 list is never matched.
44536 <section id="SECID163">
44537 <title>Retry parameters</title>
44539 <indexterm role="concept">
44540 <primary>retry</primary>
44541 <secondary>parameters in rules</secondary>
44543 The third (or fourth, if a senders list is present) field in a retry rule is a
44544 sequence of retry parameter sets, separated by semicolons. Each set consists of
44547 <<emphasis>letter</emphasis>>,<<emphasis>cutoff time</emphasis>>,<<emphasis>arguments</emphasis>>
44550 The letter identifies the algorithm for computing a new retry time; the cutoff
44551 time is the time beyond which this algorithm no longer applies, and the
44552 arguments vary the algorithm’s action. The cutoff time is measured from the
44553 time that the first failure for the domain (combined with the local part if
44554 relevant) was detected, not from the time the message was received.
44557 <indexterm role="concept">
44558 <primary>retry</primary>
44559 <secondary>algorithms</secondary>
44561 <indexterm role="concept">
44562 <primary>retry</primary>
44563 <secondary>fixed intervals</secondary>
44565 <indexterm role="concept">
44566 <primary>retry</primary>
44567 <secondary>increasing intervals</secondary>
44569 <indexterm role="concept">
44570 <primary>retry</primary>
44571 <secondary>random intervals</secondary>
44573 The available algorithms are:
44578 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
44584 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
44585 specifies a starting value for the interval, and the second a multiplier, which
44586 is used to increase the size of the interval at each retry.
44591 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
44592 retry, the previous interval is multiplied by the factor in order to get a
44593 maximum for the next interval. The minimum interval is the first argument of
44594 the parameter, and an actual interval is chosen randomly between them. Such a
44595 rule has been found to be helpful in cluster configurations when all the
44596 members of the cluster restart at once, and may therefore synchronize their
44597 queue processing times.
44602 When computing the next retry time, the algorithm definitions are scanned in
44603 order until one whose cutoff time has not yet passed is reached. This is then
44604 used to compute a new retry time that is later than the current time. In the
44605 case of fixed interval retries, this simply means adding the interval to the
44606 current time. For geometrically increasing intervals, retry intervals are
44607 computed from the rule’s parameters until one that is greater than the previous
44608 interval is found. The main configuration variable
44609 <indexterm role="concept">
44610 <primary>limit</primary>
44611 <secondary>retry interval</secondary>
44613 <indexterm role="concept">
44614 <primary>retry</primary>
44615 <secondary>interval, maximum</secondary>
44617 <indexterm role="option">
44618 <primary><option>retry_interval_max</option></primary>
44620 <option>retry_interval_max</option> limits the maximum interval between retries. It
44621 cannot be set greater than <literal>24h</literal>, which is its default value.
44624 A single remote domain may have a number of hosts associated with it, and each
44625 host may have more than one IP address. Retry algorithms are selected on the
44626 basis of the domain name, but are applied to each IP address independently. If,
44627 for example, a host has two IP addresses and one is unusable, Exim will
44628 generate retry times for it and will not try to use it until its next retry
44629 time comes. Thus the good IP address is likely to be tried first most of the
44633 <indexterm role="concept">
44634 <primary>hints database</primary>
44635 <secondary>use for retrying</secondary>
44637 Retry times are hints rather than promises. Exim does not make any attempt to
44638 run deliveries exactly at the computed times. Instead, a queue runner process
44639 starts delivery processes for delayed messages periodically, and these attempt
44640 new deliveries only for those addresses that have passed their next retry time.
44641 If a new message arrives for a deferred address, an immediate delivery attempt
44642 occurs only if the address has passed its retry time. In the absence of new
44643 messages, the minimum time between retries is the interval between queue runner
44644 processes. There is not much point in setting retry times of five minutes if
44645 your queue runners happen only once an hour, unless there are a significant
44646 number of incoming messages (which might be the case on a system that is
44647 sending everything to a smart host, for example).
44650 The data in the retry hints database can be inspected by using the
44651 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
44652 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
44653 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
44654 are for the hosts associated with a particular mail domain, and also for local
44655 deliveries that have been deferred.
44658 <section id="SECID164">
44659 <title>Retry rule examples</title>
44661 Here are some example retry rules:
44663 <literallayout class="monospaced">
44664 alice@wonderland.fict.example quota_5d F,7d,3h
44665 wonderland.fict.example quota_5d
44666 wonderland.fict.example * F,1h,15m; G,2d,1h,2;
44667 lookingglass.fict.example * F,24h,30m;
44668 * refused_A F,2h,20m;
44669 * * F,2h,15m; G,16h,1h,1.5; F,5d,8h
44672 The first rule sets up special handling for mail to
44673 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
44674 mailbox has not been read for at least 5 days. Retries continue every three
44675 hours for 7 days. The second rule handles over-quota errors for all other local
44676 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
44677 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
44678 fail are bounced immediately if the mailbox has not been read for at least 5
44682 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
44683 happen every 15 minutes for an hour, then with geometrically increasing
44684 intervals until two days have passed since a delivery first failed. After the
44685 first hour there is a delay of one hour, then two hours, then four hours, and
44686 so on (this is a rather extreme example).
44689 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
44690 They happen every 30 minutes for 24 hours only. The remaining two rules handle
44691 all other domains, with special action for connection refusal from hosts that
44692 were not obtained from an MX record.
44695 The final rule in a retry configuration should always have asterisks in the
44696 first two fields so as to provide a general catch-all for any addresses that do
44697 not have their own special handling. This example tries every 15 minutes for 2
44698 hours, then with intervals starting at one hour and increasing by a factor of
44699 1.5 up to 16 hours, then every 8 hours up to 5 days.
44702 <section id="SECID165">
44703 <title>Timeout of retry data</title>
44705 <indexterm role="concept">
44706 <primary>timeout</primary>
44707 <secondary>of retry data</secondary>
44709 <indexterm role="option">
44710 <primary><option>retry_data_expire</option></primary>
44712 <indexterm role="concept">
44713 <primary>hints database</primary>
44714 <secondary>data expiry</secondary>
44716 <indexterm role="concept">
44717 <primary>retry</primary>
44718 <secondary>timeout of data</secondary>
44720 Exim timestamps the data that it writes to its retry hints database. When it
44721 consults the data during a delivery it ignores any that is older than the value
44722 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn’t
44723 been tried for 7 days, Exim will try to deliver to it immediately a message
44724 arrives, and if that fails, it will calculate a retry time as if it were
44725 failing for the first time.
44728 This improves the behaviour for messages routed to rarely-used hosts such as MX
44729 backups. If such a host was down at one time, and happens to be down again when
44730 Exim tries a month later, using the old retry data would imply that it had been
44731 down all the time, which is not a justified assumption.
44734 If a host really is permanently dead, this behaviour causes a burst of retries
44735 every now and again, but only if messages routed to it are rare. If there is a
44736 message at least once every 7 days the retry data never expires.
44739 <section id="SECID166">
44740 <title>Long-term failures</title>
44742 <indexterm role="concept">
44743 <primary>delivery failure, long-term</primary>
44745 <indexterm role="concept">
44746 <primary>retry</primary>
44747 <secondary>after long-term failure</secondary>
44749 Special processing happens when an email address has been failing for so long
44750 that the cutoff time for the last algorithm is reached. For example, using the
44751 default retry rule:
44753 <literallayout class="monospaced">
44754 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
44757 the cutoff time is four days. Reaching the retry cutoff is independent of how
44758 long any specific message has been failing; it is the length of continuous
44759 failure for the recipient address that counts.
44762 When the cutoff time is reached for a local delivery, or for all the IP
44763 addresses associated with a remote delivery, a subsequent delivery failure
44764 causes Exim to give up on the address, and a bounce message is generated.
44765 In order to cater for new messages that use the failing address, a next retry
44766 time is still computed from the final algorithm, and is used as follows:
44769 For local deliveries, one delivery attempt is always made for any subsequent
44770 messages. If this delivery fails, the address fails immediately. The
44771 post-cutoff retry time is not used.
44774 If the delivery is remote, there are two possibilities, controlled by the
44775 <indexterm role="option">
44776 <primary><option>delay_after_cutoff</option></primary>
44778 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
44779 default. Until the post-cutoff retry time for one of the IP addresses is
44780 reached, the failing email address is bounced immediately, without a delivery
44781 attempt taking place. After that time, one new delivery attempt is made to
44782 those IP addresses that are past their retry times, and if that still fails,
44783 the address is bounced and new retry times are computed.
44786 In other words, when all the hosts for a given email address have been failing
44787 for a long time, Exim bounces rather then defers until one of the hosts’ retry
44788 times is reached. Then it tries once, and bounces if that attempt fails. This
44789 behaviour ensures that few resources are wasted in repeatedly trying to deliver
44790 to a broken destination, but if the host does recover, Exim will eventually
44794 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
44795 addresses are past their final cutoff time, Exim tries to deliver to those IP
44796 addresses that have not been tried since the message arrived. If there are
44797 no suitable IP addresses, or if they all fail, the address is bounced. In other
44798 words, it does not delay when a new message arrives, but tries the expired
44799 addresses immediately, unless they have been tried since the message arrived.
44800 If there is a continuous stream of messages for the failing domains, setting
44801 <option>delay_after_cutoff</option> false means that there will be many more attempts to
44802 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
44806 <section id="SECID167">
44807 <title>Deliveries that work intermittently</title>
44809 <indexterm role="concept">
44810 <primary>retry</primary>
44811 <secondary>intermittently working deliveries</secondary>
44813 Some additional logic is needed to cope with cases where a host is
44814 intermittently available, or when a message has some attribute that prevents
44815 its delivery when others to the same address get through. In this situation,
44816 because some messages are successfully delivered, the <quote>retry clock</quote> for the
44817 host or address keeps getting reset by the successful deliveries, and so
44818 failing messages remain on the queue for ever because the cutoff time is never
44822 Two exceptional actions are applied to prevent this happening. The first
44823 applies to errors that are related to a message rather than a remote host.
44824 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
44825 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
44826 commands, and quota failures. For this type of error, if a message’s arrival
44827 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
44828 is used when scanning the retry rules to decide when to try next and when to
44829 time out the address.
44832 The exceptional second action applies in all cases. If a message has been on
44833 the queue for longer than the cutoff time of any applicable retry rule for a
44834 given address, a delivery is attempted for that address, even if it is not yet
44835 time, and if this delivery fails, the address is timed out. A new retry time is
44836 not computed in this case, so that other messages for the same address are
44837 considered immediately.
44838 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
44839 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
44844 <chapter id="CHAPSMTPAUTH">
44845 <title>SMTP authentication</title>
44847 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
44848 <primary>SMTP</primary>
44849 <secondary>authentication configuration</secondary>
44851 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
44852 <primary>authentication</primary>
44854 The <quote>authenticators</quote> section of Exim’s run time configuration is concerned
44855 with SMTP authentication. This facility is an extension to the SMTP protocol,
44856 described in RFC 2554, which allows a client SMTP host to authenticate itself
44857 to a server. This is a common way for a server to recognize clients that are
44858 permitted to use it as a relay. SMTP authentication is not of relevance to the
44859 transfer of mail between servers that have no managerial connection with each
44863 <indexterm role="concept">
44864 <primary>AUTH</primary>
44865 <secondary>description of</secondary>
44867 Very briefly, the way SMTP authentication works is as follows:
44872 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
44873 the client’s EHLO command.
44878 The client issues an AUTH command, naming a specific mechanism. The command
44879 may, optionally, contain some authentication data.
44884 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
44885 appropriate responses. In simple authentication mechanisms, the challenges are
44886 just prompts for user names and passwords. The server does not have to issue
44887 any challenges – in some mechanisms the relevant data may all be transmitted
44888 with the AUTH command.
44893 The server either accepts or denies authentication.
44898 If authentication succeeds, the client may optionally make use of the AUTH
44899 option on the MAIL command to pass an authenticated sender in subsequent
44900 mail transactions. Authentication lasts for the remainder of the SMTP
44906 If authentication fails, the client may give up, or it may try a different
44907 authentication mechanism, or it may try transferring mail over the
44908 unauthenticated connection.
44913 If you are setting up a client, and want to know which authentication
44914 mechanisms the server supports, you can use Telnet to connect to port 25 (the
44915 SMTP port) on the server, and issue an EHLO command. The response to this
44916 includes the list of supported mechanisms. For example:
44919 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
44920 <literal>Trying 192.168.34.25...</literal>
44921 <literal>Connected to server.example.</literal>
44922 <literal>Escape character is '^]'.</literal>
44923 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
44924 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
44925 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
44926 <literal>250-SIZE 52428800</literal>
44927 <literal>250-PIPELINING</literal>
44928 <literal>250-AUTH PLAIN</literal>
44929 <literal>250 HELP</literal>
44932 The second-last line of this example output shows that the server supports
44933 authentication using the PLAIN mechanism. In Exim, the different authentication
44934 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
44935 routers and transports, which authenticators are included in the binary is
44936 controlled by build-time definitions. The following are currently available,
44937 included by setting
44939 <literallayout class="monospaced">
44941 AUTH_CYRUS_SASL=yes
44946 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
44947 authentication mechanism (RFC 2195), and the second provides an interface to
44948 the Cyrus SASL authentication library. The third can be configured to support
44949 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
44950 not formally documented, but used by several MUAs. The fourth authenticator
44951 supports Microsoft’s <emphasis>Secure Password Authentication</emphasis> mechanism.
44954 The authenticators are configured using the same syntax as other drivers (see
44955 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
44956 authentication section need be present in the configuration file. Each
44957 authenticator can in principle have both server and client functions. When Exim
44958 is receiving SMTP mail, it is acting as a server; when it is sending out
44959 messages over SMTP, it is acting as a client. Authenticator configuration
44960 options are provided for use in both these circumstances.
44963 To make it clear which options apply to which situation, the prefixes
44964 <option>server_</option> and <option>client_</option> are used on option names that are specific to
44965 either the server or the client function, respectively. Server and client
44966 functions are disabled if none of their options are set. If an authenticator is
44967 to be used for both server and client functions, a single definition, using
44968 both sets of options, is required. For example:
44970 <literallayout class="monospaced">
44973 public_name = CRAM-MD5
44974 server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
44976 client_secret = secret2
44979 The <option>server_</option> option is used when Exim is acting as a server, and the
44980 <option>client_</option> options when it is acting as a client.
44983 Descriptions of the individual authenticators are given in subsequent chapters.
44984 The remainder of this chapter covers the generic options for the
44985 authenticators, followed by general discussion of the way authentication works
44988 <section id="SECID168">
44989 <title>Generic options for authenticators</title>
44991 <indexterm role="concept">
44992 <primary>authentication</primary>
44993 <secondary>generic options</secondary>
44995 <indexterm role="concept">
44996 <primary>options</primary>
44997 <secondary>generic; for authenticators</secondary>
45001 <indexterm role="option">
45002 <primary><option>client_condition</option></primary>
45005 <informaltable frame="all">
45006 <tgroup cols="4" colsep="0" rowsep="0">
45007 <colspec colwidth="8*" align="left"/>
45008 <colspec colwidth="6*" align="center"/>
45009 <colspec colwidth="6*" align="center"/>
45010 <colspec colwidth="6*" align="right"/>
45013 <entry><option>client_condition</option></entry>
45014 <entry>Use: <emphasis>authenticators</emphasis></entry>
45015 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
45016 <entry>Default: <emphasis>unset</emphasis></entry>
45022 When Exim is authenticating as a client, it skips any authenticator whose
45023 <option>client_condition</option> expansion yields <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>. This can be
45024 used, for example, to skip plain text authenticators when the connection is not
45025 encrypted by a setting such as:
45027 <literallayout class="monospaced">
45028 client_condition = ${if !eq{$tls_cipher}{}}
45031 (Older documentation incorrectly states that <varname>$tls_cipher</varname> contains the cipher
45032 used for incoming messages. In fact, during SMTP delivery, it contains the
45033 cipher used for the delivery.)
45036 <indexterm role="option">
45037 <primary><option>driver</option></primary>
45040 <informaltable frame="all">
45041 <tgroup cols="4" colsep="0" rowsep="0">
45042 <colspec colwidth="8*" align="left"/>
45043 <colspec colwidth="6*" align="center"/>
45044 <colspec colwidth="6*" align="center"/>
45045 <colspec colwidth="6*" align="right"/>
45048 <entry><option>driver</option></entry>
45049 <entry>Use: <emphasis>authenticators</emphasis></entry>
45050 <entry>Type: <emphasis>string</emphasis></entry>
45051 <entry>Default: <emphasis>unset</emphasis></entry>
45057 This option must always be set. It specifies which of the available
45058 authenticators is to be used.
45061 <indexterm role="option">
45062 <primary><option>public_name</option></primary>
45065 <informaltable frame="all">
45066 <tgroup cols="4" colsep="0" rowsep="0">
45067 <colspec colwidth="8*" align="left"/>
45068 <colspec colwidth="6*" align="center"/>
45069 <colspec colwidth="6*" align="center"/>
45070 <colspec colwidth="6*" align="right"/>
45073 <entry><option>public_name</option></entry>
45074 <entry>Use: <emphasis>authenticators</emphasis></entry>
45075 <entry>Type: <emphasis>string</emphasis></entry>
45076 <entry>Default: <emphasis>unset</emphasis></entry>
45082 This option specifies the name of the authentication mechanism that the driver
45083 implements, and by which it is known to the outside world. These names should
45084 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
45085 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
45086 defaults to the driver’s instance name.
45089 <indexterm role="option">
45090 <primary><option>server_advertise_condition</option></primary>
45093 <informaltable frame="all">
45094 <tgroup cols="4" colsep="0" rowsep="0">
45095 <colspec colwidth="8*" align="left"/>
45096 <colspec colwidth="6*" align="center"/>
45097 <colspec colwidth="6*" align="center"/>
45098 <colspec colwidth="6*" align="right"/>
45101 <entry><option>server_advertise_condition</option></entry>
45102 <entry>Use: <emphasis>authenticators</emphasis></entry>
45103 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
45104 <entry>Default: <emphasis>unset</emphasis></entry>
45110 When a server is about to advertise an authentication mechanism, the condition
45111 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
45112 mechanism is not advertised.
45113 If the expansion fails, the mechanism is not advertised. If the failure was not
45114 forced, and was not caused by a lookup defer, the incident is logged.
45115 See section <xref linkend="SECTauthexiser"/> below for further discussion.
45118 <indexterm role="option">
45119 <primary><option>server_condition</option></primary>
45122 <informaltable frame="all">
45123 <tgroup cols="4" colsep="0" rowsep="0">
45124 <colspec colwidth="8*" align="left"/>
45125 <colspec colwidth="6*" align="center"/>
45126 <colspec colwidth="6*" align="center"/>
45127 <colspec colwidth="6*" align="right"/>
45130 <entry><option>server_condition</option></entry>
45131 <entry>Use: <emphasis>authenticators</emphasis></entry>
45132 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
45133 <entry>Default: <emphasis>unset</emphasis></entry>
45139 This option must be set for a <option>plaintext</option> server authenticator, where it
45140 is used directly to control authentication. See section <xref linkend="SECTplainserver"/>
45144 For the other authenticators, <option>server_condition</option> can be used as an additional
45145 authentication or authorization mechanism that is applied after the other
45146 authenticator conditions succeed. If it is set, it is expanded when the
45147 authenticator would otherwise return a success code. If the expansion is forced
45148 to fail, authentication fails. Any other expansion failure causes a temporary
45149 error code to be returned. If the result of a successful expansion is an empty
45150 string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
45151 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds. For any
45152 other result, a temporary error code is returned, with the expanded string as
45156 <indexterm role="option">
45157 <primary><option>server_debug_print</option></primary>
45160 <informaltable frame="all">
45161 <tgroup cols="4" colsep="0" rowsep="0">
45162 <colspec colwidth="8*" align="left"/>
45163 <colspec colwidth="6*" align="center"/>
45164 <colspec colwidth="6*" align="center"/>
45165 <colspec colwidth="6*" align="right"/>
45168 <entry><option>server_debug_print</option></entry>
45169 <entry>Use: <emphasis>authenticators</emphasis></entry>
45170 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
45171 <entry>Default: <emphasis>unset</emphasis></entry>
45177 If this option is set and authentication debugging is enabled (see the <option>-d</option>
45178 command line option), the string is expanded and included in the debugging
45179 output when the authenticator is run as a server. This can help with checking
45180 out the values of variables.
45181 If expansion of the string fails, the error message is written to the debugging
45182 output, and Exim carries on processing.
45185 <indexterm role="option">
45186 <primary><option>server_set_id</option></primary>
45189 <informaltable frame="all">
45190 <tgroup cols="4" colsep="0" rowsep="0">
45191 <colspec colwidth="8*" align="left"/>
45192 <colspec colwidth="6*" align="center"/>
45193 <colspec colwidth="6*" align="center"/>
45194 <colspec colwidth="6*" align="right"/>
45197 <entry><option>server_set_id</option></entry>
45198 <entry>Use: <emphasis>authenticators</emphasis></entry>
45199 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
45200 <entry>Default: <emphasis>unset</emphasis></entry>
45206 <indexterm role="variable">
45207 <primary><varname>$authenticated_id</varname></primary>
45209 When an Exim server successfully authenticates a client, this string is
45210 expanded using data from the authentication, and preserved for any incoming
45211 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
45212 lines for incoming messages. For example, a user/password authenticator
45213 configuration might preserve the user name that was used to authenticate, and
45214 refer to it subsequently during delivery of the message.
45215 If expansion fails, the option is ignored.
45218 <indexterm role="option">
45219 <primary><option>server_mail_auth_condition</option></primary>
45222 <informaltable frame="all">
45223 <tgroup cols="4" colsep="0" rowsep="0">
45224 <colspec colwidth="8*" align="left"/>
45225 <colspec colwidth="6*" align="center"/>
45226 <colspec colwidth="6*" align="center"/>
45227 <colspec colwidth="6*" align="right"/>
45230 <entry><option>server_mail_auth_condition</option></entry>
45231 <entry>Use: <emphasis>authenticators</emphasis></entry>
45232 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
45233 <entry>Default: <emphasis>unset</emphasis></entry>
45239 This option allows a server to discard authenticated sender addresses supplied
45240 as part of MAIL commands in SMTP connections that are authenticated by the
45241 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
45242 as part of the authentication process; instead its (unexpanded) value is
45243 remembered for later use.
45244 How it is used is described in the following section.
45247 <section id="SECTauthparamail">
45248 <title>The AUTH parameter on MAIL commands</title>
45250 <indexterm role="concept">
45251 <primary>authentication</primary>
45252 <secondary>sender; authenticated</secondary>
45254 <indexterm role="concept">
45255 <primary>AUTH</primary>
45256 <secondary>on MAIL command</secondary>
45258 When a client supplied an AUTH= item on a MAIL command, Exim applies
45259 the following checks before accepting it as the authenticated sender of the
45265 If the connection is not using extended SMTP (that is, HELO was used rather
45266 than EHLO), the use of AUTH= is a syntax error.
45271 If the value of the AUTH= parameter is <quote><></quote>, it is ignored.
45276 <indexterm role="variable">
45277 <primary><varname>$authenticated_sender</varname></primary>
45279 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
45280 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
45281 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
45282 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
45283 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
45284 given for the MAIL command.
45289 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
45290 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
45296 If the AUTH= value was accepted by either of the two previous rules, and
45297 the client has authenticated, and the authenticator has a setting for the
45298 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
45299 valued that was saved from the authenticator is expanded. If the expansion
45300 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
45301 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
45302 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
45308 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
45309 hosts to which Exim authenticates as a client. Do not confuse this value with
45310 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
45311 process, and which is not usually a complete email address.
45314 <indexterm role="variable">
45315 <primary><varname>$sender_address</varname></primary>
45317 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
45318 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
45319 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
45320 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
45324 <section id="SECTauthexiser">
45325 <title>Authentication on an Exim server</title>
45327 <indexterm role="concept">
45328 <primary>authentication</primary>
45329 <secondary>on an Exim server</secondary>
45331 When Exim receives an EHLO command, it advertises the public names of those
45332 authenticators that are configured as servers, subject to the following
45338 The client host must match <option>auth_advertise_hosts</option> (default *).
45343 It the <option>server_advertise_condition</option> option is set, its expansion must not
45344 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
45349 The order in which the authenticators are defined controls the order in which
45350 the mechanisms are advertised.
45353 Some mail clients (for example, some versions of Netscape) require the user to
45354 provide a name and password for authentication whenever AUTH is advertised,
45355 even though authentication may not in fact be needed (for example, Exim may be
45356 set up to allow unconditional relaying from the client by an IP address check).
45357 You can make such clients more friendly by not advertising AUTH to them.
45358 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
45359 that runs for RCPT) to relay without authentication, you should set
45361 <literallayout class="monospaced">
45362 auth_advertise_hosts = ! 10.9.8.0/24
45365 so that no authentication mechanisms are advertised to them.
45368 The <option>server_advertise_condition</option> controls the advertisement of individual
45369 authentication mechanisms. For example, it can be used to restrict the
45370 advertisement of a particular mechanism to encrypted connections, by a setting
45373 <literallayout class="monospaced">
45374 server_advertise_condition = ${if eq{$tls_cipher}{}{no}{yes}}
45377 <indexterm role="variable">
45378 <primary><varname>$tls_cipher</varname></primary>
45380 If the session is encrypted, <varname>$tls_cipher</varname> is not empty, and so the expansion
45381 yields <quote>yes</quote>, which allows the advertisement to happen.
45384 When an Exim server receives an AUTH command from a client, it rejects it
45385 immediately if AUTH was not advertised in response to an earlier EHLO
45386 command. This is the case if
45391 The client host does not match <option>auth_advertise_hosts</option>; or
45396 No authenticators are configured with server options; or
45401 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
45402 server authenticators.
45407 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
45408 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
45409 AUTH is accepted from any client host.
45412 If AUTH is not rejected by the ACL, Exim searches its configuration for a
45413 server authentication mechanism that was advertised in response to EHLO and
45414 that matches the one named in the AUTH command. If it finds one, it runs
45415 the appropriate authentication protocol, and authentication either succeeds or
45416 fails. If there is no matching advertised mechanism, the AUTH command is
45417 rejected with a 504 error.
45420 <indexterm role="variable">
45421 <primary><varname>$received_protocol</varname></primary>
45423 <indexterm role="variable">
45424 <primary><varname>$sender_host_authenticated</varname></primary>
45426 When a message is received from an authenticated host, the value of
45427 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
45428 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
45429 public name) of the authenticator driver that successfully authenticated the
45430 client from which the message was received. This variable is empty if there was
45431 no successful authentication.
45434 <section id="SECID169">
45435 <title>Testing server authentication</title>
45437 <indexterm role="concept">
45438 <primary>authentication</primary>
45439 <secondary>testing a server</secondary>
45441 <indexterm role="concept">
45442 <primary>AUTH</primary>
45443 <secondary>testing a server</secondary>
45445 <indexterm role="concept">
45446 <primary>base64 encoding</primary>
45447 <secondary>creating authentication test data</secondary>
45449 Exim’s <option>-bh</option> option can be useful for testing server authentication
45450 configurations. The data for the AUTH command has to be sent using base64
45451 encoding. A quick way to produce such data for testing is the following Perl
45454 <literallayout class="monospaced">
45456 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
45459 <indexterm role="concept">
45460 <primary>binary zero</primary>
45461 <secondary>in authentication data</secondary>
45463 This interprets its argument as a Perl string, and then encodes it. The
45464 interpretation as a Perl string allows binary zeros, which are required for
45465 some kinds of authentication, to be included in the data. For example, a
45466 command line to run this script on such data might be
45468 <literallayout class="monospaced">
45469 encode '\0user\0password'
45472 Note the use of single quotes to prevent the shell interpreting the
45473 backslashes, so that they can be interpreted by Perl to specify characters
45474 whose code value is zero.
45477 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
45478 digit, you must use three zeros instead of one after the leading backslash. If
45479 you do not, the octal digit that starts your string will be incorrectly
45480 interpreted as part of the code for the first character.
45483 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
45484 specially, you must use a Perl escape to prevent them being misinterpreted. For
45485 example, a command such as
45487 <literallayout class="monospaced">
45488 encode '\0user@domain.com\0pas$$word'
45491 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
45494 If you have the <option>mimencode</option> command installed, another way to do produce
45495 base64-encoded strings is to run the command
45497 <literallayout class="monospaced">
45498 echo -e -n `\0user\0password' | mimencode
45501 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
45502 in the argument, and the <option>-n</option> option specifies no newline at the end of its
45503 output. However, not all versions of <option>echo</option> recognize these options, so you
45504 should check your version before relying on this suggestion.
45507 <section id="SECID170">
45508 <title>Authentication by an Exim client</title>
45510 <indexterm role="concept">
45511 <primary>authentication</primary>
45512 <secondary>on an Exim client</secondary>
45514 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
45515 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
45516 announces support for authentication, and the host matches an entry in either
45517 of these options, Exim (as a client) tries to authenticate as follows:
45522 For each authenticator that is configured as a client, in the order in which
45523 they are defined in the configuration, it searches the authentication
45524 mechanisms announced by the server for one whose name matches the public name
45525 of the authenticator.
45530 <indexterm role="variable">
45531 <primary><varname>$host</varname></primary>
45533 <indexterm role="variable">
45534 <primary><varname>$host_address</varname></primary>
45536 When it finds one that matches, it runs the authenticator’s client code. The
45537 variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string expansions
45538 that the client might do. They are set to the server’s name and IP address. If
45539 any expansion is forced to fail, the authentication attempt is abandoned, and
45540 Exim moves on to the next authenticator. Otherwise an expansion failure causes
45541 delivery to be deferred.
45546 If the result of the authentication attempt is a temporary error or a timeout,
45547 Exim abandons trying to send the message to the host for the moment. It will
45548 try again later. If there are any backup hosts available, they are tried in the
45554 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
45555 carries on searching the list of authenticators and tries another one if
45556 possible. If all authentication attempts give permanent errors, or if there are
45557 no attempts because no mechanisms match (or option expansions force failure),
45558 what happens depends on whether the host matches <option>hosts_require_auth</option> or
45559 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
45560 delivery is deferred. The error can be detected in the retry rules, and thereby
45561 turned into a permanent error if you wish. In the second case, Exim tries to
45562 deliver the message unauthenticated.
45567 <indexterm role="concept">
45568 <primary>AUTH</primary>
45569 <secondary>on MAIL command</secondary>
45571 When Exim has authenticated itself to a remote server, it adds the AUTH
45572 parameter to the MAIL commands it sends, if it has an authenticated sender for
45573 the message. If the message came from a remote host, the authenticated sender
45574 is the one that was receiving on an incoming MAIL command, provided that the
45575 incoming connection was authenticated and the <option>server_mail_auth</option> condition
45576 allowed the authenticated sender to be retained. If a local process calls Exim
45577 to send a message, the sender address that is built from the login name and
45578 <option>qualify_domain</option> is treated as authenticated. However, if the
45579 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
45580 the authenticated sender that was received with the message.
45581 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
45582 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
45587 <chapter id="CHAPplaintext">
45588 <title>The plaintext authenticator</title>
45590 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
45591 <primary><command>plaintext</command> authenticator</primary>
45593 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
45594 <primary>authenticators</primary>
45595 <secondary><command>plaintext</command></secondary>
45597 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
45598 LOGIN authentication mechanisms, both of which transfer authentication data as
45599 plain (unencrypted) text (though base64 encoded). The use of plain text is a
45600 security risk; you are strongly advised to insist on the use of SMTP encryption
45601 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
45602 use unencrypted plain text, you should not use the same passwords for SMTP
45603 connections as you do for login accounts.
45605 <section id="SECID171">
45606 <title>Plaintext options</title>
45608 <indexterm role="concept">
45609 <primary>options</primary>
45610 <secondary><command>plaintext</command> authenticator (server)</secondary>
45612 When configured as a server, <command>plaintext</command> uses the following options:
45615 <indexterm role="option">
45616 <primary><option>server_condition</option></primary>
45619 <informaltable frame="all">
45620 <tgroup cols="4" colsep="0" rowsep="0">
45621 <colspec colwidth="8*" align="left"/>
45622 <colspec colwidth="6*" align="center"/>
45623 <colspec colwidth="6*" align="center"/>
45624 <colspec colwidth="6*" align="right"/>
45627 <entry><option>server_condition</option></entry>
45628 <entry>Use: <emphasis>authenticators</emphasis></entry>
45629 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
45630 <entry>Default: <emphasis>unset</emphasis></entry>
45636 This is actually a global authentication option, but it must be set in order to
45637 configure the <command>plaintext</command> driver as a server. Its use is described below.
45640 <indexterm role="option">
45641 <primary><option>server_prompts</option></primary>
45644 <informaltable frame="all">
45645 <tgroup cols="4" colsep="0" rowsep="0">
45646 <colspec colwidth="8*" align="left"/>
45647 <colspec colwidth="6*" align="center"/>
45648 <colspec colwidth="6*" align="center"/>
45649 <colspec colwidth="6*" align="right"/>
45652 <entry><option>server_prompts</option></entry>
45653 <entry>Use: <emphasis>plaintext</emphasis></entry>
45654 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
45655 <entry>Default: <emphasis>unset</emphasis></entry>
45661 The contents of this option, after expansion, must be a colon-separated list of
45662 prompt strings. If expansion fails, a temporary authentication rejection is
45666 <section id="SECTplainserver">
45667 <title>Using plaintext in a server</title>
45669 <indexterm role="concept">
45670 <primary>AUTH</primary>
45671 <secondary>in <command>plaintext</command> authenticator</secondary>
45673 <indexterm role="concept">
45674 <primary>binary zero</primary>
45675 <secondary>in <command>plaintext</command> authenticator</secondary>
45677 <indexterm role="concept">
45678 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
45679 <secondary>in <command>plaintext</command> authenticator</secondary>
45681 <indexterm role="variable">
45682 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
45684 <indexterm role="concept">
45685 <primary>base64 encoding</primary>
45686 <secondary>in <command>plaintext</command> authenticator</secondary>
45690 When running as a server, <command>plaintext</command> performs the authentication test by
45691 expanding a string. The data sent by the client with the AUTH command, or in
45692 response to subsequent prompts, is base64 encoded, and so may contain any byte
45693 values when decoded. If any data is supplied with the command, it is treated as
45694 a list of strings, separated by NULs (binary zeros), the first three of which
45695 are placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname>
45696 (neither LOGIN nor PLAIN uses more than three strings).
45699 For compatibility with previous releases of Exim, the values are also placed in
45700 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
45701 variables for this purpose is now deprecated, as it can lead to confusion in
45702 string expansions that also use them for other things.
45705 If there are more strings in <option>server_prompts</option> than the number of strings
45706 supplied with the AUTH command, the remaining prompts are used to obtain more
45707 data. Each response from the client may be a list of NUL-separated strings.
45710 <indexterm role="variable">
45711 <primary><varname>$authenticated_id</varname></primary>
45713 Once a sufficient number of data strings have been received,
45714 <option>server_condition</option> is expanded. If the expansion is forced to fail,
45715 authentication fails. Any other expansion failure causes a temporary error code
45716 to be returned. If the result of a successful expansion is an empty string,
45717 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
45718 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
45719 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
45720 For any other result, a temporary error code is returned, with the expanded
45721 string as the error text.
45724 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user’s
45725 password, be sure to make the authentication fail if the user is unknown.
45726 There are good and bad examples at the end of the next section.
45729 <section id="SECID172">
45730 <title>The PLAIN authentication mechanism</title>
45732 <indexterm role="concept">
45733 <primary>PLAIN authentication mechanism</primary>
45735 <indexterm role="concept">
45736 <primary>authentication</primary>
45737 <secondary>PLAIN mechanism</secondary>
45739 <indexterm role="concept">
45740 <primary>binary zero</primary>
45741 <secondary>in <command>plaintext</command> authenticator</secondary>
45743 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
45744 sent as one item of data (that is, one combined string containing two NUL
45745 separators). The data is sent either as part of the AUTH command, or
45746 subsequently in response to an empty prompt from the server.
45749 The second and third strings are a user name and a corresponding password.
45750 Using a single fixed user name and password as an example, this could be
45751 configured as follows:
45753 <literallayout class="monospaced">
45756 public_name = PLAIN
45758 server_condition = \
45759 ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
45760 server_set_id = $auth2
45763 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
45764 are exactly what we want here, so they need not be specified. Obviously, if the
45765 password contains expansion-significant characters such as dollar, backslash,
45766 or closing brace, they have to be escaped.
45769 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
45770 the end of a string list are ignored). If all the data comes as part of the
45771 AUTH command, as is commonly the case, the prompt is not used. This
45772 authenticator is advertised in the response to EHLO as
45774 <literallayout class="monospaced">
45778 and a client host can authenticate itself by sending the command
45780 <literallayout class="monospaced">
45781 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
45784 As this contains three strings (more than the number of prompts), no further
45785 data is required from the client. Alternatively, the client may just send
45787 <literallayout class="monospaced">
45791 to initiate authentication, in which case the server replies with an empty
45792 prompt. The client must respond with the combined data string.
45795 The data string is base64 encoded, as required by the RFC. This example,
45796 when decoded, is <<emphasis>NUL</emphasis>><literal>username</literal><<emphasis>NUL</emphasis>><literal>mysecret</literal>, where <<emphasis>NUL</emphasis>>
45797 represents a zero byte. This is split up into three strings, the first of which
45798 is empty. The <option>server_condition</option> option in the authenticator checks that the
45799 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
45802 Having just one fixed user name and password, as in this example, is not very
45803 realistic, though for a small organization with only a handful of
45804 authenticating clients it could make sense.
45807 A more sophisticated instance of this authenticator could use the user name in
45808 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
45809 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
45810 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
45811 This is an incorrect example:
45813 <literallayout class="monospaced">
45814 server_condition = \
45815 ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
45818 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
45819 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
45820 incorrect? It works fine for existing users, but consider what happens if a
45821 non-existent user name is given. The lookup fails, but as no success/failure
45822 strings are given for the lookup, it yields an empty string. Thus, to defeat
45823 the authentication, all a client has to do is to supply a non-existent user
45824 name and an empty password. The correct way of writing this test is:
45826 <literallayout class="monospaced">
45827 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
45828 {${if eq{$value}{$auth3}}} {false}}
45831 In this case, if the lookup succeeds, the result is checked; if the lookup
45832 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
45833 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
45834 always fails if its second argument is empty. However, the second way of
45835 writing the test makes the logic clearer.
45838 <section id="SECID173">
45839 <title>The LOGIN authentication mechanism</title>
45841 <indexterm role="concept">
45842 <primary>LOGIN authentication mechanism</primary>
45844 <indexterm role="concept">
45845 <primary>authentication</primary>
45846 <secondary>LOGIN mechanism</secondary>
45848 The LOGIN authentication mechanism is not documented in any RFC, but is in use
45849 in a number of programs. No data is sent with the AUTH command. Instead, a
45850 user name and password are supplied separately, in response to prompts. The
45851 plaintext authenticator can be configured to support this as in this example:
45853 <literallayout class="monospaced">
45856 public_name = LOGIN
45857 server_prompts = User Name : Password
45858 server_condition = \
45859 ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
45860 server_set_id = $auth1
45863 Because of the way plaintext operates, this authenticator accepts data supplied
45864 with the AUTH command (in contravention of the specification of LOGIN), but
45865 if the client does not supply it (as is the case for LOGIN clients), the prompt
45866 strings are used to obtain two data items.
45869 Some clients are very particular about the precise text of the prompts. For
45870 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
45871 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
45872 strings. It uses the <option>ldapauth</option> expansion condition to check the user
45873 name and password by binding to an LDAP server:
45875 <literallayout class="monospaced">
45878 public_name = LOGIN
45879 server_prompts = Username:: : Password::
45880 server_condition = ${if and{{
45882 ldapauth{user="cn=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
45883 pass=${quote:$auth2} \
45884 ldap://ldap.example.org/} }} }
45885 server_set_id = uid=$auth1,ou=people,o=example.org
45888 We have to check that the username is not empty before using it, because LDAP
45889 does not permit empty DN components. We must also use the <option>quote_ldap_dn</option>
45890 operator to correctly quote the DN for authentication. However, the basic
45891 <option>quote</option> operator, rather than any of the LDAP quoting operators, is the
45892 correct one to use for the password, because quoting is needed only to make
45893 the password conform to the Exim syntax. At the LDAP level, the password is an
45894 uninterpreted string.
45897 <section id="SECID174">
45898 <title>Support for different kinds of authentication</title>
45900 A number of string expansion features are provided for the purpose of
45901 interfacing to different ways of user authentication. These include checking
45902 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
45903 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
45904 <xref linkend="SECTexpcond"/>.
45907 <section id="SECID175">
45908 <title>Using plaintext in a client</title>
45910 <indexterm role="concept">
45911 <primary>options</primary>
45912 <secondary><command>plaintext</command> authenticator (client)</secondary>
45914 The <command>plaintext</command> authenticator has two client options:
45917 <indexterm role="option">
45918 <primary><option>client_ignore_invalid_base64</option></primary>
45921 <informaltable frame="all">
45922 <tgroup cols="4" colsep="0" rowsep="0">
45923 <colspec colwidth="8*" align="left"/>
45924 <colspec colwidth="6*" align="center"/>
45925 <colspec colwidth="6*" align="center"/>
45926 <colspec colwidth="6*" align="right"/>
45929 <entry><option>client_ignore_invalid_base64</option></entry>
45930 <entry>Use: <emphasis>plaintext</emphasis></entry>
45931 <entry>Type: <emphasis>boolean</emphasis></entry>
45932 <entry>Default: <emphasis>false</emphasis></entry>
45938 If the client receives a server prompt that is not a valid base64 string,
45939 authentication is abandoned by default. However, if this option is set true,
45940 the error in the challenge is ignored and the client sends the response as
45944 <indexterm role="option">
45945 <primary><option>client_send</option></primary>
45948 <informaltable frame="all">
45949 <tgroup cols="4" colsep="0" rowsep="0">
45950 <colspec colwidth="8*" align="left"/>
45951 <colspec colwidth="6*" align="center"/>
45952 <colspec colwidth="6*" align="center"/>
45953 <colspec colwidth="6*" align="right"/>
45956 <entry><option>client_send</option></entry>
45957 <entry>Use: <emphasis>plaintext</emphasis></entry>
45958 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
45959 <entry>Default: <emphasis>unset</emphasis></entry>
45965 The string is a colon-separated list of authentication data strings. Each
45966 string is independently expanded before being sent to the server. The first
45967 string is sent with the AUTH command; any more strings are sent in response
45968 to prompts from the server. Before each string is expanded, the value of the
45969 most recent prompt is placed in the next <varname>$auth</varname><<emphasis>n</emphasis>> variable, starting
45970 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
45971 way. Thus, the prompt that is received in response to sending the first string
45972 (with the AUTH command) can be used in the expansion of the second string, and
45973 so on. If an invalid base64 string is received when
45974 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
45975 <varname>$auth</varname><<emphasis>n</emphasis>> variable.
45978 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
45979 splitting takes priority and happens first.
45982 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
45983 the data, further processing is applied to each string before it is sent. If
45984 there are any single circumflex characters in the string, they are converted to
45985 NULs. Should an actual circumflex be required as data, it must be doubled in
45989 This is an example of a client configuration that implements the PLAIN
45990 authentication mechanism with a fixed user name and password:
45992 <literallayout class="monospaced">
45995 public_name = PLAIN
45996 client_send = ^username^mysecret
45999 The lack of colons means that the entire text is sent with the AUTH
46000 command, with the circumflex characters converted to NULs. A similar example
46001 that uses the LOGIN mechanism is:
46003 <literallayout class="monospaced">
46006 public_name = LOGIN
46007 client_send = : username : mysecret
46010 The initial colon means that the first string is empty, so no data is sent with
46011 the AUTH command itself. The remaining strings are sent in response to
46013 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
46014 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
46019 <chapter id="CHID9">
46020 <title>The cram_md5 authenticator</title>
46022 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
46023 <primary><command>cram_md5</command> authenticator</primary>
46025 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
46026 <primary>authenticators</primary>
46027 <secondary><command>cram_md5</command></secondary>
46029 <indexterm role="concept">
46030 <primary>CRAM-MD5 authentication mechanism</primary>
46032 <indexterm role="concept">
46033 <primary>authentication</primary>
46034 <secondary>CRAM-MD5 mechanism</secondary>
46036 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
46037 sends a challenge string to the client, and the response consists of a user
46038 name and the CRAM-MD5 digest of the challenge string combined with a secret
46039 string (password) which is known to both server and client. Thus, the secret
46040 is not sent over the network as plain text, which makes this authenticator more
46041 secure than <command>plaintext</command>. However, the downside is that the secret has to be
46042 available in plain text at either end.
46044 <section id="SECID176">
46045 <title>Using cram_md5 as a server</title>
46047 <indexterm role="concept">
46048 <primary>options</primary>
46049 <secondary><command>cram_md5</command> authenticator (server)</secondary>
46051 This authenticator has one server option, which must be set to configure the
46052 authenticator as a server:
46055 <indexterm role="option">
46056 <primary><option>server_secret</option></primary>
46059 <informaltable frame="all">
46060 <tgroup cols="4" colsep="0" rowsep="0">
46061 <colspec colwidth="8*" align="left"/>
46062 <colspec colwidth="6*" align="center"/>
46063 <colspec colwidth="6*" align="center"/>
46064 <colspec colwidth="6*" align="right"/>
46067 <entry><option>server_secret</option></entry>
46068 <entry>Use: <emphasis>cram_md5</emphasis></entry>
46069 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
46070 <entry>Default: <emphasis>unset</emphasis></entry>
46076 <indexterm role="concept">
46077 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
46078 <secondary>in <command>cram_md5</command> authenticator</secondary>
46080 When the server receives the client’s response, the user name is placed in
46081 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
46082 obtain the password for that user. The server then computes the CRAM-MD5 digest
46083 that the client should have sent, and checks that it received the correct
46084 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
46085 fails. If the expansion fails for some other reason, a temporary error code is
46086 returned to the client.
46089 For compatibility with previous releases of Exim, the user name is also placed
46090 in <varname>$1</varname>. However, the use of this variables for this purpose is now
46091 deprecated, as it can lead to confusion in string expansions that also use
46092 numeric variables for other things.
46095 For example, the following authenticator checks that the user name given by the
46096 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
46097 user name, authentication fails.
46099 <literallayout class="monospaced">
46102 public_name = CRAM-MD5
46103 server_secret = ${if eq{$auth1}{ph10}{secret}fail}
46104 server_set_id = $auth1
46107 <indexterm role="variable">
46108 <primary><varname>$authenticated_id</varname></primary>
46110 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
46111 name in <varname>$authenticated_id</varname>. A more typical configuration might look up the
46112 secret string in a file, using the user name as the key. For example:
46114 <literallayout class="monospaced">
46117 public_name = CRAM-MD5
46118 server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}\
46120 server_set_id = $auth1
46123 Note that this expansion explicitly forces failure if the lookup fails
46124 because <varname>$auth1</varname> contains an unknown user name.
46127 <section id="SECID177">
46128 <title>Using cram_md5 as a client</title>
46130 <indexterm role="concept">
46131 <primary>options</primary>
46132 <secondary><command>cram_md5</command> authenticator (client)</secondary>
46134 When used as a client, the <command>cram_md5</command> authenticator has two options:
46137 <indexterm role="option">
46138 <primary><option>client_name</option></primary>
46141 <informaltable frame="all">
46142 <tgroup cols="4" colsep="0" rowsep="0">
46143 <colspec colwidth="8*" align="left"/>
46144 <colspec colwidth="6*" align="center"/>
46145 <colspec colwidth="6*" align="center"/>
46146 <colspec colwidth="6*" align="right"/>
46149 <entry><option>client_name</option></entry>
46150 <entry>Use: <emphasis>cram_md5</emphasis></entry>
46151 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
46152 <entry>Default: <emphasis>the primary host name</emphasis></entry>
46158 This string is expanded, and the result used as the user name data when
46159 computing the response to the server’s challenge.
46162 <indexterm role="option">
46163 <primary><option>client_secret</option></primary>
46166 <informaltable frame="all">
46167 <tgroup cols="4" colsep="0" rowsep="0">
46168 <colspec colwidth="8*" align="left"/>
46169 <colspec colwidth="6*" align="center"/>
46170 <colspec colwidth="6*" align="center"/>
46171 <colspec colwidth="6*" align="right"/>
46174 <entry><option>client_secret</option></entry>
46175 <entry>Use: <emphasis>cram_md5</emphasis></entry>
46176 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
46177 <entry>Default: <emphasis>unset</emphasis></entry>
46183 This option must be set for the authenticator to work as a client. Its value is
46184 expanded and the result used as the secret string when computing the response.
46187 <indexterm role="variable">
46188 <primary><varname>$host</varname></primary>
46190 <indexterm role="variable">
46191 <primary><varname>$host_address</varname></primary>
46193 Different user names and secrets can be used for different servers by referring
46194 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
46195 expansion string is treated as an indication that this authenticator is not
46196 prepared to handle this case. Exim moves on to the next configured client
46197 authenticator. Any other expansion failure causes Exim to give up trying to
46198 send the message to the current server.
46201 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
46204 <literallayout class="monospaced">
46207 public_name = CRAM-MD5
46209 client_secret = secret
46212 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
46213 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
46218 <chapter id="CHID10">
46219 <title>The cyrus_sasl authenticator</title>
46221 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
46222 <primary><command>cyrus_sasl</command> authenticator</primary>
46224 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
46225 <primary>authenticators</primary>
46226 <secondary><command>cyrus_sasl</command></secondary>
46228 <indexterm role="concept">
46229 <primary>Cyrus</primary>
46230 <secondary>SASL library</secondary>
46232 <indexterm role="concept">
46233 <primary>Kerberos</primary>
46235 The code for this authenticator was provided by Matthew Byng-Maddick of A L
46236 Digital Ltd (<emphasis role="bold"><ulink url="http://www.aldigital.co.uk">http://www.aldigital.co.uk</ulink></emphasis>).
46239 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
46240 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
46241 Layer</quote>). This library supports a number of authentication mechanisms,
46242 including PLAIN and LOGIN, but also several others that Exim does not support
46243 directly. In particular, there is support for Kerberos authentication.
46246 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
46247 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
46248 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
46249 name of the driver to determine which mechanism to support.
46252 Where access to some kind of secret file is required, for example in GSSAPI
46253 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
46254 user, and that the Cyrus SASL library has no way of escalating privileges
46255 by default. You may also find you need to set environment variables,
46256 depending on the driver you are using.
46259 The application name provided by Exim is <quote>exim</quote>, so various SASL options may
46260 be set in <filename>exim.conf</filename> in your SASL directory. If you are using GSSAPI for
46261 Kerberos, note that because of limitations in the GSSAPI interface,
46262 changing the server keytab might need to be communicated down to the Kerberos
46263 layer independently. The mechanism for doing so is dependent upon the Kerberos
46264 implementation. For example, for Heimdal, the environment variable KRB5_KTNAME
46265 may be set to point to an alternative keytab file. Exim will pass this
46266 variable through from its own inherited environment when started as root or the
46267 Exim user. The keytab file needs to be readable by the Exim user.
46269 <section id="SECID178">
46270 <title>Using cyrus_sasl as a server</title>
46272 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
46273 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
46274 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
46275 use of this variable for this purpose is now deprecated, as it can lead to
46276 confusion in string expansions that also use numeric variables for other
46280 <indexterm role="option">
46281 <primary><option>server_hostname</option></primary>
46284 <informaltable frame="all">
46285 <tgroup cols="4" colsep="0" rowsep="0">
46286 <colspec colwidth="8*" align="left"/>
46287 <colspec colwidth="6*" align="center"/>
46288 <colspec colwidth="6*" align="center"/>
46289 <colspec colwidth="6*" align="right"/>
46292 <entry><option>server_hostname</option></entry>
46293 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46294 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
46295 <entry>Default: <emphasis>see below</emphasis></entry>
46301 This option selects the hostname that is used when communicating with the
46302 library. The default value is <literal>$primary_hostname</literal>. It is up to the underlying
46303 SASL plug-in what it does with this data.
46306 <indexterm role="option">
46307 <primary><option>server_mech</option></primary>
46310 <informaltable frame="all">
46311 <tgroup cols="4" colsep="0" rowsep="0">
46312 <colspec colwidth="8*" align="left"/>
46313 <colspec colwidth="6*" align="center"/>
46314 <colspec colwidth="6*" align="center"/>
46315 <colspec colwidth="6*" align="right"/>
46318 <entry><option>server_mech</option></entry>
46319 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46320 <entry>Type: <emphasis>string</emphasis></entry>
46321 <entry>Default: <emphasis>see below</emphasis></entry>
46327 This option selects the authentication mechanism this driver should use. The
46328 default is the value of the generic <option>public_name</option> option. This option allows
46329 you to use a different underlying mechanism from the advertised name. For
46332 <literallayout class="monospaced">
46334 driver = cyrus_sasl
46335 public_name = X-ANYTHING
46336 server_mech = CRAM-MD5
46337 server_set_id = $auth1
46340 <indexterm role="option">
46341 <primary><option>server_realm</option></primary>
46344 <informaltable frame="all">
46345 <tgroup cols="4" colsep="0" rowsep="0">
46346 <colspec colwidth="8*" align="left"/>
46347 <colspec colwidth="6*" align="center"/>
46348 <colspec colwidth="6*" align="center"/>
46349 <colspec colwidth="6*" align="right"/>
46352 <entry><option>server_realm</option></entry>
46353 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46354 <entry>Type: <emphasis>string</emphasis></entry>
46355 <entry>Default: <emphasis>unset</emphasis></entry>
46361 This specifies the SASL realm that the server claims to be in.
46364 <indexterm role="option">
46365 <primary><option>server_service</option></primary>
46368 <informaltable frame="all">
46369 <tgroup cols="4" colsep="0" rowsep="0">
46370 <colspec colwidth="8*" align="left"/>
46371 <colspec colwidth="6*" align="center"/>
46372 <colspec colwidth="6*" align="center"/>
46373 <colspec colwidth="6*" align="right"/>
46376 <entry><option>server_service</option></entry>
46377 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46378 <entry>Type: <emphasis>string</emphasis></entry>
46379 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
46385 This is the SASL service that the server claims to implement.
46388 For straightforward cases, you do not need to set any of the authenticator’s
46389 private options. All you need to do is to specify an appropriate mechanism as
46390 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
46391 PLAIN, you could have two authenticators as follows:
46393 <literallayout class="monospaced">
46395 driver = cyrus_sasl
46396 public_name = CRAM-MD5
46397 server_set_id = $auth1
46400 driver = cyrus_sasl
46401 public_name = PLAIN
46402 server_set_id = $auth2
46405 Cyrus SASL does implement the LOGIN authentication method, even though it is
46406 not a standard method. It is disabled by default in the source distribution,
46407 but it is present in many binary distributions.
46408 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
46409 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
46414 <chapter id="CHAPdovecot">
46415 <title>The dovecot authenticator</title>
46417 <indexterm role="concept" id="IIDdcotauth1" class="startofrange">
46418 <primary><command>dovecot</command> authenticator</primary>
46420 <indexterm role="concept" id="IIDdcotauth2" class="startofrange">
46421 <primary>authenticators</primary>
46422 <secondary><command>dovecot</command></secondary>
46424 This authenticator is an interface to the authentication facility of the
46425 Dovecot POP/IMAP server, which can support a number of authentication methods.
46426 If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful
46427 to use the same mechanisms for SMTP authentication. This is a server
46428 authenticator only. There is only one option:
46431 <indexterm role="option">
46432 <primary><option>server_socket</option></primary>
46435 <informaltable frame="all">
46436 <tgroup cols="4" colsep="0" rowsep="0">
46437 <colspec colwidth="8*" align="left"/>
46438 <colspec colwidth="6*" align="center"/>
46439 <colspec colwidth="6*" align="center"/>
46440 <colspec colwidth="6*" align="right"/>
46443 <entry><option>server_socket</option></entry>
46444 <entry>Use: <emphasis>dovecot</emphasis></entry>
46445 <entry>Type: <emphasis>string</emphasis></entry>
46446 <entry>Default: <emphasis>unset</emphasis></entry>
46452 This option must specify the socket that is the interface to Dovecot
46453 authentication. The <option>public_name</option> option must specify an authentication
46454 mechanism that Dovecot is configured to support. You can have several
46455 authenticators for different mechanisms. For example:
46457 <literallayout class="monospaced">
46460 public_name = PLAIN
46461 server_socket = /var/run/dovecot/auth-client
46462 server_set_id = $auth2
46467 server_socket = /var/run/dovecot/auth-client
46468 server_set_id = $auth1
46471 If the SMTP connection is encrypted, or if <varname>$sender_host_address</varname> is equal to
46472 <varname>$received_ip_address</varname> (that is, the connection is local), the <quote>secured</quote>
46473 option is passed in the Dovecot authentication command. If, for a TLS
46474 connection, a client certificate has been verified, the <quote>valid-client-cert</quote>
46475 option is passed. When authentication succeeds, the identity of the user
46476 who authenticated is placed in <varname>$auth1</varname>.
46477 <indexterm role="concept" startref="IIDdcotauth1" class="endofrange"/>
46478 <indexterm role="concept" startref="IIDdcotauth2" class="endofrange"/>
46482 <chapter id="CHAPspa">
46483 <title>The spa authenticator</title>
46485 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
46486 <primary><command>spa</command> authenticator</primary>
46488 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
46489 <primary>authenticators</primary>
46490 <secondary><command>spa</command></secondary>
46492 <indexterm role="concept">
46493 <primary>authentication</primary>
46494 <secondary>Microsoft Secure Password</secondary>
46496 <indexterm role="concept">
46497 <primary>authentication</primary>
46498 <secondary>NTLM</secondary>
46500 <indexterm role="concept">
46501 <primary>Microsoft Secure Password Authentication</primary>
46503 <indexterm role="concept">
46504 <primary>NTLM authentication</primary>
46506 The <command>spa</command> authenticator provides client support for Microsoft’s <emphasis>Secure
46507 Password Authentication</emphasis> mechanism,
46508 which is also sometimes known as NTLM (NT LanMan). The code for client side of
46509 this authenticator was contributed by Marc Prud’hommeaux, and much of it is
46510 taken from the Samba project (<emphasis role="bold"><ulink url="http://www.samba.org">http://www.samba.org</ulink></emphasis>). The code for the
46511 server side was subsequently contributed by Tom Kistner. The mechanism works as
46517 After the AUTH command has been accepted, the client sends an SPA
46518 authentication request based on the user name and optional domain.
46523 The server sends back a challenge.
46528 The client builds a challenge response which makes use of the user’s password
46529 and sends it to the server, which then accepts or rejects it.
46534 Encryption is used to protect the password in transit.
46536 <section id="SECID179">
46537 <title>Using spa as a server</title>
46539 <indexterm role="concept">
46540 <primary>options</primary>
46541 <secondary><command>spa</command> authenticator (server)</secondary>
46543 The <command>spa</command> authenticator has just one server option:
46546 <indexterm role="option">
46547 <primary><option>server_password</option></primary>
46550 <informaltable frame="all">
46551 <tgroup cols="4" colsep="0" rowsep="0">
46552 <colspec colwidth="8*" align="left"/>
46553 <colspec colwidth="6*" align="center"/>
46554 <colspec colwidth="6*" align="center"/>
46555 <colspec colwidth="6*" align="right"/>
46558 <entry><option>server_password</option></entry>
46559 <entry>Use: <emphasis>spa</emphasis></entry>
46560 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
46561 <entry>Default: <emphasis>unset</emphasis></entry>
46567 <indexterm role="concept">
46568 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
46569 <secondary>in <command>spa</command> authenticator</secondary>
46571 This option is expanded, and the result must be the cleartext password for the
46572 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
46573 compatibility with previous releases of Exim, the user name is also placed in
46574 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
46575 it can lead to confusion in string expansions that also use numeric variables
46576 for other things. For example:
46578 <literallayout class="monospaced">
46582 server_password = \
46583 ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
46586 If the expansion is forced to fail, authentication fails. Any other expansion
46587 failure causes a temporary error code to be returned.
46590 <section id="SECID180">
46591 <title>Using spa as a client</title>
46593 <indexterm role="concept">
46594 <primary>options</primary>
46595 <secondary><command>spa</command> authenticator (client)</secondary>
46597 The <command>spa</command> authenticator has the following client options:
46600 <indexterm role="option">
46601 <primary><option>client_domain</option></primary>
46604 <informaltable frame="all">
46605 <tgroup cols="4" colsep="0" rowsep="0">
46606 <colspec colwidth="8*" align="left"/>
46607 <colspec colwidth="6*" align="center"/>
46608 <colspec colwidth="6*" align="center"/>
46609 <colspec colwidth="6*" align="right"/>
46612 <entry><option>client_domain</option></entry>
46613 <entry>Use: <emphasis>spa</emphasis></entry>
46614 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
46615 <entry>Default: <emphasis>unset</emphasis></entry>
46621 This option specifies an optional domain for the authentication.
46624 <indexterm role="option">
46625 <primary><option>client_password</option></primary>
46628 <informaltable frame="all">
46629 <tgroup cols="4" colsep="0" rowsep="0">
46630 <colspec colwidth="8*" align="left"/>
46631 <colspec colwidth="6*" align="center"/>
46632 <colspec colwidth="6*" align="center"/>
46633 <colspec colwidth="6*" align="right"/>
46636 <entry><option>client_password</option></entry>
46637 <entry>Use: <emphasis>spa</emphasis></entry>
46638 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
46639 <entry>Default: <emphasis>unset</emphasis></entry>
46645 This option specifies the user’s password, and must be set.
46648 <indexterm role="option">
46649 <primary><option>client_username</option></primary>
46652 <informaltable frame="all">
46653 <tgroup cols="4" colsep="0" rowsep="0">
46654 <colspec colwidth="8*" align="left"/>
46655 <colspec colwidth="6*" align="center"/>
46656 <colspec colwidth="6*" align="center"/>
46657 <colspec colwidth="6*" align="right"/>
46660 <entry><option>client_username</option></entry>
46661 <entry>Use: <emphasis>spa</emphasis></entry>
46662 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
46663 <entry>Default: <emphasis>unset</emphasis></entry>
46669 This option specifies the user name, and must be set. Here is an example of a
46670 configuration of this authenticator for use with the mail servers at
46671 <emphasis>msn.com</emphasis>:
46673 <literallayout class="monospaced">
46677 client_username = msn/msn_username
46678 client_password = msn_plaintext_password
46679 client_domain = DOMAIN_OR_UNSET
46682 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
46683 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
46688 <chapter id="CHAPTLS">
46689 <title>Encrypted SMTP connections using TLS/SSL</title>
46690 <titleabbrev>Encrypted SMTP connections</titleabbrev>
46692 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
46693 <primary>encryption</primary>
46694 <secondary>on SMTP connection</secondary>
46696 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
46697 <primary>SMTP</primary>
46698 <secondary>encryption</secondary>
46700 <indexterm role="concept">
46701 <primary>TLS</primary>
46702 <secondary>on SMTP connection</secondary>
46704 <indexterm role="concept">
46705 <primary>OpenSSL</primary>
46707 <indexterm role="concept">
46708 <primary>GnuTLS</primary>
46710 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
46711 Sockets Layer), is implemented by making use of the OpenSSL library or the
46712 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
46713 cryptographic code in the Exim distribution itself for implementing TLS. In
46714 order to use this feature you must install OpenSSL or GnuTLS, and then build a
46715 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
46716 You also need to understand the basic concepts of encryption at a managerial
46717 level, and in particular, the way that public keys, private keys, and
46718 certificates are used.
46721 RFC 3207 defines how SMTP connections can make use of encryption. Once a
46722 connection is established, the client issues a STARTTLS command. If the
46723 server accepts this, the client and the server negotiate an encryption
46724 mechanism. If the negotiation succeeds, the data that subsequently passes
46725 between them is encrypted.
46728 Exim’s ACLs can detect whether the current SMTP session is encrypted or not,
46729 and if so, what cipher suite is in use, whether the client supplied a
46730 certificate, and whether or not that certificate was verified. This makes it
46731 possible for an Exim server to deny or accept certain commands based on the
46735 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
46736 disrupt TLS connections. You need to turn off SMTP scanning for these products
46737 in order to get TLS to work.
46739 <section id="SECID284">
46740 <title>Support for the legacy <quote>ssmtp</quote> (aka <quote>smtps</quote>) protocol</title>
46742 <indexterm role="concept">
46743 <primary>ssmtp protocol</primary>
46745 <indexterm role="concept">
46746 <primary>smtps protocol</primary>
46748 <indexterm role="concept">
46749 <primary>SMTP</primary>
46750 <secondary>ssmtp protocol</secondary>
46752 <indexterm role="concept">
46753 <primary>SMTP</primary>
46754 <secondary>smtps protocol</secondary>
46756 Early implementations of encrypted SMTP used a different TCP port from normal
46757 SMTP, and expected an encryption negotiation to start immediately, instead of
46758 waiting for a STARTTLS command from the client using the standard SMTP
46759 port. The protocol was called <quote>ssmtp</quote> or <quote>smtps</quote>, and port 465 was
46760 allocated for this purpose.
46763 This approach was abandoned when encrypted SMTP was standardized, but there are
46764 still some legacy clients that use it. Exim supports these clients by means of
46765 the <option>tls_on_connect_ports</option> global option. Its value must be a list of port
46766 numbers; the most common use is expected to be:
46768 <literallayout class="monospaced">
46769 tls_on_connect_ports = 465
46772 The port numbers specified by this option apply to all SMTP connections, both
46773 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
46774 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
46775 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
46776 an extra port – rather, it specifies different behaviour on a port that is
46780 There is also a <option>-tls-on-connect</option> command line option. This overrides
46781 <option>tls_on_connect_ports</option>; it forces the legacy behaviour for all ports.
46784 <section id="SECTopenvsgnu">
46785 <title>OpenSSL vs GnuTLS</title>
46787 <indexterm role="concept">
46788 <primary>TLS</primary>
46789 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
46791 The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS
46792 followed later, when the first versions of GnuTLS were released. To build Exim
46793 to use GnuTLS, you need to set
46795 <literallayout class="monospaced">
46799 in Local/Makefile, in addition to
46801 <literallayout class="monospaced">
46805 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
46806 include files and libraries for GnuTLS can be found.
46809 There are some differences in usage when using GnuTLS instead of OpenSSL:
46814 The <option>tls_verify_certificates</option> option must contain the name of a file, not the
46815 name of a directory (for OpenSSL it can be either).
46820 The <option>tls_dhparam</option> option is ignored, because early versions of GnuTLS had no
46821 facility for varying its Diffie-Hellman parameters. I understand that this has
46822 changed, but Exim has not been updated to provide this facility.
46827 <indexterm role="variable">
46828 <primary><varname>$tls_peerdn</varname></primary>
46830 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
46831 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
46832 affects the value of the <varname>$tls_peerdn</varname> variable.
46837 OpenSSL identifies cipher suites using hyphens as separators, for example:
46838 DES-CBC3-SHA. GnuTLS uses underscores, for example: RSA_ARCFOUR_SHA. What is
46839 more, OpenSSL complains if underscores are present in a cipher list. To make
46840 life simpler, Exim changes underscores to hyphens for OpenSSL and hyphens to
46841 underscores for GnuTLS when processing lists of cipher suites in the
46842 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
46848 The <option>tls_require_ciphers</option> options operate differently, as described in the
46849 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
46854 <section id="SECID181">
46855 <title>GnuTLS parameter computation</title>
46857 GnuTLS uses D-H parameters that may take a substantial amount of time
46858 to compute. It is unreasonable to re-compute them for every TLS session.
46859 Therefore, Exim keeps this data in a file in its spool directory, called
46860 <filename>gnutls-params</filename>. The file is owned by the Exim user and is readable only by
46861 its owner. Every Exim process that start up GnuTLS reads the D-H
46862 parameters from this file. If the file does not exist, the first Exim process
46863 that needs it computes the data and writes it to a temporary file which is
46864 renamed once it is complete. It does not matter if several Exim processes do
46865 this simultaneously (apart from wasting a few resources). Once a file is in
46866 place, new Exim processes immediately start using it.
46869 For maximum security, the parameters that are stored in this file should be
46870 recalculated periodically, the frequency depending on your paranoia level.
46871 Arranging this is easy in principle; just delete the file when you want new
46872 values to be computed. However, there may be a problem. The calculation of new
46873 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
46874 If the system is not very active, <filename>/dev/random</filename> may delay returning data
46875 until enough randomness (entropy) is available. This may cause Exim to hang for
46876 a substantial amount of time, causing timeouts on incoming connections.
46879 The solution is to generate the parameters externally to Exim. They are stored
46880 in <filename>gnutls-params</filename> in PEM format, which means that they can be generated
46881 externally using the <command>certtool</command> command that is part of GnuTLS.
46884 To replace the parameters with new ones, instead of deleting the file
46885 and letting Exim re-create it, you can generate new parameters using
46886 <command>certtool</command> and, when this has been done, replace Exim’s cache file by
46887 renaming. The relevant commands are something like this:
46889 <literallayout class="monospaced">
46892 # chown exim:exim new-params
46893 # chmod 0400 new-params
46894 # certtool --generate-privkey --bits 512 >new-params
46895 # echo "" >>new-params
46896 # certtool --generate-dh-params --bits 1024 >> new-params
46897 # mv new-params gnutls-params
46900 If Exim never has to generate the parameters itself, the possibility of
46901 stalling is removed.
46904 <section id="SECTreqciphssl">
46905 <title>Requiring specific ciphers in OpenSSL</title>
46907 <indexterm role="concept">
46908 <primary>TLS</primary>
46909 <secondary>requiring specific ciphers (OpenSSL)</secondary>
46911 <indexterm role="option">
46912 <primary><option>tls_require_ciphers</option></primary>
46913 <secondary>OpenSSL</secondary>
46915 There is a function in the OpenSSL library that can be passed a list of cipher
46916 suites before the cipher negotiation takes place. This specifies which ciphers
46917 are acceptable. The list is colon separated and may contain names like
46918 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
46919 directly to this function call. The following quotation from the OpenSSL
46920 documentation specifies what forms of item are allowed in the cipher string:
46925 It can consist of a single cipher suite such as RC4-SHA.
46930 It can represent a list of cipher suites containing a certain algorithm,
46931 or cipher suites of a certain type. For example SHA1 represents all
46932 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
46938 Lists of cipher suites can be combined in a single cipher string using
46939 the + character. This is used as a logical and operation. For example
46940 SHA1+DES represents all cipher suites containing the SHA1 and the DES
46946 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
46947 <literal>-</literal> or <literal>+</literal>.
46952 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
46953 ciphers deleted can never reappear in the list even if they are explicitly
46959 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
46960 of the ciphers can be added again by later options.
46965 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
46966 option does not add any new ciphers; it just moves matching existing ones.
46971 If none of these characters is present, the string is interpreted as
46972 a list of ciphers to be appended to the current preference list. If the list
46973 includes any ciphers already present they will be ignored: that is, they will
46974 not be moved to the end of the list.
46977 <section id="SECTreqciphgnu">
46978 <title>Requiring specific ciphers or other parameters in GnuTLS</title>
46980 <indexterm role="concept">
46981 <primary>GnuTLS</primary>
46982 <secondary>specifying parameters for</secondary>
46984 <indexterm role="concept">
46985 <primary>TLS</primary>
46986 <secondary>specifying ciphers (GnuTLS)</secondary>
46988 <indexterm role="concept">
46989 <primary>TLS</primary>
46990 <secondary>specifying key exchange methods (GnuTLS)</secondary>
46992 <indexterm role="concept">
46993 <primary>TLS</primary>
46994 <secondary>specifying MAC algorithms (GnuTLS)</secondary>
46996 <indexterm role="concept">
46997 <primary>TLS</primary>
46998 <secondary>specifying protocols (GnuTLS)</secondary>
47000 <indexterm role="option">
47001 <primary><option>tls_require_ciphers</option></primary>
47002 <secondary>GnuTLS</secondary>
47004 The GnuTLS library allows the caller to specify separate lists of permitted key
47005 exchange methods, main cipher algorithms, MAC algorithms, and protocols.
47006 Unfortunately, these lists are numerical, and the library does not have a
47007 function for turning names into numbers. Consequently, lists of recognized
47008 names have to be built into the application. The permitted key exchange
47009 methods, ciphers, and MAC algorithms may be used in any combination to form a
47010 cipher suite. This is unlike OpenSSL, where complete cipher suite names are
47011 passed to its control function.
47014 For compatibility with OpenSSL, the <option>tls_require_ciphers</option> option can be set
47015 to complete cipher suite names such as RSA_ARCFOUR_SHA, but for GnuTLS this
47016 option controls only the cipher algorithms. Exim searches each item in the
47017 list for the name of an available algorithm. For example, if the list
47018 contains RSA_AES_SHA, then AES is recognized, and the behaviour is exactly
47019 the same as if just AES were given.
47022 <indexterm role="option">
47023 <primary><option>gnutls_require_kx</option></primary>
47025 <indexterm role="option">
47026 <primary><option>gnutls_require_mac</option></primary>
47028 <indexterm role="option">
47029 <primary><option>gnutls_require_protocols</option></primary>
47031 There are additional options called <option>gnutls_require_kx</option>,
47032 <option>gnutls_require_mac</option>, and <option>gnutls_require_protocols</option> that can be used to
47033 restrict the key exchange methods, MAC algorithms, and protocols, respectively.
47034 These options are ignored if OpenSSL is in use.
47037 All four options are available as global options, controlling how Exim
47038 behaves as a server, and also as options of the <command>smtp</command> transport, controlling
47039 how Exim behaves as a client. All the values are string expanded. After
47040 expansion, the values must be colon-separated lists, though the separator
47041 can be changed in the usual way.
47044 Each of the four lists starts out with a default set of algorithms. If the
47045 first item in a list does <emphasis>not</emphasis> start with an exclamation mark, all the
47046 default items are deleted. In this case, only those that are explicitly
47047 specified can be used. If the first item in a list <emphasis>does</emphasis> start with an
47048 exclamation mark, the defaults are left on the list.
47051 Then, any item that starts with an exclamation mark causes the relevant
47052 entry to be removed from the list, and any item that does not start with an
47053 exclamation mark causes a new entry to be added to the list. Unrecognized
47054 items in the list are ignored. Thus:
47056 <literallayout class="monospaced">
47057 tls_require_ciphers = !ARCFOUR
47060 allows all the defaults except ARCFOUR, whereas
47062 <literallayout class="monospaced">
47063 tls_require_ciphers = AES : 3DES
47066 allows only cipher suites that use AES or 3DES.
47069 For <option>tls_require_ciphers</option> the recognized names are AES_256, AES_128, AES
47070 (both of the preceding), 3DES, ARCFOUR_128, ARCFOUR_40, and ARCFOUR (both of
47071 the preceding). The default list does not contain all of these; it just has
47072 AES_256, AES_128, 3DES, and ARCFOUR_128.
47075 For <option>gnutls_require_kx</option>, the recognized names are DHE_RSA, RSA (which
47076 includes DHE_RSA), DHE_DSS, and DHE (which includes both DHE_RSA and
47077 DHE_DSS). The default list contains RSA, DHE_DSS, DHE_RSA.
47080 For <option>gnutls_require_mac</option>, the recognized names are SHA (synonym SHA1), and
47081 MD5. The default list contains SHA, MD5.
47084 For <option>gnutls_require_protocols</option>, the recognized names are TLS1 and SSL3.
47085 The default list contains TLS1, SSL3.
47088 In a server, the order of items in these lists is unimportant. The server
47089 advertises the availability of all the relevant cipher suites. However, in a
47090 client, the order in the <option>tls_require_ciphers</option> list specifies a preference
47091 order for the cipher algorithms. The first one in the client’s list that is
47092 also advertised by the server is tried first. The default order is as listed
47096 <section id="SECID182">
47097 <title>Configuring an Exim server to use TLS</title>
47099 <indexterm role="concept">
47100 <primary>TLS</primary>
47101 <secondary>configuring an Exim server</secondary>
47103 When Exim has been built with TLS support, it advertises the availability of
47104 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
47105 but not to any others. The default value of this option is unset, which means
47106 that STARTTLS is not advertised at all. This default is chosen because you
47107 need to set some other options in order to make TLS available, and also it is
47108 sensible for systems that want to use TLS only as a client.
47111 If a client issues a STARTTLS command and there is some configuration
47112 problem in the server, the command is rejected with a 454 error. If the client
47113 persists in trying to issue SMTP commands, all except QUIT are rejected
47116 <literallayout class="monospaced">
47117 554 Security failure
47120 If a STARTTLS command is issued within an existing TLS session, it is
47121 rejected with a 554 error code.
47124 To enable TLS operations on a server, you must set <option>tls_advertise_hosts</option> to
47125 match some hosts. You can, of course, set it to * to match all hosts.
47126 However, this is not all you need to do. TLS sessions to a server won’t work
47127 without some further configuration at the server end.
47130 It is rumoured that all existing clients that support TLS/SSL use RSA
47131 encryption. To make this work you need to set, in the server,
47133 <literallayout class="monospaced">
47134 tls_certificate = /some/file/name
47135 tls_privatekey = /some/file/name
47138 These options are, in fact, expanded strings, so you can make them depend on
47139 the identity of the client that is connected if you wish. The first file
47140 contains the server’s X509 certificate, and the second contains the private key
47141 that goes with it. These files need to be readable by the Exim user, and must
47142 always be given as full path names. They can be the same file if both the
47143 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
47144 set, or if its expansion is forced to fail or results in an empty string, this
47145 is assumed to be the case. The certificate file may also contain intermediate
47146 certificates that need to be sent to the client to enable it to authenticate
47147 the server’s certificate.
47150 If you do not understand about certificates and keys, please try to find a
47151 source of this background information, which is not Exim-specific. (There are a
47152 few comments below in section <xref linkend="SECTcerandall"/>.)
47155 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client –
47156 they apply only in the case of a server. If you need to use a certificate in an
47157 Exim client, you must set the options of the same names in an <command>smtp</command>
47161 With just these options, an Exim server will be able to use TLS. It does not
47162 require the client to have a certificate (but see below for how to insist on
47163 this). There is one other option that may be needed in other situations. If
47165 <literallayout class="monospaced">
47166 tls_dhparam = /some/file/name
47169 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
47170 with the parameters contained in the file. This increases the set of cipher
47171 suites that the server supports. See the command
47173 <literallayout class="monospaced">
47177 for a way of generating this data. At present, <option>tls_dhparam</option> is used only
47178 when Exim is linked with OpenSSL. It is ignored if GnuTLS is being used.
47181 The strings supplied for these three options are expanded every time a client
47182 host connects. It is therefore possible to use different certificates and keys
47183 for different hosts, if you so wish, by making use of the client’s IP address
47184 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
47185 forced to fail, Exim behaves as if the option is not set.
47188 <indexterm role="concept">
47189 <primary>cipher</primary>
47190 <secondary>logging</secondary>
47192 <indexterm role="concept">
47193 <primary>log</primary>
47194 <secondary>TLS cipher</secondary>
47196 <indexterm role="variable">
47197 <primary><varname>$tls_cipher</varname></primary>
47199 The variable <varname>$tls_cipher</varname> is set to the cipher suite that was negotiated for
47200 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
47201 incoming message (by default – you can, of course, change this), and it is
47202 also included in the log line that records a message’s arrival, keyed by
47203 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
47204 condition can be used to test for specific cipher suites in ACLs.
47205 (For outgoing SMTP deliveries, <varname>$tls_cipher</varname> is reset – see section
47206 <xref linkend="SECID185"/>.)
47209 Once TLS has been established, the ACLs that run for subsequent SMTP commands
47210 can check the name of the cipher suite and vary their actions accordingly. The
47211 cipher suite names vary, depending on which TLS library is being used. For
47212 example, OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other
47213 contexts is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL or GnuTLS
47214 documentation for more details.
47217 <section id="SECID183">
47218 <title>Requesting and verifying client certificates</title>
47220 <indexterm role="concept">
47221 <primary>certificate</primary>
47222 <secondary>verification of client</secondary>
47224 <indexterm role="concept">
47225 <primary>TLS</primary>
47226 <secondary>client certificate verification</secondary>
47228 If you want an Exim server to request a certificate when negotiating a TLS
47229 session with a client, you must set either <option>tls_verify_hosts</option> or
47230 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
47231 apply to all TLS connections. For any host that matches one of these options,
47232 Exim requests a certificate as part of the setup of the TLS session. The
47233 contents of the certificate are verified by comparing it with a list of
47234 expected certificates. These must be available in a file or,
47235 for OpenSSL only (not GnuTLS), a directory, identified by
47236 <option>tls_verify_certificates</option>.
47239 A file can contain multiple certificates, concatenated end to end. If a
47242 each certificate must be in a separate file, with a name (or a symbolic link)
47243 of the form <<emphasis>hash</emphasis>>.0, where <<emphasis>hash</emphasis>> is a hash value constructed from the
47244 certificate. You can compute the relevant hash by running the command
47246 <literallayout class="monospaced">
47247 openssl x509 -hash -noout -in /cert/file
47250 where <filename>/cert/file</filename> contains a single certificate.
47253 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
47254 what happens if the client does not supply a certificate, or if the certificate
47255 does not match any of the certificates in the collection named by
47256 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
47257 attempt to set up a TLS session is aborted, and the incoming connection is
47258 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
47259 session continues. ACLs that run for subsequent SMTP commands can detect the
47260 fact that no certificate was verified, and vary their actions accordingly. For
47261 example, you can insist on a certificate before accepting a message for
47262 relaying, but not when the message is destined for local delivery.
47265 <indexterm role="variable">
47266 <primary><varname>$tls_peerdn</varname></primary>
47268 When a client supplies a certificate (whether it verifies or not), the value of
47269 the Distinguished Name of the certificate is made available in the variable
47270 <varname>$tls_peerdn</varname> during subsequent processing of the message.
47273 <indexterm role="concept">
47274 <primary>log</primary>
47275 <secondary>distinguished name</secondary>
47277 Because it is often a long text string, it is not included in the log line or
47278 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
47279 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
47280 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
47281 certificate is supplied, <varname>$tls_peerdn</varname> is empty.
47284 <section id="SECID184">
47285 <title>Revoked certificates</title>
47287 <indexterm role="concept">
47288 <primary>TLS</primary>
47289 <secondary>revoked certificates</secondary>
47291 <indexterm role="concept">
47292 <primary>revocation list</primary>
47294 <indexterm role="concept">
47295 <primary>certificate</primary>
47296 <secondary>revocation list</secondary>
47298 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
47299 certificates are revoked. If you have such a list, you can pass it to an Exim
47300 server using the global option called <option>tls_crl</option> and to an Exim client using
47301 an identically named option for the <command>smtp</command> transport. In each case, the value
47302 of the option is expanded and must then be the name of a file that contains a
47306 <section id="SECID185">
47307 <title>Configuring an Exim client to use TLS</title>
47309 <indexterm role="concept">
47310 <primary>cipher</primary>
47311 <secondary>logging</secondary>
47313 <indexterm role="concept">
47314 <primary>log</primary>
47315 <secondary>TLS cipher</secondary>
47317 <indexterm role="concept">
47318 <primary>log</primary>
47319 <secondary>distinguished name</secondary>
47321 <indexterm role="concept">
47322 <primary>TLS</primary>
47323 <secondary>configuring an Exim client</secondary>
47325 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
47326 deliveries as well as to incoming, the latter one causing logging of the
47327 server certificate’s DN. The remaining client configuration for TLS is all
47328 within the <command>smtp</command> transport.
47331 It is not necessary to set any options to have TLS work in the <command>smtp</command>
47332 transport. If Exim is built with TLS support, and TLS is advertised by a
47333 server, the <command>smtp</command> transport always tries to start a TLS session. However,
47334 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
47335 transport) to a list of server hosts for which TLS should not be used.
47338 If you do not want Exim to attempt to send messages unencrypted when an attempt
47339 to set up an encrypted connection fails in any way, you can set
47340 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
47341 those hosts, delivery is always deferred if an encrypted connection cannot be
47342 set up. If there are any other hosts for the address, they are tried in the
47346 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
47347 the message unencrypted. It always does this if the response to STARTTLS is
47348 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
47349 session after a success response code, what happens is controlled by the
47350 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
47351 delivery to this host is deferred, and other hosts (if available) are tried. If
47352 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
47353 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
47354 negotiation fails, Exim closes the current connection (because it is in an
47355 unknown state), opens a new one to the same host, and then tries the delivery
47359 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
47360 transport provide the client with a certificate, which is passed to the server
47361 if it requests it. If the server is Exim, it will request a certificate only if
47362 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client.
47365 If the <option>tls_verify_certificates</option> option is set on the <command>smtp</command> transport, it
47366 must name a file or,
47367 for OpenSSL only (not GnuTLS), a directory, that contains a collection of
47368 expected server certificates. The client verifies the server’s certificate
47369 against this collection, taking into account any revoked certificates that are
47370 in the list defined by <option>tls_crl</option>.
47374 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
47375 list of permitted cipher suites. If either of these checks fails, delivery to
47376 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
47377 alternative hosts, if any.
47380 <emphasis role="bold">Note</emphasis>:
47381 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
47382 is operating as a client. Exim does not assume that a server certificate (set
47383 by the global options of the same name) should also be used when operating as a
47387 <indexterm role="variable">
47388 <primary><varname>$host</varname></primary>
47390 <indexterm role="variable">
47391 <primary><varname>$host_address</varname></primary>
47393 All the TLS options in the <command>smtp</command> transport are expanded before use, with
47394 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
47395 which the client is connected. Forced failure of an expansion causes Exim to
47396 behave as if the relevant option were unset.
47399 <indexterm role="variable">
47400 <primary><varname>$tls_cipher</varname></primary>
47402 <indexterm role="variable">
47403 <primary><varname>$tls_peerdn</varname></primary>
47405 Before an SMTP connection is established, the <varname>$tls_cipher</varname> and <varname>$tls_peerdn</varname>
47406 variables are emptied. (Until the first connection, they contain the values
47407 that were set when the message was received.) If STARTTLS is subsequently
47408 successfully obeyed, these variables are set to the relevant values for the
47409 outgoing connection.
47412 <section id="SECTmulmessam">
47413 <title>Multiple messages on the same encrypted TCP/IP connection</title>
47415 <indexterm role="concept">
47416 <primary>multiple SMTP deliveries with TLS</primary>
47418 <indexterm role="concept">
47419 <primary>TLS</primary>
47420 <secondary>multiple message deliveries</secondary>
47422 Exim sends multiple messages down the same TCP/IP connection by starting up
47423 an entirely new delivery process for each message, passing the socket from
47424 one process to the next. This implementation does not fit well with the use
47425 of TLS, because there is quite a lot of state information associated with a TLS
47426 connection, not just a socket identification. Passing all the state information
47427 to a new process is not feasible. Consequently, Exim shuts down an existing TLS
47428 session before passing the socket to a new process. The new process may then
47429 try to start a new TLS session, and if successful, may try to re-authenticate
47430 if AUTH is in use, before sending the next message.
47433 The RFC is not clear as to whether or not an SMTP session continues in clear
47434 after TLS has been shut down, or whether TLS may be restarted again later, as
47435 just described. However, if the server is Exim, this shutdown and
47436 reinitialization works. It is not known which (if any) other servers operate
47437 successfully if the client closes a TLS session and continues with unencrypted
47438 SMTP, but there are certainly some that do not work. For such servers, Exim
47439 should not pass the socket to another process, because the failure of the
47440 subsequent attempt to use it would cause Exim to record a temporary host error,
47441 and delay other deliveries to that host.
47444 To test for this case, Exim sends an EHLO command to the server after
47445 closing down the TLS session. If this fails in any way, the connection is
47446 closed instead of being passed to a new delivery process, but no retry
47447 information is recorded.
47450 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
47451 <command>smtp</command> transport to match those hosts for which Exim should not pass
47452 connections to new processes if TLS has been used.
47455 <section id="SECTcerandall">
47456 <title>Certificates and all that</title>
47458 <indexterm role="concept">
47459 <primary>certificate</primary>
47460 <secondary>references to discussion</secondary>
47462 In order to understand fully how TLS works, you need to know about
47463 certificates, certificate signing, and certificate authorities. This is not the
47464 place to give a tutorial, especially as I do not know very much about it
47465 myself. Some helpful introduction can be found in the FAQ for the SSL addition
47466 to Apache, currently at
47469 <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>
47472 Other parts of the <emphasis>modssl</emphasis> documentation are also helpful, and have
47473 links to further files.
47474 Eric Rescorla’s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
47475 0-201-61598-3), contains both introductory and more in-depth descriptions.
47476 Some sample programs taken from the book are available from
47479 <emphasis role="bold"><ulink url="http://www.rtfm.com/openssl-examples/">http://www.rtfm.com/openssl-examples/</ulink></emphasis>
47482 <section id="SECID186">
47483 <title>Certificate chains</title>
47485 The file named by <option>tls_certificate</option> may contain more than one
47486 certificate. This is useful in the case where the certificate that is being
47487 sent is validated by an intermediate certificate which the other end does
47488 not have. Multiple certificates must be in the correct order in the file.
47489 First the host’s certificate itself, then the first intermediate
47490 certificate to validate the issuer of the host certificate, then the next
47491 intermediate certificate to validate the issuer of the first intermediate
47492 certificate, and so on, until finally (optionally) the root certificate.
47493 The root certificate must already be trusted by the recipient for
47494 validation to succeed, of course, but if it’s not preinstalled, sending the
47495 root certificate along with the rest makes it available for the user to
47496 install if the receiving end is a client MUA that can interact with a user.
47499 <section id="SECID187">
47500 <title>Self-signed certificates</title>
47502 <indexterm role="concept">
47503 <primary>certificate</primary>
47504 <secondary>self-signed</secondary>
47506 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
47507 with OpenSSL, like this:
47509 <literallayout class="monospaced">
47510 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
47514 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
47515 delimited and so can be identified independently. The <option>-days</option> option
47516 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
47517 important: if you do not set it, the key is encrypted with a passphrase
47518 that you are prompted for, and any use that is made of the key causes more
47519 prompting for the passphrase. This is not helpful if you are going to use
47520 this certificate and key in an MTA, where prompting is not possible.
47523 A self-signed certificate made in this way is sufficient for testing, and
47524 may be adequate for all your requirements if you are mainly interested in
47525 encrypting transfers, and not in secure identification.
47528 However, many clients require that the certificate presented by the server be a
47529 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
47530 certificate. In this situation, the self-signed certificate described above
47531 must be installed on the client host as a trusted root <emphasis>certification
47532 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
47533 signed with that self-signed certificate.
47536 For information on creating self-signed CA certificates and using them to sign
47537 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
47538 Open-source PKI book, available online at
47539 <emphasis role="bold"><ulink url="http://ospkibook.sourceforge.net/">http://ospkibook.sourceforge.net/</ulink></emphasis>.
47540 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
47541 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
47546 <chapter id="CHAPACL">
47547 <title>Access control lists</title>
47549 <indexterm role="concept" id="IIDacl" class="startofrange">
47550 <primary>access control lists (ACLs)</primary>
47551 <secondary>description</secondary>
47553 <indexterm role="concept">
47554 <primary>control of incoming mail</primary>
47556 <indexterm role="concept">
47557 <primary>message</primary>
47558 <secondary>controlling incoming</secondary>
47560 <indexterm role="concept">
47561 <primary>policy control</primary>
47562 <secondary>access control lists</secondary>
47564 Access Control Lists (ACLs) are defined in a separate section of the run time
47565 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
47566 name, terminated by a colon. Here is a complete ACL section that contains just
47567 one very small ACL:
47569 <literallayout class="monospaced">
47572 accept hosts = one.host.only
47575 You can have as many lists as you like in the ACL section, and the order in
47576 which they appear does not matter. The lists are self-terminating.
47579 The majority of ACLs are used to control Exim’s behaviour when it receives
47580 certain SMTP commands. This applies both to incoming TCP/IP connections, and
47581 when a local process submits a message using SMTP by specifying the <option>-bs</option>
47582 option. The most common use is for controlling which recipients are accepted
47583 in incoming messages. In addition, you can define an ACL that is used to check
47584 local non-SMTP messages. The default configuration file contains an example of
47585 a realistic ACL for checking RCPT commands. This is discussed in chapter
47586 <xref linkend="CHAPdefconfil"/>.
47588 <section id="SECID188">
47589 <title>Testing ACLs</title>
47591 The <option>-bh</option> command line option provides a way of testing your ACL
47592 configuration locally by running a fake SMTP session with which you interact.
47593 The host <emphasis>relay-test.mail-abuse.org</emphasis> provides a service for checking your
47594 relaying configuration (see section <xref linkend="SECTcheralcon"/> for more details).
47597 <section id="SECID189">
47598 <title>Specifying when ACLs are used</title>
47600 <indexterm role="concept">
47601 <primary>access control lists (ACLs)</primary>
47602 <secondary>options for specifying</secondary>
47604 In order to cause an ACL to be used, you have to name it in one of the relevant
47605 options in the main part of the configuration. These options are:
47606 <indexterm role="concept">
47607 <primary>AUTH</primary>
47608 <secondary>ACL for</secondary>
47610 <indexterm role="concept">
47611 <primary>DATA</primary>
47612 <secondary>ACLs for</secondary>
47614 <indexterm role="concept">
47615 <primary>ETRN</primary>
47616 <secondary>ACL for</secondary>
47618 <indexterm role="concept">
47619 <primary>EXPN</primary>
47620 <secondary>ACL for</secondary>
47622 <indexterm role="concept">
47623 <primary>HELO</primary>
47624 <secondary>ACL for</secondary>
47626 <indexterm role="concept">
47627 <primary>EHLO</primary>
47628 <secondary>ACL for</secondary>
47630 <indexterm role="concept">
47631 <primary>MAIL</primary>
47632 <secondary>ACL for</secondary>
47634 <indexterm role="concept">
47635 <primary>QUIT, ACL for</primary>
47637 <indexterm role="concept">
47638 <primary>RCPT</primary>
47639 <secondary>ACL for</secondary>
47641 <indexterm role="concept">
47642 <primary>STARTTLS, ACL for</primary>
47644 <indexterm role="concept">
47645 <primary>VRFY</primary>
47646 <secondary>ACL for</secondary>
47648 <indexterm role="concept">
47649 <primary>SMTP</primary>
47650 <secondary>connection, ACL for</secondary>
47652 <indexterm role="concept">
47653 <primary>non-SMTP messages</primary>
47654 <secondary>ACLs for</secondary>
47656 <indexterm role="concept">
47657 <primary>MIME content scanning</primary>
47658 <secondary>ACL for</secondary>
47661 <informaltable frame="none">
47662 <tgroup cols="2" colsep="0" rowsep="0">
47663 <colspec colwidth="140pt" align="left"/>
47664 <colspec colwidth="254pt" align="left"/>
47667 <entry> <option>acl_not_smtp</option></entry>
47668 <entry>ACL for non-SMTP messages</entry>
47671 <entry> <option>acl_not_smtp_mime</option></entry>
47672 <entry>ACL for non-SMTP MIME parts</entry>
47675 <entry> <option>acl_not_smtp_start</option></entry>
47676 <entry>ACL at start of non-SMTP message</entry>
47679 <entry> <option>acl_smtp_auth</option></entry>
47680 <entry>ACL for AUTH</entry>
47683 <entry> <option>acl_smtp_connect</option></entry>
47684 <entry>ACL for start of SMTP connection</entry>
47687 <entry> <option>acl_smtp_data</option></entry>
47688 <entry>ACL after DATA is complete</entry>
47691 <entry> <option>acl_smtp_etrn</option></entry>
47692 <entry>ACL for ETRN</entry>
47695 <entry> <option>acl_smtp_expn</option></entry>
47696 <entry>ACL for EXPN</entry>
47699 <entry> <option>acl_smtp_helo</option></entry>
47700 <entry>ACL for HELO or EHLO</entry>
47703 <entry> <option>acl_smtp_mail</option></entry>
47704 <entry>ACL for MAIL</entry>
47707 <entry> <option>acl_smtp_mailauth</option></entry>
47708 <entry>ACL for the AUTH parameter of MAIL</entry>
47711 <entry> <option>acl_smtp_mime</option></entry>
47712 <entry>ACL for content-scanning MIME parts</entry>
47715 <entry> <option>acl_smtp_notquit</option></entry>
47716 <entry>ACL for non-QUIT terminations</entry>
47719 <entry> <option>acl_smtp_predata</option></entry>
47720 <entry>ACL at start of DATA command</entry>
47723 <entry> <option>acl_smtp_quit</option></entry>
47724 <entry>ACL for QUIT</entry>
47727 <entry> <option>acl_smtp_rcpt</option></entry>
47728 <entry>ACL for RCPT</entry>
47731 <entry> <option>acl_smtp_starttls</option></entry>
47732 <entry>ACL for STARTTLS</entry>
47735 <entry> <option>acl_smtp_vrfy</option></entry>
47736 <entry>ACL for VRFY</entry>
47742 For example, if you set
47744 <literallayout class="monospaced">
47745 acl_smtp_rcpt = small_acl
47748 the little ACL defined above is used whenever Exim receives a RCPT command
47749 in an SMTP dialogue. The majority of policy tests on incoming messages can be
47750 done when RCPT commands arrive. A rejection of RCPT should cause the
47751 sending MTA to give up on the recipient address contained in the RCPT
47752 command, whereas rejection at other times may cause the client MTA to keep on
47753 trying to deliver the message. It is therefore recommended that you do as much
47754 testing as possible at RCPT time.
47757 <section id="SECID190">
47758 <title>The non-SMTP ACLs</title>
47760 <indexterm role="concept">
47761 <primary>non-SMTP messages</primary>
47762 <secondary>ACLs for</secondary>
47764 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
47765 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
47766 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
47767 the state of the SMTP connection such as encryption and authentication) are not
47768 relevant and are forbidden in these ACLs. However, the sender and recipients
47769 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
47770 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
47771 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
47772 in any of these ACLs.
47775 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
47776 non-SMTP message, before any of the message has been read. (This is the
47777 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) In the case of
47778 batched SMTP input, it runs after the DATA command has been reached. The
47779 result of this ACL is ignored; it cannot be used to reject a message. If you
47780 really need to, you could set a value in an ACL variable here and reject based
47781 on that in the <option>acl_not_smtp</option> ACL. However, this ACL can be used to set
47782 controls, and in particular, it can be used to set
47784 <literallayout class="monospaced">
47785 control = suppress_local_fixups
47788 This cannot be used in the other non-SMTP ACLs because by the time they are
47789 run, it is too late.
47792 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
47793 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
47796 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
47797 kind of rejection is treated as permanent, because there is no way of sending a
47798 temporary error for these kinds of message.
47801 <section id="SECID191">
47802 <title>The SMTP connect ACL</title>
47804 <indexterm role="concept">
47805 <primary>SMTP</primary>
47806 <secondary>connection, ACL for</secondary>
47808 <indexterm role="option">
47809 <primary><option>smtp_banner</option></primary>
47811 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
47812 session, after the test specified by <option>host_reject_connection</option> (which is now
47813 an anomaly) and any TCP Wrappers testing (if configured). If the connection is
47814 accepted by an <option>accept</option> verb that has a <option>message</option> modifier, the contents of
47815 the message override the banner message that is otherwise specified by the
47816 <option>smtp_banner</option> option.
47819 <section id="SECID192">
47820 <title>The EHLO/HELO ACL</title>
47822 <indexterm role="concept">
47823 <primary>EHLO</primary>
47824 <secondary>ACL for</secondary>
47826 <indexterm role="concept">
47827 <primary>HELO</primary>
47828 <secondary>ACL for</secondary>
47830 The ACL test specified by <option>acl_smtp_helo</option> happens when the client issues an
47831 EHLO or HELO command, after the tests specified by <option>helo_accept_junk_hosts</option>,
47832 <option>helo_allow_chars</option>, <option>helo_verify_hosts</option>, and <option>helo_try_verify_hosts</option>.
47833 Note that a client may issue more than one EHLO or HELO command in an SMTP
47834 session, and indeed is required to issue a new EHLO or HELO after successfully
47835 setting up encryption following a STARTTLS command.
47838 If the command is accepted by an <option>accept</option> verb that has a <option>message</option>
47839 modifier, the message may not contain more than one line (it will be truncated
47840 at the first newline and a panic logged if it does). Such a message cannot
47841 affect the EHLO options that are listed on the second and subsequent lines of
47845 <section id="SECID193">
47846 <title>The DATA ACLs</title>
47848 <indexterm role="concept">
47849 <primary>DATA</primary>
47850 <secondary>ACLs for</secondary>
47852 Two ACLs are associated with the DATA command, because it is two-stage
47853 command, with two responses being sent to the client.
47854 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
47855 is obeyed. This gives you control after all the RCPT commands, but before
47856 the message itself is received. It offers the opportunity to give a negative
47857 response to the DATA command before the data is transmitted. Header lines
47858 added by MAIL or RCPT ACLs are not visible at this time, but any that
47859 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
47862 You cannot test the contents of the message, for example, to verify addresses
47863 in the headers, at RCPT time or when the DATA command is received. Such
47864 tests have to appear in the ACL that is run after the message itself has been
47865 received, before the final response to the DATA command is sent. This is
47866 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
47867 associated with the DATA command.
47870 For both of these ACLs, it is not possible to reject individual recipients. An
47871 error response rejects the entire message. Unfortunately, it is known that some
47872 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
47873 before or after the data) correctly – they keep the message on their queues
47874 and try again later, but that is their problem, though it does waste some of
47878 <section id="SECID194">
47879 <title>The SMTP MIME ACL</title>
47881 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
47882 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
47885 <section id="SECTQUITACL">
47886 <title>The QUIT ACL</title>
47888 <indexterm role="concept">
47889 <primary>QUIT, ACL for</primary>
47891 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
47892 does not affect the response code to QUIT, which is always 221. Thus, the ACL
47893 does not in fact control any access. For this reason, the only verbs that are
47894 permitted are <option>accept</option> and <option>warn</option>.
47897 This ACL can be used for tasks such as custom logging at the end of an SMTP
47898 session. For example, you can use ACL variables in other ACLs to count
47899 messages, recipients, etc., and log the totals at QUIT time using one or
47900 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
47903 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
47904 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
47907 You do not need to have a final <option>accept</option>, but if you do, you can use a
47908 <option>message</option> modifier to specify custom text that is sent as part of the 221
47912 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
47913 failure (for example, failure to open a log file, or when Exim is bombing out
47914 because it has detected an unrecoverable error), all SMTP commands from the
47915 client are given temporary error responses until QUIT is received or the
47916 connection is closed. In these special cases, the QUIT ACL does not run.
47919 <section id="SECTNOTQUITACL">
47920 <title>The not-QUIT ACL</title>
47922 <indexterm role="variable">
47923 <primary><varname>$acl_smtp_notquit</varname></primary>
47925 The not-QUIT ACL, specified by <option>acl_smtp_notquit</option>, is run in most cases when
47926 an SMTP session ends without sending QUIT. However, when Exim itself is is bad
47927 trouble, such as being unable to write to its log files, this ACL is not run,
47928 because it might try to do things (such as write to log files) that make the
47929 situation even worse.
47932 Like the QUIT ACL, this ACL is provided to make it possible to do customized
47933 logging or to gather statistics, and its outcome is ignored. The <option>delay</option>
47934 modifier is forbidden in this ACL, and the only permitted verbs are <option>accept</option>
47935 and <option>warn</option>.
47938 <indexterm role="variable">
47939 <primary><varname>$smtp_notquit_reason</varname></primary>
47941 When the not-QUIT ACL is running, the variable <varname>$smtp_notquit_reason</varname> is set
47942 to a string that indicates the reason for the termination of the SMTP
47943 connection. The possible values are:
47945 <informaltable frame="none">
47946 <tgroup cols="2" colsep="0" rowsep="0">
47947 <colspec colwidth="196pt" align="left"/>
47948 <colspec colwidth="254pt" align="left"/>
47951 <entry> <literal>acl-drop</literal></entry>
47952 <entry>Another ACL issued a <option>drop</option> command</entry>
47955 <entry> <literal>bad-commands</literal></entry>
47956 <entry>Too many unknown or non-mail commands</entry>
47959 <entry> <literal>command-timeout</literal></entry>
47960 <entry>Timeout while reading SMTP commands</entry>
47963 <entry> <literal>connection-lost</literal></entry>
47964 <entry>The SMTP connection has been lost</entry>
47967 <entry> <literal>data-timeout</literal></entry>
47968 <entry>Timeout while reading message data</entry>
47971 <entry> <literal>local-scan-error</literal></entry>
47972 <entry>The <function>local_scan()</function> function crashed</entry>
47975 <entry> <literal>local-scan-timeout</literal></entry>
47976 <entry>The <function>local_scan()</function> function timed out</entry>
47979 <entry> <literal>signal-exit</literal></entry>
47980 <entry>SIGTERM or SIGINT</entry>
47983 <entry> <literal>synchronization-error</literal></entry>
47984 <entry>SMTP synchronization error</entry>
47987 <entry> <literal>tls-failed</literal></entry>
47988 <entry>TLS failed to start</entry>
47994 In most cases when an SMTP connection is closed without having received QUIT,
47995 Exim sends an SMTP response message before actually closing the connection.
47996 With the exception of the <literal>acl-drop</literal> case, the default message can be
47997 overridden by the <option>message</option> modifier in the not-QUIT ACL. In the case of a
47998 <option>drop</option> verb in another ACL, it is the message from the other ACL that is
48002 <section id="SECID195">
48003 <title>Finding an ACL to use</title>
48005 <indexterm role="concept">
48006 <primary>access control lists (ACLs)</primary>
48007 <secondary>finding which to use</secondary>
48009 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
48010 you can use different ACLs in different circumstances. For example,
48012 <literallayout class="monospaced">
48013 acl_smtp_rcpt = ${if ={25}{$interface_port} \
48014 {acl_check_rcpt} {acl_check_rcpt_submit} }
48017 In the default configuration file there are some example settings for
48018 providing an RFC 4409 message submission service on port 587 and a
48019 non-standard <quote>smtps</quote> service on port 465. You can use a string
48020 expansion like this to choose an ACL for MUAs on these ports which is
48021 more appropriate for this purpose than the default ACL on port 25.
48024 The expanded string does not have to be the name of an ACL in the
48025 configuration file; there are other possibilities. Having expanded the
48026 string, Exim searches for an ACL as follows:
48031 If the string begins with a slash, Exim uses it as a file name, and reads its
48032 contents as an ACL. The lines are processed in the same way as lines in the
48033 Exim configuration file. In particular, continuation lines are supported, blank
48034 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
48035 If the file does not exist or cannot be read, an error occurs (typically
48036 causing a temporary failure of whatever caused the ACL to be run). For example:
48038 <literallayout class="monospaced">
48039 acl_smtp_data = /etc/acls/\
48040 ${lookup{$sender_host_address}lsearch\
48041 {/etc/acllist}{$value}{default}}
48044 This looks up an ACL file to use on the basis of the host’s IP address, falling
48045 back to a default if the lookup fails. If an ACL is successfully read from a
48046 file, it is retained in memory for the duration of the Exim process, so that it
48047 can be re-used without having to re-read the file.
48052 If the string does not start with a slash, and does not contain any spaces,
48053 Exim searches the ACL section of the configuration for an ACL whose name
48054 matches the string.
48059 If no named ACL is found, or if the string contains spaces, Exim parses
48060 the string as an inline ACL. This can save typing in cases where you just
48061 want to have something like
48063 <literallayout class="monospaced">
48064 acl_smtp_vrfy = accept
48067 in order to allow free use of the VRFY command. Such a string may contain
48068 newlines; it is processed in the same way as an ACL that is read from a file.
48073 <section id="SECID196">
48074 <title>ACL return codes</title>
48076 <indexterm role="concept">
48077 <primary>access control lists (ACLs)</primary>
48078 <secondary>return codes</secondary>
48080 Except for the QUIT ACL, which does not affect the SMTP return code (see
48081 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
48082 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
48083 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
48084 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
48085 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
48086 This also causes a 4<emphasis>xx</emphasis> return code.
48089 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
48090 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
48091 submitters of non-SMTP messages.
48094 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
48095 has the effect of <quote>accept</quote>, but causes either the entire message or an
48096 individual recipient address to be discarded. In other words, it is a
48097 blackholing facility. Use it with care.
48100 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
48101 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
48102 RCPT ACL is to discard just the one recipient address. If there are no
48103 recipients left when the message’s data is received, the DATA ACL is not
48104 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
48105 remaining recipients. The <quote>discard</quote> return is not permitted for the
48106 <option>acl_smtp_predata</option> ACL.
48109 <indexterm role="concept">
48110 <primary><function>local_scan()</function> function</primary>
48111 <secondary>when all recipients discarded</secondary>
48113 The <function>local_scan()</function> function is always run, even if there are no remaining
48114 recipients; it may create new recipients.
48117 <section id="SECID197">
48118 <title>Unset ACL options</title>
48120 <indexterm role="concept">
48121 <primary>access control lists (ACLs)</primary>
48122 <secondary>unset options</secondary>
48124 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
48125 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
48126 not defined at all. For any defined ACL, the default action when control
48127 reaches the end of the ACL statements is <quote>deny</quote>.
48130 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
48131 these two are ACLs that are used only for their side effects. They cannot be
48132 used to accept or reject anything.
48135 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
48136 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
48137 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
48138 when the ACL is not defined is <quote>accept</quote>.
48141 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
48142 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
48143 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
48144 messages over an SMTP connection. For an example, see the ACL in the default
48145 configuration file.
48148 <section id="SECID198">
48149 <title>Data for message ACLs</title>
48151 <indexterm role="concept">
48152 <primary>access control lists (ACLs)</primary>
48153 <secondary>data for message ACL</secondary>
48155 <indexterm role="variable">
48156 <primary><varname>$domain</varname></primary>
48158 <indexterm role="variable">
48159 <primary><varname>$local_part</varname></primary>
48161 <indexterm role="variable">
48162 <primary><varname>$sender_address</varname></primary>
48164 <indexterm role="variable">
48165 <primary><varname>$sender_host_address</varname></primary>
48167 <indexterm role="variable">
48168 <primary><varname>$smtp_command</varname></primary>
48170 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
48171 that contain information about the host and the message’s sender (for example,
48172 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
48173 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
48174 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
48175 is available in <varname>$smtp_command</varname>.
48178 When an ACL for the AUTH parameter of MAIL is running, the variables that
48179 contain information about the host are set, but <varname>$sender_address</varname> is not yet
48180 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
48184 <indexterm role="variable">
48185 <primary><varname>$message_size</varname></primary>
48187 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
48188 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
48189 that parameter is not given. The value is updated to the true message size by
48190 the time the final DATA ACL is run (after the message data has been
48194 <indexterm role="variable">
48195 <primary><varname>$rcpt_count</varname></primary>
48197 <indexterm role="variable">
48198 <primary><varname>$recipients_count</varname></primary>
48200 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
48201 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
48202 accepted, so while an ACL for RCPT is being processed, it contains the number
48203 of previously accepted recipients. At DATA time (for both the DATA ACLs),
48204 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
48205 <varname>$recipients_count</varname> contains the total number of accepted recipients.
48208 <section id="SECTdatfornon">
48209 <title>Data for non-message ACLs</title>
48211 <indexterm role="concept">
48212 <primary>access control lists (ACLs)</primary>
48213 <secondary>data for non-message ACL</secondary>
48215 <indexterm role="variable">
48216 <primary><varname>$smtp_command_argument</varname></primary>
48218 <indexterm role="variable">
48219 <primary><varname>$smtp_command</varname></primary>
48221 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
48222 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
48223 and the entire SMTP command is available in <varname>$smtp_command</varname>.
48224 These variables can be tested using a <option>condition</option> condition. For example,
48225 here is an ACL for use with AUTH, which insists that either the session is
48226 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
48227 does not permit authentication methods that use cleartext passwords on
48228 unencrypted connections.
48230 <literallayout class="monospaced">
48232 accept encrypted = *
48233 accept condition = ${if eq{${uc:$smtp_command_argument}}\
48235 deny message = TLS encryption or CRAM-MD5 required
48238 (Another way of applying this restriction is to arrange for the authenticators
48239 that use cleartext passwords not to be advertised when the connection is not
48240 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
48241 option to do this.)
48244 <section id="SECID199">
48245 <title>Format of an ACL</title>
48247 <indexterm role="concept">
48248 <primary>access control lists (ACLs)</primary>
48249 <secondary>format of</secondary>
48251 <indexterm role="concept">
48252 <primary>access control lists (ACLs)</primary>
48253 <secondary>verbs, definition of</secondary>
48255 An individual ACL consists of a number of statements. Each statement starts
48256 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
48257 Modifiers can change the way the verb operates, define error and log messages,
48258 set variables, insert delays, and vary the processing of accepted messages.
48261 If all the conditions are met, the verb is obeyed. The same condition may be
48262 used (with different arguments) more than once in the same statement. This
48263 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
48266 <literallayout class="monospaced">
48267 deny dnslists = list1.example
48268 dnslists = list2.example
48271 If there are no conditions, the verb is always obeyed. Exim stops evaluating
48272 the conditions and modifiers when it reaches a condition that fails. What
48273 happens then depends on the verb (and in one case, on a special modifier). Not
48274 all the conditions make sense at every testing point. For example, you cannot
48275 test a sender address in the ACL that is run for a VRFY command.
48278 <section id="SECID200">
48279 <title>ACL verbs</title>
48281 The ACL verbs are as follows:
48286 <indexterm role="concept">
48287 <primary><option>accept</option> ACL verb</primary>
48289 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
48290 of the conditions are not met, what happens depends on whether <option>endpass</option>
48291 appears among the conditions (for syntax see below). If the failing condition
48292 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
48293 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
48294 check a RCPT command:
48296 <literallayout class="monospaced">
48297 accept domains = +local_domains
48302 If the recipient domain does not match the <option>domains</option> condition, control
48303 passes to the next statement. If it does match, the recipient is verified, and
48304 the command is accepted if verification succeeds. However, if verification
48305 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
48306 <option>endpass</option>.
48309 The <option>endpass</option> feature has turned out to be confusing to many people, so its
48310 use is not recommended nowadays. It is always possible to rewrite an ACL so
48311 that <option>endpass</option> is not needed, and it is no longer used in the default
48315 <indexterm role="concept">
48316 <primary><option>message</option> ACL modifier</primary>
48317 <secondary>with <option>accept</option></secondary>
48319 If a <option>message</option> modifier appears on an <option>accept</option> statement, its action
48320 depends on whether or not <option>endpass</option> is present. In the absence of <option>endpass</option>
48321 (when an <option>accept</option> verb either accepts or passes control to the next
48322 statement), <option>message</option> can be used to vary the message that is sent when an
48323 SMTP command is accepted. For example, in a RCPT ACL you could have:
48326 <literal>accept </literal><<emphasis>some conditions</emphasis>>
48327 <literal> message = OK, I will allow you through today</literal>
48330 You can specify an SMTP response code, optionally followed by an <quote>extended
48331 response code</quote> at the start of the message, but the first digit must be the
48332 same as would be sent by default, which is 2 for an <option>accept</option> verb.
48335 If <option>endpass</option> is present in an <option>accept</option> statement, <option>message</option> specifies
48336 an error message that is used when access is denied. This behaviour is retained
48337 for backward compatibility, but current <quote>best practice</quote> is to avoid the use
48338 of <option>endpass</option>.
48343 <indexterm role="concept">
48344 <primary><option>defer</option> ACL verb</primary>
48346 <option>defer</option>: If all the conditions are true, the ACL returns <quote>defer</quote> which, in
48347 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
48348 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
48349 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
48350 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
48351 be used in any ACL, and even for a recipient it might be a simpler approach.
48356 <indexterm role="concept">
48357 <primary><option>deny</option> ACL verb</primary>
48359 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
48360 the conditions are not met, control is passed to the next ACL statement. For
48363 <literallayout class="monospaced">
48364 deny dnslists = blackholes.mail-abuse.org
48367 rejects commands from hosts that are on a DNS black list.
48372 <indexterm role="concept">
48373 <primary><option>discard</option> ACL verb</primary>
48375 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
48376 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
48377 that are concerned with receiving messages. When all the conditions are true,
48378 the sending entity receives a <quote>success</quote> response. However, <option>discard</option> causes
48379 recipients to be discarded. If it is used in an ACL for RCPT, just the one
48380 recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
48381 message’s recipients are discarded. Recipients that are discarded before DATA
48382 do not appear in the log line when the <option>received_recipients</option> log selector is set.
48385 If the <option>log_message</option> modifier is set when <option>discard</option> operates,
48386 its contents are added to the line that is automatically written to the log.
48387 The <option>message</option> modifier operates exactly as it does for <option>accept</option>.
48392 <indexterm role="concept">
48393 <primary><option>drop</option> ACL verb</primary>
48395 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
48396 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
48398 <literallayout class="monospaced">
48399 drop message = I don't take more than 20 RCPTs
48400 condition = ${if > {$rcpt_count}{20}}
48403 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
48404 The connection is always dropped after sending a 550 response.
48409 <indexterm role="concept">
48410 <primary><option>require</option> ACL verb</primary>
48412 <option>require</option>: If all the conditions are met, control is passed to the next ACL
48413 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
48414 example, when checking a RCPT command,
48416 <literallayout class="monospaced">
48417 require message = Sender did not verify
48421 passes control to subsequent statements only if the message’s sender can be
48422 verified. Otherwise, it rejects the command. Note the positioning of the
48423 <option>message</option> modifier, before the <option>verify</option> condition. The reason for this is
48424 discussed in section <xref linkend="SECTcondmodproc"/>.
48429 <indexterm role="concept">
48430 <primary><option>warn</option> ACL verb</primary>
48432 <option>warn</option>: If all the conditions are true, a line specified by the
48433 <option>log_message</option> modifier is written to Exim’s main log. Control always passes
48434 to the next ACL statement. If any condition is false, the log line is not
48435 written. If an identical log line is requested several times in the same
48436 message, only one copy is actually written to the log. If you want to force
48437 duplicates to be written, use the <option>logwrite</option> modifier instead.
48440 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
48441 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
48442 <option>logwrite</option>, and <option>add_header</option>) that appear before the first failing
48443 condition. There is more about adding header lines in section
48444 <xref linkend="SECTaddheadacl"/>.
48447 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
48448 some sort of defer), the log line specified by <option>log_message</option> is not written.
48449 This does not include the case of a forced failure from a lookup, which
48450 is considered to be a successful completion. After a defer, no further
48451 conditions or modifiers in the <option>warn</option> statement are processed. The incident
48452 is logged, and the ACL continues to be processed, from the next statement
48456 <indexterm role="variable">
48457 <primary><varname>$acl_verify_message</varname></primary>
48459 When one of the <option>warn</option> conditions is an address verification that fails, the
48460 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
48461 want this logged, you must set it up explicitly. For example:
48463 <literallayout class="monospaced">
48464 warn !verify = sender
48465 log_message = sender verify failed: $acl_verify_message
48470 At the end of each ACL there is an implicit unconditional <option>deny</option>.
48473 As you can see from the examples above, the conditions and modifiers are
48474 written one to a line, with the first one on the same line as the verb, and
48475 subsequent ones on following lines. If you have a very long condition, you can
48476 continue it onto several physical lines by the usual backslash continuation
48477 mechanism. It is conventional to align the conditions vertically.
48480 <section id="SECTaclvariables">
48481 <title>ACL variables</title>
48483 <indexterm role="concept">
48484 <primary>access control lists (ACLs)</primary>
48485 <secondary>variables</secondary>
48487 There are some special variables that can be set during ACL processing. They
48488 can be used to pass information between different ACLs, different invocations
48489 of the same ACL in the same SMTP connection, and between ACLs and the routers,
48490 transports, and filters that are used to deliver a message. The names of these
48491 variables must begin with <varname>$acl_c</varname> or <varname>$acl_m</varname>, followed either by a digit or
48492 an underscore, but the remainder of the name can be any sequence of
48493 alphanumeric characters and underscores that you choose. There is no limit on
48494 the number of ACL variables. The two sets act as follows:
48499 The values of those variables whose names begin with <varname>$acl_c</varname> persist
48500 throughout an SMTP connection. They are never reset. Thus, a value that is set
48501 while receiving one message is still available when receiving the next message
48502 on the same SMTP connection.
48507 The values of those variables whose names begin with <varname>$acl_m</varname> persist only
48508 while a message is being received. They are reset afterwards. They are also
48509 reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session.
48514 When a message is accepted, the current values of all the ACL variables are
48515 preserved with the message and are subsequently made available at delivery
48516 time. The ACL variables are set by a modifier called <option>set</option>. For example:
48518 <literallayout class="monospaced">
48519 accept hosts = whatever
48520 set acl_m4 = some value
48521 accept authenticated = *
48522 set acl_c_auth = yes
48525 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
48526 be set. If you want to set a variable without taking any action, you can use a
48527 <option>warn</option> verb without any other modifiers or conditions.
48530 <indexterm role="option">
48531 <primary><option>strict_acl_vars</option></primary>
48533 What happens if a syntactically valid but undefined ACL variable is
48534 referenced depends on the setting of the <option>strict_acl_vars</option> option. If it is
48535 false (the default), an empty string is substituted; if it is true, an
48536 error is generated.
48539 Versions of Exim before 4.64 have a limited set of numbered variables, but
48540 their names are compatible, so there is no problem with upgrading.
48543 <section id="SECTcondmodproc">
48544 <title>Condition and modifier processing</title>
48546 <indexterm role="concept">
48547 <primary>access control lists (ACLs)</primary>
48548 <secondary>conditions; processing</secondary>
48550 <indexterm role="concept">
48551 <primary>access control lists (ACLs)</primary>
48552 <secondary>modifiers; processing</secondary>
48554 An exclamation mark preceding a condition negates its result. For example:
48556 <literallayout class="monospaced">
48557 deny domains = *.dom.example
48558 !verify = recipient
48561 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
48562 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
48563 negation can be used on the right-hand side of a condition. For example, these
48564 two statements are equivalent:
48566 <literallayout class="monospaced">
48567 deny hosts = !192.168.3.4
48568 deny !hosts = 192.168.3.4
48571 However, for many conditions (<option>verify</option> being a good example), only left-hand
48572 side negation of the whole condition is possible.
48575 The arguments of conditions and modifiers are expanded. A forced failure
48576 of an expansion causes a condition to be ignored, that is, it behaves as if the
48577 condition is true. Consider these two statements:
48579 <literallayout class="monospaced">
48580 accept senders = ${lookup{$host_name}lsearch\
48581 {/some/file}{$value}fail}
48582 accept senders = ${lookup{$host_name}lsearch\
48583 {/some/file}{$value}{}}
48586 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
48587 the returned list is searched, but if the lookup fails the behaviour is
48588 different in the two cases. The <option>fail</option> in the first statement causes the
48589 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
48590 therefore succeeds. The second statement, however, generates an empty list when
48591 the lookup fails. No sender can match an empty list, so the condition fails,
48592 and therefore the <option>accept</option> also fails.
48595 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
48596 specify actions that are taken as the conditions for a statement are checked;
48597 others specify text for messages that are used when access is denied or a
48598 warning is generated. The <option>control</option> modifier affects the way an incoming
48599 message is handled.
48602 The positioning of the modifiers in an ACL statement important, because the
48603 processing of a verb ceases as soon as its outcome is known. Only those
48604 modifiers that have already been encountered will take effect. For example,
48605 consider this use of the <option>message</option> modifier:
48607 <literallayout class="monospaced">
48608 require message = Can't verify sender
48610 message = Can't verify recipient
48612 message = This message cannot be used
48615 If sender verification fails, Exim knows that the result of the statement is
48616 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
48617 so its text is used as the error message. If sender verification succeeds, but
48618 recipient verification fails, the second message is used. If recipient
48619 verification succeeds, the third message becomes <quote>current</quote>, but is never used
48620 because there are no more conditions to cause failure.
48623 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
48624 modifier that is used, because all the conditions must be true for rejection to
48625 happen. Specifying more than one <option>message</option> modifier does not make sense, and
48626 the message can even be specified after all the conditions. For example:
48628 <literallayout class="monospaced">
48630 !senders = *@my.domain.example
48631 message = Invalid sender from client host
48634 The <quote>deny</quote> result does not happen until the end of the statement is reached,
48635 by which time Exim has set up the message.
48638 <section id="SECTACLmodi">
48639 <title>ACL modifiers</title>
48641 <indexterm role="concept">
48642 <primary>access control lists (ACLs)</primary>
48643 <secondary>modifiers; list of</secondary>
48645 The ACL modifiers are as follows:
48649 <term><emphasis role="bold">add_header</emphasis> = <<emphasis>text</emphasis>></term>
48652 This modifier specifies one or more header lines that are to be added to an
48653 incoming message, assuming, of course, that the message is ultimately
48654 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
48656 </listitem></varlistentry>
48658 <term><emphasis role="bold">continue</emphasis> = <<emphasis>text</emphasis>></term>
48661 <indexterm role="concept">
48662 <primary><option>continue</option> ACL modifier</primary>
48664 <indexterm role="concept">
48665 <primary>database</primary>
48666 <secondary>updating in ACL</secondary>
48668 This modifier does nothing of itself, and processing of the ACL always
48669 continues with the next condition or modifier. The value of <option>continue</option> is in
48670 the side effects of expanding its argument. Typically this could be used to
48671 update a database. It is really just a syntactic tidiness, to avoid having to
48672 write rather ugly lines like this:
48675 <literal>condition = ${if eq{0}{</literal><<emphasis>some expansion</emphasis>><literal>}{true}{true}}</literal>
48678 Instead, all you need is
48681 <literal>continue = </literal><<emphasis>some expansion</emphasis>>
48683 </listitem></varlistentry>
48685 <term><emphasis role="bold">control</emphasis> = <<emphasis>text</emphasis>></term>
48688 <indexterm role="concept">
48689 <primary><option>control</option> ACL modifier</primary>
48691 This modifier affects the subsequent processing of the SMTP connection or of an
48692 incoming message that is accepted. The effect of the first type of control
48693 lasts for the duration of the connection, whereas the effect of the second type
48694 lasts only until the current message has been received. The message-specific
48695 controls always apply to the whole message, not to individual recipients,
48696 even if the <option>control</option> modifier appears in a RCPT ACL.
48699 As there are now quite a few controls that can be applied, they are described
48700 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
48701 in several different ways. For example:
48706 It can be at the end of an <option>accept</option> statement:
48708 <literallayout class="monospaced">
48709 accept ...some conditions
48710 control = queue_only
48713 In this case, the control is applied when this statement yields <quote>accept</quote>, in
48714 other words, when the conditions are all true.
48719 It can be in the middle of an <option>accept</option> statement:
48721 <literallayout class="monospaced">
48722 accept ...some conditions...
48723 control = queue_only
48724 ...some more conditions...
48727 If the first set of conditions are true, the control is applied, even if the
48728 statement does not accept because one of the second set of conditions is false.
48729 In this case, some subsequent statement must yield <quote>accept</quote> for the control
48735 It can be used with <option>warn</option> to apply the control, leaving the
48736 decision about accepting or denying to a subsequent verb. For
48739 <literallayout class="monospaced">
48740 warn ...some conditions...
48745 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
48746 <option>logwrite</option>, so it does not add anything to the message and does not write a
48752 If you want to apply a control unconditionally, you can use it with a
48753 <option>require</option> verb. For example:
48755 <literallayout class="monospaced">
48756 require control = no_multiline_responses
48760 </listitem></varlistentry>
48762 <term><emphasis role="bold">delay</emphasis> = <<emphasis>time</emphasis>></term>
48765 <indexterm role="concept">
48766 <primary><option>delay</option> ACL modifier</primary>
48768 <indexterm role="option">
48769 <primary><option>-bh</option></primary>
48771 This modifier may appear in any ACL. It causes Exim to wait for the time
48772 interval before proceeding. However, when testing Exim using the <option>-bh</option>
48773 option, the delay is not actually imposed (an appropriate message is output
48774 instead). The time is given in the usual Exim notation, and the delay happens
48775 as soon as the modifier is processed. In an SMTP session, pending output is
48776 flushed before the delay is imposed.
48779 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
48782 <literallayout class="monospaced">
48783 deny ...some conditions...
48787 The delay happens if all the conditions are true, before the statement returns
48788 <quote>deny</quote>. Compare this with:
48790 <literallayout class="monospaced">
48792 ...some conditions...
48795 which waits for 30s before processing the conditions. The <option>delay</option> modifier
48796 can also be used with <option>warn</option> and together with <option>control</option>:
48798 <literallayout class="monospaced">
48799 warn ...some conditions...
48805 If <option>delay</option> is encountered when the SMTP PIPELINING extension is in use,
48806 responses to several commands are no longer buffered and sent in one packet (as
48807 they would normally be) because all output is flushed before imposing the
48808 delay. This optimization is disabled so that a number of small delays do not
48809 appear to the client as one large aggregated delay that might provoke an
48810 unwanted timeout. You can, however, disable output flushing for <option>delay</option> by
48811 using a <option>control</option> modifier to set <option>no_delay_flush</option>.
48813 </listitem></varlistentry>
48815 <term><emphasis role="bold">endpass</emphasis></term>
48818 <indexterm role="concept">
48819 <primary><option>endpass</option> ACL modifier</primary>
48821 This modifier, which has no argument, is recognized only in <option>accept</option> and
48822 <option>discard</option> statements. It marks the boundary between the conditions whose
48823 failure causes control to pass to the next statement, and the conditions whose
48824 failure causes the ACL to return <quote>deny</quote>. This concept has proved to be
48825 confusing to some people, so the use of <option>endpass</option> is no longer recommended as
48826 <quote>best practice</quote>. See the description of <option>accept</option> above for more details.
48828 </listitem></varlistentry>
48830 <term><emphasis role="bold">log_message</emphasis> = <<emphasis>text</emphasis>></term>
48833 <indexterm role="concept">
48834 <primary><option>log_message</option> ACL modifier</primary>
48836 This modifier sets up a message that is used as part of the log message if the
48837 ACL denies access or a <option>warn</option> statement’s conditions are true. For example:
48839 <literallayout class="monospaced">
48840 require log_message = wrong cipher suite $tls_cipher
48841 encrypted = DES-CBC3-SHA
48844 <option>log_message</option> is also used when recipients are discarded by <option>discard</option>. For
48848 <literal>discard </literal><<emphasis>some conditions</emphasis>>
48849 <literal> log_message = Discarded $local_part@$domain because...</literal>
48852 When access is denied, <option>log_message</option> adds to any underlying error message
48853 that may exist because of a condition failure. For example, while verifying a
48854 recipient address, a <emphasis>:fail:</emphasis> redirection might have already set up a
48858 The message may be defined before the conditions to which it applies, because
48859 the string expansion does not happen until Exim decides that access is to be
48860 denied. This means that any variables that are set by the condition are
48861 available for inclusion in the message. For example, the <varname>$dnslist_</varname><<emphasis>xxx</emphasis>>
48862 variables are set after a DNS black list lookup succeeds. If the expansion of
48863 <option>log_message</option> fails, or if the result is an empty string, the modifier is
48867 <indexterm role="variable">
48868 <primary><varname>$acl_verify_message</varname></primary>
48870 If you want to use a <option>warn</option> statement to log the result of an address
48871 verification, you can use <varname>$acl_verify_message</varname> to include the verification
48875 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
48876 the start of the logged message. If the same warning log message is requested
48877 more than once while receiving a single email message, only one copy is
48878 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
48879 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
48880 is logged for a successful <option>warn</option> statement.
48883 If <option>log_message</option> is not present and there is no underlying error message (for
48884 example, from the failure of address verification), but <option>message</option> is present,
48885 the <option>message</option> text is used for logging rejections. However, if any text for
48886 logging contains newlines, only the first line is logged. In the absence of
48887 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
48888 logging rejections.
48890 </listitem></varlistentry>
48892 <term><emphasis role="bold">log_reject_target</emphasis> = <<emphasis>log name list</emphasis>></term>
48895 <indexterm role="concept">
48896 <primary><option>log_reject_target</option> ACL modifier</primary>
48898 <indexterm role="concept">
48899 <primary>logging in ACL</primary>
48900 <secondary>specifying which log</secondary>
48902 This modifier makes it possible to specify which logs are used for messages
48903 about ACL rejections. Its argument is a colon-separated list of words that can
48904 be <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote>. The default is <literal>main:reject</literal>. The list
48905 may be empty, in which case a rejection is not logged at all. For example, this
48906 ACL fragment writes no logging information when access is denied:
48909 <literal>deny </literal><<emphasis>some conditions</emphasis>>
48910 <literal> log_reject_target =</literal>
48913 This modifier can be used in SMTP and non-SMTP ACLs. It applies to both
48914 permanent and temporary rejections. Its effect lasts for the rest of the
48917 </listitem></varlistentry>
48919 <term><emphasis role="bold">logwrite</emphasis> = <<emphasis>text</emphasis>></term>
48922 <indexterm role="concept">
48923 <primary><option>logwrite</option> ACL modifier</primary>
48925 <indexterm role="concept">
48926 <primary>logging in ACL</primary>
48927 <secondary>immediate</secondary>
48929 This modifier writes a message to a log file as soon as it is encountered when
48930 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
48931 <option>warn</option> and <option>discard</option>, is used only if the ACL statement denies
48932 access.) The <option>logwrite</option> modifier can be used to log special incidents in
48936 <literal>accept </literal><<emphasis>some special conditions</emphasis>>
48937 <literal> control = freeze</literal>
48938 <literal> logwrite = froze message because ...</literal>
48941 By default, the message is written to the main log. However, it may begin
48942 with a colon, followed by a comma-separated list of log names, and then
48943 another colon, to specify exactly which logs are to be written. For
48946 <literallayout class="monospaced">
48947 logwrite = :main,reject: text for main and reject logs
48948 logwrite = :panic: text for panic log only
48950 </listitem></varlistentry>
48952 <term><emphasis role="bold">message</emphasis> = <<emphasis>text</emphasis>></term>
48955 <indexterm role="concept">
48956 <primary><option>message</option> ACL modifier</primary>
48958 This modifier sets up a text string that is expanded and used as a response
48959 message when an ACL statement terminates the ACL with an <quote>accept</quote>, <quote>deny</quote>,
48960 or <quote>defer</quote> response. (In the case of the <option>accept</option> and <option>discard</option> verbs,
48961 there is some complication if <option>endpass</option> is involved; see the description of
48962 <option>accept</option> for details.)
48965 The expansion of the message happens at the time Exim decides that the ACL is
48966 to end, not at the time it processes <option>message</option>. If the expansion fails, or
48967 generates an empty string, the modifier is ignored. Here is an example where
48968 <option>message</option> must be specified first, because the ACL ends with a rejection if
48969 the <option>hosts</option> condition fails:
48971 <literallayout class="monospaced">
48972 require message = Host not recognized
48976 (Once a condition has failed, no further conditions or modifiers are
48980 <indexterm role="concept">
48981 <primary>SMTP</primary>
48982 <secondary>error codes</secondary>
48984 <indexterm role="option">
48985 <primary><option>smtp_banner</option></primary>
48987 For ACLs that are triggered by SMTP commands, the message is returned as part
48988 of the SMTP response. The use of <option>message</option> with <option>accept</option> (or <option>discard</option>)
48989 is meaningful only for SMTP, as no message is returned when a non-SMTP message
48990 is accepted. In the case of the connect ACL, accepting with a message modifier
48991 overrides the value of <option>smtp_banner</option>. For the EHLO/HELO ACL, a customized
48992 accept message may not contain more than one line (otherwise it will be
48993 truncated at the first newline and a panic logged), and it cannot affect the
48997 When SMTP is involved, the message may begin with an overriding response code,
48998 consisting of three digits optionally followed by an <quote>extended response code</quote>
48999 of the form <emphasis>n.n.n</emphasis>, each code being followed by a space. For example:
49001 <literallayout class="monospaced">
49002 deny message = 599 1.2.3 Host not welcome
49003 hosts = 192.168.34.0/24
49006 The first digit of the supplied response code must be the same as would be sent
49007 by default. A panic occurs if it is not. Exim uses a 550 code when it denies
49008 access, but for the predata ACL, note that the default success code is 354, not
49009 2<emphasis>xx</emphasis>.
49012 Notwithstanding the previous paragraph, for the QUIT ACL, unlike the others,
49013 the message modifier cannot override the 221 response code.
49016 The text in a <option>message</option> modifier is literal; any quotes are taken as
49017 literals, but because the string is expanded, backslash escapes are processed
49018 anyway. If the message contains newlines, this gives rise to a multi-line SMTP
49022 <indexterm role="variable">
49023 <primary><varname>$acl_verify_message</varname></primary>
49025 If <option>message</option> is used on a statement that verifies an address, the message
49026 specified overrides any message that is generated by the verification process.
49027 However, the original message is available in the variable
49028 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
49029 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
49030 routers to be passed back as part of the SMTP response, you should either not
49031 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
49034 For compatibility with previous releases of Exim, a <option>message</option> modifier that
49035 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
49036 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
49037 all the conditions are true, wherever it appears in an ACL command, whereas
49038 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
49039 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
49042 </listitem></varlistentry>
49044 <term><emphasis role="bold">set</emphasis> <<emphasis>acl_name</emphasis>> = <<emphasis>value</emphasis>></term>
49047 <indexterm role="concept">
49048 <primary><option>set</option> ACL modifier</primary>
49050 This modifier puts a value into one of the ACL variables (see section
49051 <xref linkend="SECTaclvariables"/>).
49053 </listitem></varlistentry>
49056 <section id="SECTcontrols">
49057 <title>Use of the control modifier</title>
49059 <indexterm role="concept">
49060 <primary><option>control</option> ACL modifier</primary>
49062 The <option>control</option> modifier supports the following settings:
49066 <term><emphasis role="bold">control = allow_auth_unadvertised</emphasis></term>
49069 This modifier allows a client host to use the SMTP AUTH command even when it
49070 has not been advertised in response to EHLO. Furthermore, because there are
49071 apparently some really broken clients that do this, Exim will accept AUTH after
49072 HELO (rather than EHLO) when this control is set. It should be used only if you
49073 really need it, and you should limit its use to those broken clients that do
49074 not work without it. For example:
49076 <literallayout class="monospaced">
49077 warn hosts = 192.168.34.25
49078 control = allow_auth_unadvertised
49081 Normally, when an Exim server receives an AUTH command, it checks the name of
49082 the authentication mechanism that is given in the command to ensure that it
49083 matches an advertised mechanism. When this control is set, the check that a
49084 mechanism has been advertised is bypassed. Any configured mechanism can be used
49085 by the client. This control is permitted only in the connection and HELO ACLs.
49087 </listitem></varlistentry>
49089 <term><emphasis role="bold">control = caseful_local_part</emphasis></term>
49090 <term><emphasis role="bold">control = caselower_local_part</emphasis></term>
49093 <indexterm role="concept">
49094 <primary>access control lists (ACLs)</primary>
49095 <secondary>case of local part in</secondary>
49097 <indexterm role="concept">
49098 <primary>case of local parts</primary>
49100 <indexterm role="variable">
49101 <primary><varname>$local_part</varname></primary>
49103 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
49104 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
49105 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
49106 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
49107 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
49111 These controls affect only the current recipient. Moreover, they apply only to
49112 local part handling that takes place directly in the ACL (for example, as a key
49113 in lookups). If a test to verify the recipient is obeyed, the case-related
49114 handling of the local part during the verification is controlled by the router
49115 configuration (see the <option>caseful_local_part</option> generic router option).
49118 This facility could be used, for example, to add a spam score to local parts
49119 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
49122 <literallayout class="monospaced">
49123 warn control = caseful_local_part
49124 set acl_m4 = ${eval:\
49126 ${if match{$local_part}{[A-Z]}{1}{0}}\
49128 control = caselower_local_part
49131 Notice that we put back the lower cased version afterwards, assuming that
49132 is what is wanted for subsequent tests.
49134 </listitem></varlistentry>
49136 <term><emphasis role="bold">control = debug/</emphasis><<emphasis>options</emphasis>></term>
49139 <indexterm role="concept">
49140 <primary>access control lists (ACLs)</primary>
49141 <secondary>enabling debug logging</secondary>
49143 <indexterm role="concept">
49144 <primary>debugging</primary>
49145 <secondary>enabling from an ACL</secondary>
49147 This control turns on debug logging, almost as though Exim had been invoked
49148 with <literal>-d</literal>, with the output going to a new logfile, by default called
49149 <emphasis>debuglog</emphasis>. The filename can be adjusted with the <emphasis>tag</emphasis> option, which
49150 may access any variables already defined. The logging may be adjusted with
49151 the <emphasis>opts</emphasis> option, which takes the same values as the <literal>-d</literal> command-line
49152 option. Some examples (which depend on variables that don’t exist in all
49155 <literallayout class="monospaced">
49157 control = debug/tag=.$sender_host_address
49158 control = debug/opts=+expand+acl
49159 control = debug/tag=.$message_exim_id/opts=+expand
49161 </listitem></varlistentry>
49163 <term><emphasis role="bold">control = enforce_sync</emphasis></term>
49164 <term><emphasis role="bold">control = no_enforce_sync</emphasis></term>
49167 <indexterm role="concept">
49168 <primary>SMTP</primary>
49169 <secondary>synchronization checking</secondary>
49171 <indexterm role="concept">
49172 <primary>synchronization checking in SMTP</primary>
49174 These controls make it possible to be selective about when SMTP synchronization
49175 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
49176 state of the switch (it is true by default). See the description of this option
49177 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
49180 The effect of these two controls lasts for the remainder of the SMTP
49181 connection. They can appear in any ACL except the one for the non-SMTP
49182 messages. The most straightforward place to put them is in the ACL defined by
49183 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
49184 before the first synchronization check. The expected use is to turn off the
49185 synchronization checks for badly-behaved hosts that you nevertheless need to
49188 </listitem></varlistentry>
49190 <term><emphasis role="bold">control = fakedefer/</emphasis><<emphasis>message</emphasis>></term>
49193 <indexterm role="concept">
49194 <primary>fake defer</primary>
49196 <indexterm role="concept">
49197 <primary>defer, fake</primary>
49199 This control works in exactly the same way as <option>fakereject</option> (described below)
49200 except that it causes an SMTP 450 response after the message data instead of a
49201 550 response. You must take care when using <option>fakedefer</option> because it causes the
49202 messages to be duplicated when the sender retries. Therefore, you should not
49203 use <option>fakedefer</option> if the message is to be delivered normally.
49205 </listitem></varlistentry>
49207 <term><emphasis role="bold">control = fakereject/</emphasis><<emphasis>message</emphasis>></term>
49210 <indexterm role="concept">
49211 <primary>fake rejection</primary>
49213 <indexterm role="concept">
49214 <primary>rejection, fake</primary>
49216 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
49217 words, only when an SMTP message is being received. If Exim accepts the
49218 message, instead the final 250 response, a 550 rejection message is sent.
49219 However, Exim proceeds to deliver the message as normal. The control applies
49220 only to the current message, not to any subsequent ones that may be received in
49221 the same SMTP connection.
49224 The text for the 550 response is taken from the <option>control</option> modifier. If no
49225 message is supplied, the following is used:
49227 <literallayout class="monospaced">
49228 550-Your message has been rejected but is being
49229 550-kept for evaluation.
49230 550-If it was a legitimate message, it may still be
49231 550 delivered to the target recipient(s).
49234 This facility should be used with extreme caution.
49236 </listitem></varlistentry>
49238 <term><emphasis role="bold">control = freeze</emphasis></term>
49241 <indexterm role="concept">
49242 <primary>frozen messages</primary>
49243 <secondary>forcing in ACL</secondary>
49245 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
49246 other words, only when a message is being received. If the message is accepted,
49247 it is placed on Exim’s queue and frozen. The control applies only to the
49248 current message, not to any subsequent ones that may be received in the same
49252 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
49253 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
49254 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
49255 are obeyed for the current message have the <literal>/no_tell</literal> option.
49257 </listitem></varlistentry>
49259 <term><emphasis role="bold">control = no_delay_flush</emphasis></term>
49262 <indexterm role="concept">
49263 <primary>SMTP</primary>
49264 <secondary>output flushing, disabling for delay</secondary>
49266 Exim normally flushes SMTP output before implementing a delay in an ACL, to
49267 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
49268 use. This control, as long as it is encountered before the <option>delay</option> modifier,
49269 disables such output flushing.
49271 </listitem></varlistentry>
49273 <term><emphasis role="bold">control = no_callout_flush</emphasis></term>
49276 <indexterm role="concept">
49277 <primary>SMTP</primary>
49278 <secondary>output flushing, disabling for callout</secondary>
49280 Exim normally flushes SMTP output before performing a callout in an ACL, to
49281 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
49282 use. This control, as long as it is encountered before the <option>verify</option> condition
49283 that causes the callout, disables such output flushing.
49285 </listitem></varlistentry>
49287 <term><emphasis role="bold">control = no_mbox_unspool</emphasis></term>
49290 This control is available when Exim is compiled with the content scanning
49291 extension. Content scanning may require a copy of the current message, or parts
49292 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
49293 or spam scanner. Normally, such copies are deleted when they are no longer
49294 needed. If this control is set, the copies are not deleted. The control applies
49295 only to the current message, not to any subsequent ones that may be received in
49296 the same SMTP connection. It is provided for debugging purposes and is unlikely
49297 to be useful in production.
49299 </listitem></varlistentry>
49301 <term><emphasis role="bold">control = no_multiline_responses</emphasis></term>
49304 <indexterm role="concept">
49305 <primary>multiline responses, suppressing</primary>
49307 This control is permitted for any ACL except the one for non-SMTP messages.
49308 It seems that there are broken clients in use that cannot handle multiline
49309 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
49312 If this control is set, multiline SMTP responses from ACL rejections are
49313 suppressed. One way of doing this would have been to put out these responses as
49314 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
49315 (<quote>use multiline responses for more</quote> it says – ha!), and some of the
49316 responses might get close to that. So this facility, which is after all only a
49317 sop to broken clients, is implemented by doing two very easy things:
49322 Extra information that is normally output as part of a rejection caused by
49323 sender verification failure is omitted. Only the final line (typically <quote>sender
49324 verification failed</quote>) is sent.
49329 If a <option>message</option> modifier supplies a multiline response, only the first
49335 The setting of the switch can, of course, be made conditional on the
49336 calling host. Its effect lasts until the end of the SMTP connection.
49338 </listitem></varlistentry>
49340 <term><emphasis role="bold">control = no_pipelining</emphasis></term>
49343 <indexterm role="concept">
49344 <primary>PIPELINING</primary>
49345 <secondary>suppressing advertising</secondary>
49347 This control turns off the advertising of the PIPELINING extension to SMTP in
49348 the current session. To be useful, it must be obeyed before Exim sends its
49349 response to an EHLO command. Therefore, it should normally appear in an ACL
49350 controlled by <option>acl_smtp_connect</option> or <option>acl_smtp_helo</option>. See also
49351 <option>pipelining_advertise_hosts</option>.
49353 </listitem></varlistentry>
49355 <term><emphasis role="bold">control = queue_only</emphasis></term>
49358 <indexterm role="option">
49359 <primary><option>queue_only</option></primary>
49361 <indexterm role="concept">
49362 <primary>queueing incoming messages</primary>
49364 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
49365 other words, only when a message is being received. If the message is accepted,
49366 it is placed on Exim’s queue and left there for delivery by a subsequent queue
49367 runner. No immediate delivery process is started. In other words, it has the
49368 effect as the <option>queue_only</option> global option. However, the control applies only
49369 to the current message, not to any subsequent ones that may be received in the
49370 same SMTP connection.
49372 </listitem></varlistentry>
49374 <term><emphasis role="bold">control = submission/</emphasis><<emphasis>options</emphasis>></term>
49377 <indexterm role="concept">
49378 <primary>message</primary>
49379 <secondary>submission</secondary>
49381 <indexterm role="concept">
49382 <primary>submission mode</primary>
49384 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
49385 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
49386 the current message is a submission from a local MUA. In this case, Exim
49387 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
49388 necessary. For example, it adds a <emphasis>Date:</emphasis> header line if one is not present.
49389 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
49390 late (the message has already been created).
49393 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
49394 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
49395 submission mode; the available options for this control are described there.
49396 The control applies only to the current message, not to any subsequent ones
49397 that may be received in the same SMTP connection.
49399 </listitem></varlistentry>
49401 <term><emphasis role="bold">control = suppress_local_fixups</emphasis></term>
49404 <indexterm role="concept">
49405 <primary>submission fixups, suppressing</primary>
49407 This control applies to locally submitted (non TCP/IP) messages, and is the
49408 complement of <literal>control = submission</literal>. It disables the fixups that are
49409 normally applied to locally-submitted messages. Specifically:
49414 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
49415 dynamic version of <option>local_sender_retain</option>).
49420 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
49425 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
49430 This control may be useful when a remotely-originated message is accepted,
49431 passed to some scanning program, and then re-submitted for delivery. It can be
49432 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
49433 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message’s
49437 <emphasis role="bold">Note:</emphasis> This control applies only to the current message, not to any others
49438 that are being submitted at the same time using <option>-bs</option> or <option>-bS</option>.
49440 </listitem></varlistentry>
49443 <section id="SECTsummesfix">
49444 <title>Summary of message fixup control</title>
49446 All four possibilities for message fixups can be specified:
49451 Locally submitted, fixups applied: the default.
49456 Locally submitted, no fixups applied: use
49457 <literal>control = suppress_local_fixups</literal>.
49462 Remotely submitted, no fixups applied: the default.
49467 Remotely submitted, fixups applied: use <literal>control = submission</literal>.
49472 <section id="SECTaddheadacl">
49473 <title>Adding header lines in ACLs</title>
49475 <indexterm role="concept">
49476 <primary>header lines</primary>
49477 <secondary>adding in an ACL</secondary>
49479 <indexterm role="concept">
49480 <primary>header lines</primary>
49481 <secondary>position of added lines</secondary>
49483 <indexterm role="concept">
49484 <primary><option>message</option> ACL modifier</primary>
49486 The <option>add_header</option> modifier can be used to add one or more extra header lines
49487 to an incoming message, as in this example:
49489 <literallayout class="monospaced">
49490 warn dnslists = sbl.spamhaus.org : \
49491 dialup.mail-abuse.org
49492 add_header = X-blacklisted-at: $dnslist_domain
49495 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
49496 MIME, and non-SMTP ACLs (in other words, those that are concerned with
49497 receiving a message). The message must ultimately be accepted for
49498 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
49499 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
49503 If the data for the <option>add_header</option> modifier contains one or more newlines that
49504 are not followed by a space or a tab, it is assumed to contain multiple header
49505 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
49506 front of any line that is not a valid header line.
49509 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
49510 They are added to the message before processing the DATA and MIME ACLs.
49511 However, if an identical header line is requested more than once, only one copy
49512 is actually added to the message. Further header lines may be accumulated
49513 during the DATA and MIME ACLs, after which they are added to the message, again
49514 with duplicates suppressed. Thus, it is possible to add two identical header
49515 lines to an SMTP message, but only if one is added before DATA and one after.
49516 In the case of non-SMTP messages, new headers are accumulated during the
49517 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
49518 message is rejected after DATA or by the non-SMTP ACL, all added header lines
49519 are included in the entry that is written to the reject log.
49522 <indexterm role="concept">
49523 <primary>header lines</primary>
49524 <secondary>added; visibility of</secondary>
49526 Header lines are not visible in string expansions until they are added to the
49527 message. It follows that header lines defined in the MAIL, RCPT, and predata
49528 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
49529 header lines that are added by the DATA or MIME ACLs are not visible in those
49530 ACLs. Because of this restriction, you cannot use header lines as a way of
49531 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
49532 this, you can use ACL variables, as described in section
49533 <xref linkend="SECTaclvariables"/>.
49536 The <option>add_header</option> modifier acts immediately it is encountered during the
49537 processing of an ACL. Notice the difference between these two cases:
49540 <literal>accept add_header = ADDED: some text</literal>
49541 <literal> </literal><<emphasis>some condition</emphasis>>
49543 <literal>accept </literal><<emphasis>some condition</emphasis>>
49544 <literal> add_header = ADDED: some text</literal>
49547 In the first case, the header line is always added, whether or not the
49548 condition is true. In the second case, the header line is added only if the
49549 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
49550 ACL statement. All those that are encountered before a condition fails are
49554 <indexterm role="concept">
49555 <primary><option>warn</option> ACL verb</primary>
49557 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
49558 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
49559 effect only if all the conditions are true, even if it appears before some of
49560 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
49561 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
49562 are present on a <option>warn</option> verb, both are processed according to their
49566 By default, new header lines are added to a message at the end of the existing
49567 header lines. However, you can specify that any particular header line should
49568 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
49569 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
49570 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
49573 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
49574 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
49575 header line, respectively. (Header text cannot start with a colon, as there has
49576 to be a header name first.) For example:
49578 <literallayout class="monospaced">
49579 warn add_header = \
49580 :after_received:X-My-Header: something or other...
49583 If more than one header line is supplied in a single <option>add_header</option> modifier,
49584 each one is treated independently and can therefore be placed differently. If
49585 you add more than one line at the start, or after the Received: block, they end
49586 up in reverse order.
49589 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
49590 added in an ACL. It does NOT work for header lines that are added in a
49591 system filter or in a router or transport.
49594 <section id="SECTaclconditions">
49595 <title>ACL conditions</title>
49597 <indexterm role="concept">
49598 <primary>access control lists (ACLs)</primary>
49599 <secondary>conditions; list of</secondary>
49601 Some of conditions listed in this section are available only when Exim is
49602 compiled with the content-scanning extension. They are included here briefly
49603 for completeness. More detailed descriptions can be found in the discussion on
49604 content scanning in chapter <xref linkend="CHAPexiscan"/>.
49607 Not all conditions are relevant in all circumstances. For example, testing
49608 senders and recipients does not make sense in an ACL that is being run as the
49609 result of the arrival of an ETRN command, and checks on message headers can be
49610 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
49611 can use the same condition (with different parameters) more than once in the
49612 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
49613 The conditions are as follows:
49617 <term><emphasis role="bold">acl = </emphasis><<emphasis>name of acl or ACL string or file name </emphasis>></term>
49620 <indexterm role="concept">
49621 <primary>access control lists (ACLs)</primary>
49622 <secondary>nested</secondary>
49624 <indexterm role="concept">
49625 <primary>access control lists (ACLs)</primary>
49626 <secondary>indirect</secondary>
49628 <indexterm role="concept">
49629 <primary><option>acl</option> ACL condition</primary>
49631 The possible values of the argument are the same as for the
49632 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
49633 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
49634 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
49635 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
49636 condition false. This means that further processing of the <option>warn</option> verb
49637 ceases, but processing of the ACL continues.
49640 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
49641 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
49642 <option>accept</option> or <option>discard</option>, and the action is taken immediately – no further
49643 conditions are tested.
49646 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
49647 loops. This condition allows you to use different ACLs in different
49648 circumstances. For example, different ACLs can be used to handle RCPT commands
49649 for different local users or different local domains.
49651 </listitem></varlistentry>
49653 <term><emphasis role="bold">authenticated = </emphasis><<emphasis>string list</emphasis>></term>
49656 <indexterm role="concept">
49657 <primary><option>authenticated</option> ACL condition</primary>
49659 <indexterm role="concept">
49660 <primary>authentication</primary>
49661 <secondary>ACL checking</secondary>
49663 <indexterm role="concept">
49664 <primary>access control lists (ACLs)</primary>
49665 <secondary>testing for authentication</secondary>
49667 If the SMTP connection is not authenticated, the condition is false. Otherwise,
49668 the name of the authenticator is tested against the list. To test for
49669 authentication by any authenticator, you can set
49671 <literallayout class="monospaced">
49674 </listitem></varlistentry>
49676 <term><emphasis role="bold">condition = </emphasis><<emphasis>string</emphasis>></term>
49679 <indexterm role="concept">
49680 <primary><option>condition</option> ACL condition</primary>
49682 <indexterm role="concept">
49683 <primary>customizing</primary>
49684 <secondary>ACL condition</secondary>
49686 <indexterm role="concept">
49687 <primary>access control lists (ACLs)</primary>
49688 <secondary>customized test</secondary>
49690 <indexterm role="concept">
49691 <primary>access control lists (ACLs)</primary>
49692 <secondary>testing, customized</secondary>
49694 This feature allows you to make up custom conditions. If the result of
49695 expanding the string is an empty string, the number zero, or one of the strings
49696 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
49697 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
49698 any other value, some error is assumed to have occurred, and the ACL returns
49699 <quote>defer</quote>. However, if the expansion is forced to fail, the condition is
49700 ignored. The effect is to treat it as true, whether it is positive or
49703 </listitem></varlistentry>
49705 <term><emphasis role="bold">decode = </emphasis><<emphasis>location</emphasis>></term>
49708 <indexterm role="concept">
49709 <primary><option>decode</option> ACL condition</primary>
49711 This condition is available only when Exim is compiled with the
49712 content-scanning extension, and it is allowed only in the ACL defined by
49713 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
49714 If all goes well, the condition is true. It is false only if there are
49715 problems such as a syntax error or a memory shortage. For more details, see
49716 chapter <xref linkend="CHAPexiscan"/>.
49718 </listitem></varlistentry>
49720 <term><emphasis role="bold">demime = </emphasis><<emphasis>extension list</emphasis>></term>
49723 <indexterm role="concept">
49724 <primary><option>demime</option> ACL condition</primary>
49726 This condition is available only when Exim is compiled with the
49727 content-scanning extension. Its use is described in section
49728 <xref linkend="SECTdemimecond"/>.
49730 </listitem></varlistentry>
49732 <term><emphasis role="bold">dnslists = </emphasis><<emphasis>list of domain names and other data</emphasis>></term>
49735 <indexterm role="concept">
49736 <primary><option>dnslists</option> ACL condition</primary>
49738 <indexterm role="concept">
49739 <primary>DNS list</primary>
49740 <secondary>in ACL</secondary>
49742 <indexterm role="concept">
49743 <primary>black list (DNS)</primary>
49745 <indexterm role="concept">
49746 <primary>access control lists (ACLs)</primary>
49747 <secondary>testing a DNS list</secondary>
49749 This condition checks for entries in DNS black lists. These are also known as
49750 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
49751 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
49752 different variants of this condition to describe briefly here. See sections
49753 <xref linkend="SECTmorednslists"/>–<xref linkend="SECTmorednslistslast"/> for details.
49755 </listitem></varlistentry>
49757 <term><emphasis role="bold">domains = </emphasis><<emphasis>domain list</emphasis>></term>
49760 <indexterm role="concept">
49761 <primary><option>domains</option> ACL condition</primary>
49763 <indexterm role="concept">
49764 <primary>domain</primary>
49765 <secondary>ACL checking</secondary>
49767 <indexterm role="concept">
49768 <primary>access control lists (ACLs)</primary>
49769 <secondary>testing a recipient domain</secondary>
49771 <indexterm role="variable">
49772 <primary><varname>$domain_data</varname></primary>
49774 This condition is relevant only after a RCPT command. It checks that the domain
49775 of the recipient address is in the domain list. If percent-hack processing is
49776 enabled, it is done before this test is done. If the check succeeds with a
49777 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
49778 <option>domains</option> test.
49781 <emphasis role="bold">Note carefully</emphasis> (because many people seem to fall foul of this): you cannot
49782 use <option>domains</option> in a DATA ACL.
49784 </listitem></varlistentry>
49786 <term><emphasis role="bold">encrypted = </emphasis><<emphasis>string list</emphasis>></term>
49789 <indexterm role="concept">
49790 <primary><option>encrypted</option> ACL condition</primary>
49792 <indexterm role="concept">
49793 <primary>encryption</primary>
49794 <secondary>checking in an ACL</secondary>
49796 <indexterm role="concept">
49797 <primary>access control lists (ACLs)</primary>
49798 <secondary>testing for encryption</secondary>
49800 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
49801 name of the cipher suite in use is tested against the list. To test for
49802 encryption without testing for any specific cipher suite(s), set
49804 <literallayout class="monospaced">
49807 </listitem></varlistentry>
49809 <term><emphasis role="bold">hosts = </emphasis><<emphasis> host list</emphasis>></term>
49812 <indexterm role="concept">
49813 <primary><option>hosts</option> ACL condition</primary>
49815 <indexterm role="concept">
49816 <primary>host</primary>
49817 <secondary>ACL checking</secondary>
49819 <indexterm role="concept">
49820 <primary>access control lists (ACLs)</primary>
49821 <secondary>testing the client host</secondary>
49823 This condition tests that the calling host matches the host list. If you have
49824 name lookups or wildcarded host names and IP addresses in the same host list,
49825 you should normally put the IP addresses first. For example, you could have:
49827 <literallayout class="monospaced">
49828 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
49831 The lookup in this example uses the host name for its key. This is implied by
49832 the lookup type <quote>dbm</quote>. (For a host address lookup you would use <quote>net-dbm</quote>
49833 and it wouldn’t matter which way round you had these two items.)
49836 The reason for the problem with host names lies in the left-to-right way that
49837 Exim processes lists. It can test IP addresses without doing any DNS lookups,
49838 but when it reaches an item that requires a host name, it fails if it cannot
49839 find a host name to compare with the pattern. If the above list is given in the
49840 opposite order, the <option>accept</option> statement fails for a host whose name cannot be
49841 found, even if its IP address is 10.9.8.7.
49844 If you really do want to do the name check first, and still recognize the IP
49845 address even if the name lookup fails, you can rewrite the ACL like this:
49847 <literallayout class="monospaced">
49848 accept hosts = dbm;/etc/friendly/hosts
49849 accept hosts = 10.9.8.7
49852 The default action on failing to find the host name is to assume that the host
49853 is not in the list, so the first <option>accept</option> statement fails. The second
49854 statement can then check the IP address.
49857 <indexterm role="variable">
49858 <primary><varname>$host_data</varname></primary>
49860 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
49861 of the lookup is made available in the <varname>$host_data</varname> variable. This
49862 allows you, for example, to set up a statement like this:
49864 <literallayout class="monospaced">
49865 deny hosts = net-lsearch;/some/file
49866 message = $host_data
49869 which gives a custom error message for each denied host.
49871 </listitem></varlistentry>
49873 <term><emphasis role="bold">local_parts = </emphasis><<emphasis>local part list</emphasis>></term>
49876 <indexterm role="concept">
49877 <primary><option>local_parts</option> ACL condition</primary>
49879 <indexterm role="concept">
49880 <primary>local part</primary>
49881 <secondary>ACL checking</secondary>
49883 <indexterm role="concept">
49884 <primary>access control lists (ACLs)</primary>
49885 <secondary>testing a local part</secondary>
49887 <indexterm role="variable">
49888 <primary><varname>$local_part_data</varname></primary>
49890 This condition is relevant only after a RCPT command. It checks that the local
49891 part of the recipient address is in the list. If percent-hack processing is
49892 enabled, it is done before this test. If the check succeeds with a lookup, the
49893 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
49894 the next <option>local_parts</option> test.
49896 </listitem></varlistentry>
49898 <term><emphasis role="bold">malware = </emphasis><<emphasis>option</emphasis>></term>
49901 <indexterm role="concept">
49902 <primary><option>malware</option> ACL condition</primary>
49904 <indexterm role="concept">
49905 <primary>access control lists (ACLs)</primary>
49906 <secondary>virus scanning</secondary>
49908 <indexterm role="concept">
49909 <primary>access control lists (ACLs)</primary>
49910 <secondary>scanning for viruses</secondary>
49912 This condition is available only when Exim is compiled with the
49913 content-scanning extension. It causes the incoming message to be scanned for
49914 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
49916 </listitem></varlistentry>
49918 <term><emphasis role="bold">mime_regex = </emphasis><<emphasis>list of regular expressions</emphasis>></term>
49921 <indexterm role="concept">
49922 <primary><option>mime_regex</option> ACL condition</primary>
49924 <indexterm role="concept">
49925 <primary>access control lists (ACLs)</primary>
49926 <secondary>testing by regex matching</secondary>
49928 This condition is available only when Exim is compiled with the
49929 content-scanning extension, and it is allowed only in the ACL defined by
49930 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
49931 with any of the regular expressions. For details, see chapter
49932 <xref linkend="CHAPexiscan"/>.
49934 </listitem></varlistentry>
49936 <term><emphasis role="bold">ratelimit = </emphasis><<emphasis>parameters</emphasis>></term>
49939 <indexterm role="concept">
49940 <primary>rate limiting</primary>
49942 This condition can be used to limit the rate at which a user or host submits
49943 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
49945 </listitem></varlistentry>
49947 <term><emphasis role="bold">recipients = </emphasis><<emphasis>address list</emphasis>></term>
49950 <indexterm role="concept">
49951 <primary><option>recipients</option> ACL condition</primary>
49953 <indexterm role="concept">
49954 <primary>recipient</primary>
49955 <secondary>ACL checking</secondary>
49957 <indexterm role="concept">
49958 <primary>access control lists (ACLs)</primary>
49959 <secondary>testing a recipient</secondary>
49961 This condition is relevant only after a RCPT command. It checks the entire
49962 recipient address against a list of recipients.
49964 </listitem></varlistentry>
49966 <term><emphasis role="bold">regex = </emphasis><<emphasis>list of regular expressions</emphasis>></term>
49969 <indexterm role="concept">
49970 <primary><option>regex</option> ACL condition</primary>
49972 <indexterm role="concept">
49973 <primary>access control lists (ACLs)</primary>
49974 <secondary>testing by regex matching</secondary>
49976 This condition is available only when Exim is compiled with the
49977 content-scanning extension, and is available only in the DATA, MIME, and
49978 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
49979 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
49981 </listitem></varlistentry>
49983 <term><emphasis role="bold">sender_domains = </emphasis><<emphasis>domain list</emphasis>></term>
49986 <indexterm role="concept">
49987 <primary><option>sender_domains</option> ACL condition</primary>
49989 <indexterm role="concept">
49990 <primary>sender</primary>
49991 <secondary>ACL checking</secondary>
49993 <indexterm role="concept">
49994 <primary>access control lists (ACLs)</primary>
49995 <secondary>testing a sender domain</secondary>
49997 <indexterm role="variable">
49998 <primary><varname>$domain</varname></primary>
50000 <indexterm role="variable">
50001 <primary><varname>$sender_address_domain</varname></primary>
50003 This condition tests the domain of the sender of the message against the given
50004 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
50005 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
50006 of this condition. This is an exception to the general rule for testing domain
50007 lists. It is done this way so that, if this condition is used in an ACL for a
50008 RCPT command, the recipient’s domain (which is in <varname>$domain</varname>) can be used to
50009 influence the sender checking.
50012 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
50013 relaying, because sender addresses are easily, and commonly, forged.
50015 </listitem></varlistentry>
50017 <term><emphasis role="bold">senders = </emphasis><<emphasis>address list</emphasis>></term>
50020 <indexterm role="concept">
50021 <primary><option>senders</option> ACL condition</primary>
50023 <indexterm role="concept">
50024 <primary>sender</primary>
50025 <secondary>ACL checking</secondary>
50027 <indexterm role="concept">
50028 <primary>access control lists (ACLs)</primary>
50029 <secondary>testing a sender</secondary>
50031 This condition tests the sender of the message against the given list. To test
50032 for a bounce message, which has an empty sender, set
50034 <literallayout class="monospaced">
50038 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
50039 relaying, because sender addresses are easily, and commonly, forged.
50041 </listitem></varlistentry>
50043 <term><emphasis role="bold">spam = </emphasis><<emphasis>username</emphasis>></term>
50046 <indexterm role="concept">
50047 <primary><option>spam</option> ACL condition</primary>
50049 <indexterm role="concept">
50050 <primary>access control lists (ACLs)</primary>
50051 <secondary>scanning for spam</secondary>
50053 This condition is available only when Exim is compiled with the
50054 content-scanning extension. It causes the incoming message to be scanned by
50055 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
50057 </listitem></varlistentry>
50059 <term><emphasis role="bold">verify = certificate</emphasis></term>
50062 <indexterm role="concept">
50063 <primary><option>verify</option> ACL condition</primary>
50065 <indexterm role="concept">
50066 <primary>TLS</primary>
50067 <secondary>client certificate verification</secondary>
50069 <indexterm role="concept">
50070 <primary>certificate</primary>
50071 <secondary>verification of client</secondary>
50073 <indexterm role="concept">
50074 <primary>access control lists (ACLs)</primary>
50075 <secondary>certificate verification</secondary>
50077 <indexterm role="concept">
50078 <primary>access control lists (ACLs)</primary>
50079 <secondary>testing a TLS certificate</secondary>
50081 This condition is true in an SMTP session if the session is encrypted, and a
50082 certificate was received from the client, and the certificate was verified. The
50083 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
50084 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
50086 </listitem></varlistentry>
50088 <term><emphasis role="bold">verify = csa</emphasis></term>
50091 <indexterm role="concept">
50092 <primary>CSA verification</primary>
50094 This condition checks whether the sending host (the client) is authorized to
50095 send email. Details of how this works are given in section
50096 <xref linkend="SECTverifyCSA"/>.
50098 </listitem></varlistentry>
50100 <term><emphasis role="bold">verify = header_sender/</emphasis><<emphasis>options</emphasis>></term>
50103 <indexterm role="concept">
50104 <primary><option>verify</option> ACL condition</primary>
50106 <indexterm role="concept">
50107 <primary>access control lists (ACLs)</primary>
50108 <secondary>verifying sender in the header</secondary>
50110 <indexterm role="concept">
50111 <primary>header lines</primary>
50112 <secondary>verifying the sender in</secondary>
50114 <indexterm role="concept">
50115 <primary>sender</primary>
50116 <secondary>verifying in header</secondary>
50118 <indexterm role="concept">
50119 <primary>verifying</primary>
50120 <secondary>sender in header</secondary>
50122 This condition is relevant only in an ACL that is run after a message has been
50123 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
50124 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
50125 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
50126 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
50127 However, an address that appears in one of these headers need not be an address
50128 that accepts bounce messages; only sender addresses in envelopes are required
50129 to accept bounces. Therefore, if you use the callout option on this check, you
50130 might want to arrange for a non-empty address in the MAIL command.
50133 Details of address verification and the options are given later, starting at
50134 section <xref linkend="SECTaddressverification"/> (callouts are described in section
50135 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
50136 condition to restrict it to bounce messages only:
50138 <literallayout class="monospaced">
50140 message = A valid sender header is required for bounces
50141 !verify = header_sender
50143 </listitem></varlistentry>
50145 <term><emphasis role="bold">verify = header_syntax</emphasis></term>
50148 <indexterm role="concept">
50149 <primary><option>verify</option> ACL condition</primary>
50151 <indexterm role="concept">
50152 <primary>access control lists (ACLs)</primary>
50153 <secondary>verifying header syntax</secondary>
50155 <indexterm role="concept">
50156 <primary>header lines</primary>
50157 <secondary>verifying syntax</secondary>
50159 <indexterm role="concept">
50160 <primary>verifying</primary>
50161 <secondary>header syntax</secondary>
50163 This condition is relevant only in an ACL that is run after a message has been
50164 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
50165 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
50166 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
50167 and <emphasis>Bcc:</emphasis>). Unqualified addresses (local parts without domains) are
50168 permitted only in locally generated messages and from hosts that match
50169 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
50173 Note that this condition is a syntax check only. However, a common spamming
50174 ploy used to be to send syntactically invalid headers such as
50176 <literallayout class="monospaced">
50180 and this condition can be used to reject such messages, though they are not as
50181 common as they used to be.
50183 </listitem></varlistentry>
50185 <term><emphasis role="bold">verify = helo</emphasis></term>
50188 <indexterm role="concept">
50189 <primary><option>verify</option> ACL condition</primary>
50191 <indexterm role="concept">
50192 <primary>access control lists (ACLs)</primary>
50193 <secondary>verifying HELO/EHLO</secondary>
50195 <indexterm role="concept">
50196 <primary>HELO</primary>
50197 <secondary>verifying</secondary>
50199 <indexterm role="concept">
50200 <primary>EHLO</primary>
50201 <secondary>verifying</secondary>
50203 <indexterm role="concept">
50204 <primary>verifying</primary>
50205 <secondary>EHLO</secondary>
50207 <indexterm role="concept">
50208 <primary>verifying</primary>
50209 <secondary>HELO</secondary>
50211 This condition is true if a HELO or EHLO command has been received from the
50212 client host, and its contents have been verified. If there has been no previous
50213 attempt to verify the HELO/EHLO contents, it is carried out when this
50214 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
50215 <option>helo_try_verify_hosts</option> options for details of how to request verification
50216 independently of this condition.
50219 For SMTP input that does not come over TCP/IP (the <option>-bs</option> command line
50220 option), this condition is always true.
50222 </listitem></varlistentry>
50224 <term><emphasis role="bold">verify = not_blind</emphasis></term>
50227 <indexterm role="concept">
50228 <primary>verifying</primary>
50229 <secondary>not blind</secondary>
50231 <indexterm role="concept">
50232 <primary>bcc recipients, verifying none</primary>
50234 This condition checks that there are no blind (bcc) recipients in the message.
50235 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
50236 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
50237 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
50238 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
50239 used only in a DATA or non-SMTP ACL.
50242 There are, of course, many legitimate messages that make use of blind (bcc)
50243 recipients. This check should not be used on its own for blocking messages.
50245 </listitem></varlistentry>
50247 <term><emphasis role="bold">verify = recipient/</emphasis><<emphasis>options</emphasis>></term>
50250 <indexterm role="concept">
50251 <primary><option>verify</option> ACL condition</primary>
50253 <indexterm role="concept">
50254 <primary>access control lists (ACLs)</primary>
50255 <secondary>verifying recipient</secondary>
50257 <indexterm role="concept">
50258 <primary>recipient</primary>
50259 <secondary>verifying</secondary>
50261 <indexterm role="concept">
50262 <primary>verifying</primary>
50263 <secondary>recipient</secondary>
50265 <indexterm role="variable">
50266 <primary><varname>$address_data</varname></primary>
50268 This condition is relevant only after a RCPT command. It verifies the current
50269 recipient. Details of address verification are given later, starting at section
50270 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
50271 of <varname>$address_data</varname> is the last value that was set while routing the address.
50272 This applies even if the verification fails. When an address that is being
50273 verified is redirected to a single address, verification continues with the new
50274 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
50275 value for the child address.
50277 </listitem></varlistentry>
50279 <term><emphasis role="bold">verify = reverse_host_lookup</emphasis></term>
50282 <indexterm role="concept">
50283 <primary><option>verify</option> ACL condition</primary>
50285 <indexterm role="concept">
50286 <primary>access control lists (ACLs)</primary>
50287 <secondary>verifying host reverse lookup</secondary>
50289 <indexterm role="concept">
50290 <primary>host</primary>
50291 <secondary>verifying reverse lookup</secondary>
50293 This condition ensures that a verified host name has been looked up from the IP
50294 address of the client host. (This may have happened already if the host name
50295 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
50296 Verification ensures that the host name obtained from a reverse DNS lookup, or
50297 one of its aliases, does, when it is itself looked up in the DNS, yield the
50298 original IP address.
50301 If this condition is used for a locally generated message (that is, when there
50302 is no client host involved), it always succeeds.
50304 </listitem></varlistentry>
50306 <term><emphasis role="bold">verify = sender/</emphasis><<emphasis>options</emphasis>></term>
50309 <indexterm role="concept">
50310 <primary><option>verify</option> ACL condition</primary>
50312 <indexterm role="concept">
50313 <primary>access control lists (ACLs)</primary>
50314 <secondary>verifying sender</secondary>
50316 <indexterm role="concept">
50317 <primary>sender</primary>
50318 <secondary>verifying</secondary>
50320 <indexterm role="concept">
50321 <primary>verifying</primary>
50322 <secondary>sender</secondary>
50324 This condition is relevant only after a MAIL or RCPT command, or after a
50325 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
50326 the message’s sender is empty (that is, this is a bounce message), the
50327 condition is true. Otherwise, the sender address is verified.
50330 <indexterm role="variable">
50331 <primary><varname>$address_data</varname></primary>
50333 <indexterm role="variable">
50334 <primary><varname>$sender_address_data</varname></primary>
50336 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
50337 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
50338 value can be used in subsequent conditions and modifiers in the same ACL
50339 statement. It does not persist after the end of the current statement. If you
50340 want to preserve the value for longer, you can save it in an ACL variable.
50343 Details of verification are given later, starting at section
50344 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
50345 to avoid doing it more than once per message.
50347 </listitem></varlistentry>
50349 <term><emphasis role="bold">verify = sender=</emphasis><<emphasis>address</emphasis>><emphasis role="bold">/</emphasis><<emphasis>options</emphasis>></term>
50352 <indexterm role="concept">
50353 <primary><option>verify</option> ACL condition</primary>
50355 This is a variation of the previous option, in which a modified address is
50356 verified as a sender.
50358 </listitem></varlistentry>
50361 <section id="SECTmorednslists">
50362 <title>Using DNS lists</title>
50364 <indexterm role="concept">
50365 <primary>DNS list</primary>
50366 <secondary>in ACL</secondary>
50368 <indexterm role="concept">
50369 <primary>black list (DNS)</primary>
50371 <indexterm role="concept">
50372 <primary>access control lists (ACLs)</primary>
50373 <secondary>testing a DNS list</secondary>
50375 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
50376 is on at least one of a number of DNS lists by looking up the inverted IP
50377 address in one or more DNS domains. (Note that DNS list domains are not mail
50378 domains, so the <literal>+</literal> syntax for named lists doesn’t work - it is used for
50379 special options instead.) For example, if the calling host’s IP
50380 address is 192.168.62.43, and the ACL statement is
50382 <literallayout class="monospaced">
50383 deny dnslists = blackholes.mail-abuse.org : \
50384 dialups.mail-abuse.org
50387 the following records are looked up:
50389 <literallayout class="monospaced">
50390 43.62.168.192.blackholes.mail-abuse.org
50391 43.62.168.192.dialups.mail-abuse.org
50394 As soon as Exim finds an existing DNS record, processing of the list stops.
50395 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
50396 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
50397 use two separate conditions:
50399 <literallayout class="monospaced">
50400 deny dnslists = blackholes.mail-abuse.org
50401 dnslists = dialups.mail-abuse.org
50404 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
50405 behaves as if the host does not match the list item, that is, as if the DNS
50406 record does not exist. If there are further items in the DNS list, they are
50410 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
50411 (which is the most common usage), because it prevents a DNS failure from
50412 blocking mail. However, you can change this behaviour by putting one of the
50413 following special items in the list:
50416 <literal>+include_unknown </literal> behave as if the item is on the list
50417 <literal>+exclude_unknown </literal> behave as if the item is not on the list (default)
50418 <literal>+defer_unknown </literal> give a temporary error
50421 <indexterm role="concept">
50422 <primary><literal>+include_unknown</literal></primary>
50424 <indexterm role="concept">
50425 <primary><literal>+exclude_unknown</literal></primary>
50427 <indexterm role="concept">
50428 <primary><literal>+defer_unknown</literal></primary>
50430 Each of these applies to any subsequent items on the list. For example:
50432 <literallayout class="monospaced">
50433 deny dnslists = +defer_unknown : foo.bar.example
50436 Testing the list of domains stops as soon as a match is found. If you want to
50437 warn for one list and block for another, you can use two different statements:
50439 <literallayout class="monospaced">
50440 deny dnslists = blackholes.mail-abuse.org
50441 warn message = X-Warn: sending host is on dialups list
50442 dnslists = dialups.mail-abuse.org
50445 DNS list lookups are cached by Exim for the duration of the SMTP session,
50446 so a lookup based on the IP address is done at most once for any incoming
50447 connection. Exim does not share information between multiple incoming
50448 connections (but your local name server cache should be active).
50451 <section id="SECID201">
50452 <title>Specifying the IP address for a DNS list lookup</title>
50454 <indexterm role="concept">
50455 <primary>DNS list</primary>
50456 <secondary>keyed by explicit IP address</secondary>
50458 By default, the IP address that is used in a DNS list lookup is the IP address
50459 of the calling host. However, you can specify another IP address by listing it
50460 after the domain name, introduced by a slash. For example:
50462 <literallayout class="monospaced">
50463 deny dnslists = black.list.tld/192.168.1.2
50466 This feature is not very helpful with explicit IP addresses; it is intended for
50467 use with IP addresses that are looked up, for example, the IP addresses of the
50468 MX hosts or nameservers of an email sender address. For an example, see section
50469 <xref linkend="SECTmulkeyfor"/> below.
50472 <section id="SECID202">
50473 <title>DNS lists keyed on domain names</title>
50475 <indexterm role="concept">
50476 <primary>DNS list</primary>
50477 <secondary>keyed by domain name</secondary>
50479 There are some lists that are keyed on domain names rather than inverted IP
50480 addresses (see for example the <emphasis>domain based zones</emphasis> link at
50481 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
50482 with these lists. You can change the name that is looked up in a DNS list by
50483 listing it after the domain name, introduced by a slash. For example,
50485 <literallayout class="monospaced">
50486 deny message = Sender's domain is listed at $dnslist_domain
50487 dnslists = dsn.rfc-ignorant.org/$sender_address_domain
50490 This particular example is useful only in ACLs that are obeyed after the
50491 RCPT or DATA commands, when a sender address is available. If (for
50492 example) the message’s sender is <emphasis>user@tld.example</emphasis> the name that is looked
50493 up by this example is
50495 <literallayout class="monospaced">
50496 tld.example.dsn.rfc-ignorant.org
50499 A single <option>dnslists</option> condition can contain entries for both names and IP
50500 addresses. For example:
50502 <literallayout class="monospaced">
50503 deny dnslists = sbl.spamhaus.org : \
50504 dsn.rfc-ignorant.org/$sender_address_domain
50507 The first item checks the sending host’s IP address; the second checks a domain
50508 name. The whole condition is true if either of the DNS lookups succeeds.
50511 <section id="SECTmulkeyfor">
50512 <title>Multiple explicit keys for a DNS list</title>
50514 <indexterm role="concept">
50515 <primary>DNS list</primary>
50516 <secondary>multiple keys for</secondary>
50518 The syntax described above for looking up explicitly-defined values (either
50519 names or IP addresses) in a DNS blacklist is a simplification. After the domain
50520 name for the DNS list, what follows the slash can in fact be a list of items.
50521 As with all lists in Exim, the default separator is a colon. However, because
50522 this is a sublist within the list of DNS blacklist domains, it is necessary
50523 either to double the separators like this:
50525 <literallayout class="monospaced">
50526 dnslists = black.list.tld/name.1::name.2
50529 or to change the separator character, like this:
50531 <literallayout class="monospaced">
50532 dnslists = black.list.tld/<;name.1;name.2
50535 If an item in the list is an IP address, it is inverted before the DNS
50536 blacklist domain is appended. If it is not an IP address, no inversion
50537 occurs. Consider this condition:
50539 <literallayout class="monospaced">
50540 dnslists = black.list.tld/<;192.168.1.2;a.domain
50543 The DNS lookups that occur are:
50545 <literallayout class="monospaced">
50546 2.1.168.192.black.list.tld
50547 a.domain.black.list.tld
50550 Once a DNS record has been found (that matches a specific IP return
50551 address, if specified – see section <xref linkend="SECTaddmatcon"/>), no further lookups
50552 are done. If there is a temporary DNS error, the rest of the sublist of domains
50553 or IP addresses is tried. A temporary error for the whole dnslists item occurs
50554 only if no other DNS lookup in this sublist succeeds. In other words, a
50555 successful lookup for any of the items in the sublist overrides a temporary
50556 error for a previous item.
50559 The ability to supply a list of items after the slash is in some sense just a
50560 syntactic convenience. These two examples have the same effect:
50562 <literallayout class="monospaced">
50563 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
50564 dnslists = black.list.tld/a.domain::b.domain
50567 However, when the data for the list is obtained from a lookup, the second form
50568 is usually much more convenient. Consider this example:
50570 <literallayout class="monospaced">
50571 deny message = The mail servers for the domain \
50572 $sender_address_domain \
50573 are listed at $dnslist_domain ($dnslist_value); \
50575 dnslists = sbl.spamhaus.org/<|${lookup dnsdb {>|a=<|\
50576 ${lookup dnsdb {>|mxh=\
50577 $sender_address_domain} }} }
50580 Note the use of <literal>>|</literal> in the dnsdb lookup to specify the separator for
50581 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
50582 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
50583 of expanding the condition might be something like this:
50585 <literallayout class="monospaced">
50586 dnslists = sbl.spahmaus.org/<|192.168.2.3|192.168.5.6|...
50589 Thus, this example checks whether or not the IP addresses of the sender
50590 domain’s mail servers are on the Spamhaus black list.
50593 The key that was used for a successful DNS list lookup is put into the variable
50594 <varname>$dnslist_matched</varname> (see section <xref linkend="SECID204"/>).
50597 <section id="SECID203">
50598 <title>Data returned by DNS lists</title>
50600 <indexterm role="concept">
50601 <primary>DNS list</primary>
50602 <secondary>data returned from</secondary>
50604 DNS lists are constructed using address records in the DNS. The original RBL
50605 just used the address 127.0.0.1 on the right hand side of each record, but the
50606 RBL+ list and some other lists use a number of values with different meanings.
50607 The values used on the RBL+ list are:
50612 127.1.0.3 DUL and RBL
50614 127.1.0.5 RSS and RBL
50615 127.1.0.6 RSS and DUL
50616 127.1.0.7 RSS and DUL and RBL
50619 Section <xref linkend="SECTaddmatcon"/> below describes how you can distinguish between
50620 different values. Some DNS lists may return more than one address record;
50621 see section <xref linkend="SECThanmuldnsrec"/> for details of how they are checked.
50624 <section id="SECID204">
50625 <title>Variables set from DNS lists</title>
50627 <indexterm role="concept">
50628 <primary>expansion</primary>
50629 <secondary>variables, set from DNS list</secondary>
50631 <indexterm role="concept">
50632 <primary>DNS list</primary>
50633 <secondary>variables set from</secondary>
50635 <indexterm role="variable">
50636 <primary><varname>$dnslist_domain</varname></primary>
50638 <indexterm role="variable">
50639 <primary><varname>$dnslist_matched</varname></primary>
50641 <indexterm role="variable">
50642 <primary><varname>$dnslist_text</varname></primary>
50644 <indexterm role="variable">
50645 <primary><varname>$dnslist_value</varname></primary>
50647 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname> contains
50648 the name of the overall domain that matched (for example,
50649 <literal>spamhaus.example</literal>), <varname>$dnslist_matched</varname> contains the key within that domain
50650 (for example, <literal>192.168.5.3</literal>), and <varname>$dnslist_value</varname> contains the data from
50651 the DNS record. When the key is an IP address, it is not reversed in
50652 <varname>$dnslist_matched</varname> (though it is, of course, in the actual lookup). In simple
50653 cases, for example:
50655 <literallayout class="monospaced">
50656 deny dnslists = spamhaus.example
50659 the key is also available in another variable (in this case,
50660 <varname>$sender_host_address</varname>). In more complicated cases, however, this is not true.
50661 For example, using a data lookup (as described in section <xref linkend="SECTmulkeyfor"/>)
50662 might generate a dnslists lookup like this:
50664 <literallayout class="monospaced">
50665 deny dnslists = spamhaus.example/<|192.168.1.2|192.168.6.7|...
50668 If this condition succeeds, the value in <varname>$dnslist_matched</varname> might be
50669 <literal>192.168.6.7</literal> (for example).
50672 If more than one address record is returned by the DNS lookup, all the IP
50673 addresses are included in <varname>$dnslist_value</varname>, separated by commas and spaces.
50674 The variable <varname>$dnslist_text</varname> contains the contents of any associated TXT
50675 record. For lists such as RBL+ the TXT record for a merged entry is often not
50676 very meaningful. See section <xref linkend="SECTmordetinf"/> for a way of obtaining more
50680 You can use the DNS list variables in <option>message</option> or <option>log_message</option> modifiers
50681 – although these appear before the condition in the ACL, they are not
50682 expanded until after it has failed. For example:
50684 <literallayout class="monospaced">
50685 deny hosts = !+local_networks
50686 message = $sender_host_address is listed \
50688 dnslists = rbl-plus.mail-abuse.example
50691 <section id="SECTaddmatcon">
50692 <title>Additional matching conditions for DNS lists</title>
50694 <indexterm role="concept">
50695 <primary>DNS list</primary>
50696 <secondary>matching specific returned data</secondary>
50698 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
50699 in order to restrict its action to DNS records with a matching right hand side.
50702 <literallayout class="monospaced">
50703 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
50706 rejects only those hosts that yield 127.0.0.2. Without this additional data,
50707 any address record is considered to be a match. For the moment, we assume
50708 that the DNS lookup returns just one record. Section <xref linkend="SECThanmuldnsrec"/>
50709 describes how multiple records are handled.
50712 More than one IP address may be given for checking, using a comma as a
50713 separator. These are alternatives – if any one of them matches, the
50714 <option>dnslists</option> condition is true. For example:
50716 <literallayout class="monospaced">
50717 deny dnslists = a.b.c=127.0.0.2,127.0.0.3
50720 If you want to specify a constraining address list and also specify names or IP
50721 addresses to be looked up, the constraining address list must be specified
50722 first. For example:
50724 <literallayout class="monospaced">
50725 deny dnslists = dsn.rfc-ignorant.org\
50726 =127.0.0.2/$sender_address_domain
50729 If the character <literal>&</literal> is used instead of <literal>=</literal>, the comparison for each
50730 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
50731 In other words, the listed addresses are used as bit masks. The comparison is
50732 true if all the bits in the mask are present in the address that is being
50733 tested. For example:
50735 <literallayout class="monospaced">
50736 dnslists = a.b.c&0.0.0.3
50739 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
50740 want to test whether one bit or another bit is present (as opposed to both
50741 being present), you must use multiple values. For example:
50743 <literallayout class="monospaced">
50744 dnslists = a.b.c&0.0.0.1,0.0.0.2
50747 matches if the final component of the address is an odd number or two times
50751 <section id="SECID205">
50752 <title>Negated DNS matching conditions</title>
50754 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
50757 <literallayout class="monospaced">
50758 deny dnslists = a.b.c=127.0.0.2,127.0.0.3
50761 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
50762 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
50764 <literallayout class="monospaced">
50765 deny dnslists = a.b.c!=127.0.0.2,127.0.0.3
50768 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
50769 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
50770 words, the result of the test is inverted if an exclamation mark appears before
50771 the <literal>=</literal> (or the <literal>&</literal>) sign.
50774 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
50775 host, or address list (which is why the syntax is different).
50778 If you are using just one list, the negation syntax does not gain you much. The
50779 previous example is precisely equivalent to
50781 <literallayout class="monospaced">
50782 deny dnslists = a.b.c
50783 !dnslists = a.b.c=127.0.0.2,127.0.0.3
50786 However, if you are using multiple lists, the negation syntax is clearer.
50787 Consider this example:
50789 <literallayout class="monospaced">
50790 deny dnslists = sbl.spamhaus.org : \
50792 dnsbl.njabl.org!=127.0.0.3 : \
50796 Using only positive lists, this would have to be:
50798 <literallayout class="monospaced">
50799 deny dnslists = sbl.spamhaus.org : \
50801 deny dnslists = dnsbl.njabl.org
50802 !dnslists = dnsbl.njabl.org=127.0.0.3
50803 deny dnslists = relays.ordb.org
50806 which is less clear, and harder to maintain.
50809 <section id="SECThanmuldnsrec">
50810 <title>Handling multiple DNS records from a DNS list</title>
50812 A DNS lookup for a <option>dnslists</option> condition may return more than one DNS record,
50813 thereby providing more than one IP address. When an item in a <option>dnslists</option> list
50814 is followed by <literal>=</literal> or <literal>&</literal> and a list of IP addresses, in order to restrict
50815 the match to specific results from the DNS lookup, there are two ways in which
50816 the checking can be handled. For example, consider the condition:
50818 <literallayout class="monospaced">
50819 dnslists = a.b.c=127.0.0.1
50822 What happens if the DNS lookup for the incoming IP address yields both
50823 127.0.0.1 and 127.0.0.2 by means of two separate DNS records? Is the
50824 condition true because at least one given value was found, or is it false
50825 because at least one of the found values was not listed? And how does this
50826 affect negated conditions? Both possibilities are provided for with the help of
50827 additional separators <literal>==</literal> and <literal>=&</literal>.
50832 If <literal>=</literal> or <literal>&</literal> is used, the condition is true if any one of the looked up
50833 IP addresses matches one of the listed addresses. For the example above, the
50834 condition is true because 127.0.0.1 matches.
50839 If <literal>==</literal> or <literal>=&</literal> is used, the condition is true only if every one of the
50840 looked up IP addresses matches one of the listed addresses. If the condition is
50843 <literallayout class="monospaced">
50844 dnslists = a.b.c==127.0.0.1
50847 and the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
50848 false because 127.0.0.2 is not listed. You would need to have:
50850 <literallayout class="monospaced">
50851 dnslists = a.b.c==127.0.0.1,127.0.0.2
50854 for the condition to be true.
50859 When <literal>!</literal> is used to negate IP address matching, it inverts the result, giving
50860 the precise opposite of the behaviour above. Thus:
50865 If <literal>!=</literal> or <literal>!&</literal> is used, the condition is true if none of the looked up IP
50866 addresses matches one of the listed addresses. Consider:
50868 <literallayout class="monospaced">
50869 dnslists = a.b.c!&0.0.0.1
50872 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
50873 false because 127.0.0.1 matches.
50878 If <literal>!==</literal> or <literal>!=&</literal> is used, the condition is true there is at least one
50879 looked up IP address that does not match. Consider:
50881 <literallayout class="monospaced">
50882 dnslists = a.b.c!=&0.0.0.1
50885 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
50886 true, because 127.0.0.2 does not match. You would need to have:
50888 <literallayout class="monospaced">
50889 dnslists = a.b.c!=&0.0.0.1,0.0.0.2
50892 for the condition to be false.
50897 When the DNS lookup yields only a single IP address, there is no difference
50898 between <literal>=</literal> and <literal>==</literal> and between <literal>&</literal> and <literal>=&</literal>.
50901 <section id="SECTmordetinf">
50902 <title>Detailed information from merged DNS lists</title>
50904 <indexterm role="concept">
50905 <primary>DNS list</primary>
50906 <secondary>information from merged</secondary>
50908 When the facility for restricting the matching IP values in a DNS list is used,
50909 the text from the TXT record that is set in <varname>$dnslist_text</varname> may not reflect
50910 the true reason for rejection. This happens when lists are merged and the IP
50911 address in the A record is used to distinguish them; unfortunately there is
50912 only one TXT record. One way round this is not to use merged lists, but that
50913 can be inefficient because it requires multiple DNS lookups where one would do
50914 in the vast majority of cases when the host of interest is not on any of the
50918 A less inefficient way of solving this problem is available. If
50919 two domain names, comma-separated, are given, the second is used first to
50920 do an initial check, making use of any IP value restrictions that are set.
50921 If there is a match, the first domain is used, without any IP value
50922 restrictions, to get the TXT record. As a byproduct of this, there is also
50923 a check that the IP being tested is indeed on the first list. The first
50924 domain is the one that is put in <varname>$dnslist_domain</varname>. For example:
50926 <literallayout class="monospaced">
50928 rejected because $sender_host_address is blacklisted \
50929 at $dnslist_domain\n$dnslist_text
50931 sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \
50932 dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
50935 For the first blacklist item, this starts by doing a lookup in
50936 <emphasis>sbl-xbl.spamhaus.org</emphasis> and testing for a 127.0.0.2 return. If there is a
50937 match, it then looks in <emphasis>sbl.spamhaus.org</emphasis>, without checking the return
50938 value, and as long as something is found, it looks for the corresponding TXT
50939 record. If there is no match in <emphasis>sbl-xbl.spamhaus.org</emphasis>, nothing more is done.
50940 The second blacklist item is processed similarly.
50943 If you are interested in more than one merged list, the same list must be
50944 given several times, but because the results of the DNS lookups are cached,
50945 the DNS calls themselves are not repeated. For example:
50947 <literallayout class="monospaced">
50948 reject dnslists = \
50949 http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \
50950 socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \
50951 misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \
50952 dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
50955 In this case there is one lookup in <emphasis>dnsbl.sorbs.net</emphasis>, and if none of the IP
50956 values matches (or if no record is found), this is the only lookup that is
50957 done. Only if there is a match is one of the more specific lists consulted.
50960 <section id="SECTmorednslistslast">
50961 <title>DNS lists and IPv6</title>
50963 <indexterm role="concept">
50964 <primary>IPv6</primary>
50965 <secondary>DNS black lists</secondary>
50967 <indexterm role="concept">
50968 <primary>DNS list</primary>
50969 <secondary>IPv6 usage</secondary>
50971 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
50972 nibble by nibble. For example, if the calling host’s IP address is
50973 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
50975 <literallayout class="monospaced">
50976 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
50977 f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
50980 (split over two lines here to fit on the page). Unfortunately, some of the DNS
50981 lists contain wildcard records, intended for IPv4, that interact badly with
50982 IPv6. For example, the DNS entry
50984 <literallayout class="monospaced">
50985 *.3.some.list.example. A 127.0.0.1
50988 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
50989 Unfortunately, it also matches the entire 3::/4 IPv6 network.
50992 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
50993 <option>condition</option> condition, as in this example:
50995 <literallayout class="monospaced">
50996 deny condition = ${if isip4{$sender_host_address}}
50997 dnslists = some.list.example
51000 <section id="SECTratelimiting">
51001 <title>Rate limiting incoming messages</title>
51003 <indexterm role="concept">
51004 <primary>rate limiting</primary>
51005 <secondary>client sending</secondary>
51007 <indexterm role="concept">
51008 <primary>limiting client sending rates</primary>
51010 <indexterm role="option">
51011 <primary><option>smtp_ratelimit_*</option></primary>
51013 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
51014 which clients can send email. This is more powerful than the
51015 <option>smtp_ratelimit_*</option> options, because those options control the rate of
51016 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
51017 works across all connections (concurrent and sequential) from the same client
51018 host. The syntax of the <option>ratelimit</option> condition is:
51021 <literal>ratelimit =</literal> <<emphasis>m</emphasis>> <literal>/</literal> <<emphasis>p</emphasis>> <literal>/</literal> <<emphasis>options</emphasis>> <literal>/</literal> <<emphasis>key</emphasis>>
51024 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
51025 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
51028 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
51029 <varname>$sender_rate</varname> to the client’s computed rate, <varname>$sender_rate_limit</varname> to the
51030 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
51031 of <emphasis>p</emphasis>.
51034 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
51035 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
51036 means that it takes Exim longer to forget a client’s past behaviour. The
51037 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
51038 send in each time interval. It also specifies the number of messages permitted
51039 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
51040 constant, you can allow a client to send more messages in a burst without
51041 changing its long-term sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
51042 both small, messages must be sent at an even rate.
51045 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
51046 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
51047 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
51048 instructions when it is run with no arguments.
51051 The key is used to look up the data for calculating the client’s average
51052 sending rate. This data is stored in Exim’s spool directory, alongside the
51053 retry and other hints databases. The default key is <varname>$sender_host_address</varname>,
51054 which means Exim computes the sending rate of each client host IP address.
51055 By changing the key you can change how Exim identifies clients for the purpose
51056 of ratelimiting. For example, to limit the sending rate of each authenticated
51057 user, independent of the computer they are sending from, set the key to
51058 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
51059 example, <varname>$authenticated_id</varname> is only meaningful if the client has
51060 authenticated (which you can check with the <option>authenticated</option> ACL condition).
51063 The lookup key does not have to identify clients: If you want to limit the
51064 rate at which a recipient receives messages, you can use the key
51065 <literal>$local_part@$domain</literal> with the <option>per_rcpt</option> option (see below) in a RCPT
51069 Internally, Exim appends the smoothing constant <emphasis>p</emphasis> and the options onto the
51070 lookup key because they alter the meaning of the stored data. This is not true
51071 for the limit <emphasis>m</emphasis>, so you can alter the configured maximum rate and Exim will
51072 still remember clients’ past behaviour, but if you alter the other ratelimit
51073 parameters Exim forgets past behaviour.
51076 Each <option>ratelimit</option> condition can have up to three options. One option
51077 specifies what Exim measures the rate of, and the second specifies how Exim
51078 handles excessively fast clients. The third option can be <literal>noupdate</literal>, to
51079 disable updating of the ratelimiting database (see section <xref linkend="rearatdat"/>).
51080 The options are separated by a slash, like the other parameters. They may
51081 appear in any order.
51084 <section id="ratoptmea">
51085 <title>Ratelimit options for what is being measured</title>
51087 The <option>per_conn</option> option limits the client’s connection rate.
51090 The <option>per_mail</option> option limits the client’s rate of sending messages. This is
51091 the default if none of the <option>per_*</option> options is specified.
51094 The <option>per_byte</option> option limits the sender’s email bandwidth. Note that it is
51095 best to use this option in the DATA ACL; if it is used in an earlier ACL it
51096 relies on the SIZE parameter specified by the client in its MAIL command,
51097 which may be inaccurate or completely missing. You can follow the limit <emphasis>m</emphasis>
51098 in the configuration with K, M, or G to specify limits in kilobytes,
51099 megabytes, or gigabytes, respectively.
51102 The <option>per_rcpt</option> option causes Exim to limit the rate at which
51103 recipients are accepted. To be effective, it would need to be used in
51104 either the <option>acl_smtp_rcpt</option> or the <option>acl_not_smtp</option> ACL. In the
51105 <option>acl_smtp_rcpt</option> ACL, the number of recipients is incremented by one.
51106 In the case of a locally submitted message in the <option>acl_not_smtp</option> ACL,
51107 the number of recipients is incremented by the <option>$recipients_count</option>
51108 for the entire message. Note that in either case the rate limiting
51109 engine will see a message with many recipients as a large high-speed
51113 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
51114 condition is processed. This can be used to limit the SMTP command rate.
51115 This command is essentially an alias of <option>per_rcpt</option> to make it clear
51116 that the effect is to limit the rate at which individual commands,
51117 rather than recipients, are accepted.
51120 <section id="ratophanfas">
51121 <title>Ratelimit options for handling fast clients</title>
51123 If a client’s average rate is greater than the maximum, the rate limiting
51124 engine can react in two possible ways, depending on the presence of the
51125 <option>strict</option> or <option>leaky</option> options. This is independent of the other
51126 counter-measures (such as rejecting the message) that may be specified by the
51127 rest of the ACL. The default mode is leaky, which avoids a sender’s
51128 over-aggressive retry rate preventing it from getting any email through.
51131 The <option>strict</option> option means that the client’s recorded rate is always
51132 updated. The effect of this is that Exim measures the client’s average rate
51133 of attempts to send email, which can be much higher than the maximum it is
51134 actually allowed. If the client is over the limit it may be subjected to
51135 counter-measures by the ACL until it slows down below the maximum rate. If
51136 the client stops attempting to send email for the time specified in the <emphasis>p</emphasis>
51137 parameter then its computed rate will decay exponentially to 37% of its peak
51138 value. You can work out the time (the number of smoothing periods) that a
51139 client is subjected to counter-measures after an over-limit burst with this
51142 <literallayout class="monospaced">
51143 ln(peakrate/maxrate)
51146 The <option>leaky</option> (default) option means that the client’s recorded rate is not
51147 updated if it is above the limit. The effect of this is that Exim measures the
51148 client’s average rate of successfully sent email, which cannot be greater than
51149 the maximum allowed. If the client is over the limit it may suffer some
51150 counter-measures (as specified in the ACL), but it will still be able to send
51151 email at the configured maximum rate, whatever the rate of its attempts. This
51152 is generally the better choice if you have clients that retry automatically.
51155 <section id="useratlim">
51156 <title>Using rate limiting</title>
51158 Exim’s other ACL facilities are used to define what counter-measures are taken
51159 when the rate limit is exceeded. This might be anything from logging a warning
51160 (for example, while measuring existing sending rates in order to define
51161 policy), through time delays to slow down fast senders, up to rejecting the
51162 message. For example:
51164 <literallayout class="monospaced">
51165 # Log all senders' rates
51166 warn ratelimit = 0 / 1h / strict
51167 log_message = Sender rate $sender_rate / $sender_rate_period
51169 # Slow down fast senders; note the need to truncate $sender_rate
51170 # at the decimal point.
51171 warn ratelimit = 100 / 1h / per_rcpt / strict
51172 delay = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
51173 $sender_rate_limit }s
51175 # Keep authenticated users under control
51176 deny authenticated = *
51177 ratelimit = 100 / 1d / strict / $authenticated_id
51179 # System-wide rate limit
51180 defer message = Sorry, too busy. Try again later.
51181 ratelimit = 10 / 1s / $primary_hostname
51183 # Restrict incoming rate from each host, with a default
51184 # set using a macro and special cases looked up in a table.
51185 defer message = Sender rate exceeds $sender_rate_limit \
51186 messages per $sender_rate_period
51187 ratelimit = ${lookup {$sender_host_address} \
51188 cdb {DB/ratelimits.cdb} \
51189 {$value} {RATELIMIT} }
51192 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
51193 especially with the <option>per_rcpt</option> option, you may suffer from a performance
51194 bottleneck caused by locking on the ratelimit hints database. Apart from
51195 making your ACLs less complicated, you can reduce the problem by using a
51196 RAM disk for Exim’s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
51197 this means that Exim will lose its hints data after a reboot (including retry
51198 hints, the callout cache, and ratelimit data).
51201 <section id="rearatdat">
51202 <title>Reading ratelimit data without updating</title>
51204 <indexterm role="concept">
51205 <primary>rate limitint</primary>
51206 <secondary>reading data without updating</secondary>
51208 If the <option>noupdate</option> option is present on a <option>ratelimit</option> ACL condition, Exim
51209 computes the rate and checks the limit as normal, but it does not update the
51210 saved data. This means that, in relevant ACLs, it is possible to lookup the
51211 existence of a specified (or auto-generated) ratelimit key without incrementing
51212 the ratelimit counter for that key. In order for this to be useful, another ACL
51213 entry must set the rate for the same key (otherwise it will always be zero).
51216 <literallayout class="monospaced">
51218 deny ratelimit = 100 / 5m / strict / per_cmd / noupdate
51219 log_message = RATE: $sender_rate/$sender_rate_period \
51220 (max $sender_rate_limit)
51223 <emphasis>... some other logic and tests...</emphasis>
51225 <literallayout class="monospaced">
51227 warn ratelimit = 100 / 5m / strict / per_cmd
51228 condition = ${if le{$sender_rate}{$sender_rate_limit}}
51229 logwrite = RATE UPDATE: $sender_rate/$sender_rate_period \
51230 (max $sender_rate_limit)
51233 In this example, the rate is tested and used to deny access (when it is too
51234 high) in the connect ACL, but the actual computation of the remembered rate
51235 happens later, on a per-command basis, in another ACL.
51238 <section id="SECTaddressverification">
51239 <title>Address verification</title>
51241 <indexterm role="concept">
51242 <primary>verifying address</primary>
51243 <secondary>options for</secondary>
51245 <indexterm role="concept">
51246 <primary>policy control</primary>
51247 <secondary>address verification</secondary>
51249 Several of the <option>verify</option> conditions described in section
51250 <xref linkend="SECTaclconditions"/> cause addresses to be verified. Section
51251 <xref linkend="SECTsenaddver"/> discusses the reporting of sender verification failures.
51252 The verification conditions can be followed by options that modify the
51253 verification process. The options are separated from the keyword and from each
51254 other by slashes, and some of them contain parameters. For example:
51256 <literallayout class="monospaced">
51257 verify = sender/callout
51258 verify = recipient/defer_ok/callout=10s,defer_ok
51261 The first stage of address verification, which always happens, is to run the
51262 address through the routers, in <quote>verify mode</quote>. Routers can detect the
51263 difference between verification and routing for delivery, and their actions can
51264 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
51265 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
51266 The available options are as follows:
51271 If the <option>callout</option> option is specified, successful routing to one or more
51272 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
51273 check. Callouts and their sub-options are discussed in the next section.
51278 If there is a defer error while doing verification routing, the ACL
51279 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
51280 options, the condition is forced to be true instead. Note that this is a main
51281 verification option as well as a suboption for callouts.
51286 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
51287 discusses the reporting of sender address verification failures.
51292 The <option>success_on_redirect</option> option causes verification always to succeed
51293 immediately after a successful redirection. By default, if a redirection
51294 generates just one address, that address is also verified. See further
51295 discussion in section <xref linkend="SECTredirwhilveri"/>.
51300 <indexterm role="concept">
51301 <primary>verifying address</primary>
51302 <secondary>differentiating failures</secondary>
51304 <indexterm role="variable">
51305 <primary><varname>$recipient_verify_failure</varname></primary>
51307 <indexterm role="variable">
51308 <primary><varname>$sender_verify_failure</varname></primary>
51310 <indexterm role="variable">
51311 <primary><varname>$acl_verify_message</varname></primary>
51313 After an address verification failure, <varname>$acl_verify_message</varname> contains the
51314 error message that is associated with the failure. It can be preserved by
51317 <literallayout class="monospaced">
51318 warn !verify = sender
51319 set acl_m0 = $acl_verify_message
51322 If you are writing your own custom rejection message or log message when
51323 denying access, you can use this variable to include information about the
51324 verification failure.
51327 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
51328 appropriate) contains one of the following words:
51333 <option>qualify</option>: The address was unqualified (no domain), and the message
51334 was neither local nor came from an exempted host.
51339 <option>route</option>: Routing failed.
51344 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
51345 occurred at or before the MAIL command (that is, on initial
51346 connection, HELO, or MAIL).
51351 <option>recipient</option>: The RCPT command in a callout was rejected.
51356 <option>postmaster</option>: The postmaster check in a callout was rejected.
51361 The main use of these variables is expected to be to distinguish between
51362 rejections of MAIL and rejections of RCPT in callouts.
51365 <section id="SECTcallver">
51366 <title>Callout verification</title>
51368 <indexterm role="concept">
51369 <primary>verifying address</primary>
51370 <secondary>by callout</secondary>
51372 <indexterm role="concept">
51373 <primary>callout</primary>
51374 <secondary>verification</secondary>
51376 <indexterm role="concept">
51377 <primary>SMTP</primary>
51378 <secondary>callout verification</secondary>
51380 For non-local addresses, routing verifies the domain, but is unable to do any
51381 checking of the local part. There are situations where some means of verifying
51382 the local part is desirable. One way this can be done is to make an SMTP
51383 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
51384 a subsequent host for a recipient address, to see if the host accepts the
51385 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
51386 sender address, the callback is not to the client host that is trying to
51387 deliver the message, but to one of the hosts that accepts incoming mail for the
51388 sender’s domain.
51391 Exim does not do callouts by default. If you want them to happen, you must
51392 request them by setting appropriate options on the <option>verify</option> condition, as
51393 described below. This facility should be used with care, because it can add a
51394 lot of resource usage to the cost of verifying an address. However, Exim does
51395 cache the results of callouts, which helps to reduce the cost. Details of
51396 caching are in section <xref linkend="SECTcallvercache"/>.
51399 Recipient callouts are usually used only between hosts that are controlled by
51400 the same administration. For example, a corporate gateway host could use
51401 callouts to check for valid recipients on an internal mailserver. A successful
51402 callout does not guarantee that a real delivery to the address would succeed;
51403 on the other hand, a failing callout does guarantee that a delivery would fail.
51406 If the <option>callout</option> option is present on a condition that verifies an address, a
51407 second stage of verification occurs if the address is successfully routed to
51408 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
51409 <command>manualroute</command> router, where the router specifies the hosts. However, if a
51410 router that does not set up hosts routes to an <command>smtp</command> transport with a
51411 <option>hosts</option> setting, the transport’s hosts are used. If an <command>smtp</command> transport has
51412 <option>hosts_override</option> set, its hosts are always used, whether or not the router
51413 supplies a host list.
51416 The port that is used is taken from the transport, if it is specified and is a
51417 remote transport. (For routers that do verification only, no transport need be
51418 specified.) Otherwise, the default SMTP port is used. If a remote transport
51419 specifies an outgoing interface, this is used; otherwise the interface is not
51420 specified. Likewise, the text that is used for the HELO command is taken from
51421 the transport’s <option>helo_data</option> option; if there is no transport, the value of
51422 <varname>$smtp_active_hostname</varname> is used.
51425 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
51426 test whether a bounce message could be delivered to the sender address. The
51427 following SMTP commands are sent:
51430 <literal>HELO </literal><<emphasis>local host name</emphasis>>
51431 <literal>MAIL FROM:<></literal>
51432 <literal>RCPT TO:</literal><<emphasis>the address to be tested</emphasis>>
51433 <literal>QUIT</literal>
51436 LHLO is used instead of HELO if the transport’s <option>protocol</option> option is
51437 set to <quote>lmtp</quote>.
51440 A recipient callout check is similar. By default, it also uses an empty address
51441 for the sender. This default is chosen because most hosts do not make use of
51442 the sender address when verifying a recipient. Using the same address means
51443 that a single cache entry can be used for each recipient. Some sites, however,
51444 do make use of the sender address when verifying. These are catered for by the
51445 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
51448 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
51449 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
51450 Exim tries the next host, if any. If there is a problem with all the remote
51451 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
51452 <option>callout</option> option is given, in which case the condition is forced to succeed.
51455 <indexterm role="concept">
51456 <primary>SMTP</primary>
51457 <secondary>output flushing, disabling for callout</secondary>
51459 A callout may take a little time. For this reason, Exim normally flushes SMTP
51460 output before performing a callout in an ACL, to avoid unexpected timeouts in
51461 clients when the SMTP PIPELINING extension is in use. The flushing can be
51462 disabled by using a <option>control</option> modifier to set <option>no_callout_flush</option>.
51465 <section id="CALLaddparcall">
51466 <title>Additional parameters for callouts</title>
51468 <indexterm role="concept">
51469 <primary>callout</primary>
51470 <secondary>additional parameters for</secondary>
51472 The <option>callout</option> option can be followed by an equals sign and a number of
51473 optional parameters, separated by commas. For example:
51475 <literallayout class="monospaced">
51476 verify = recipient/callout=10s,defer_ok
51479 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
51480 separate verify options, is retained for backwards compatibility, but is now
51481 deprecated. The additional parameters for <option>callout</option> are as follows:
51485 <term><<emphasis>a time interval</emphasis>></term>
51488 <indexterm role="concept">
51489 <primary>callout</primary>
51490 <secondary>timeout, specifying</secondary>
51492 This specifies the timeout that applies for the callout attempt to each host.
51495 <literallayout class="monospaced">
51496 verify = sender/callout=5s
51499 The default is 30 seconds. The timeout is used for each response from the
51500 remote host. It is also used for the initial connection, unless overridden by
51501 the <option>connect</option> parameter.
51503 </listitem></varlistentry>
51505 <term><emphasis role="bold">connect = </emphasis><<emphasis>time interval</emphasis>></term>
51508 <indexterm role="concept">
51509 <primary>callout</primary>
51510 <secondary>connection timeout, specifying</secondary>
51512 This parameter makes it possible to set a different (usually smaller) timeout
51513 for making the SMTP connection. For example:
51515 <literallayout class="monospaced">
51516 verify = sender/callout=5s,connect=1s
51519 If not specified, this timeout defaults to the general timeout value.
51521 </listitem></varlistentry>
51523 <term><emphasis role="bold">defer_ok</emphasis></term>
51526 <indexterm role="concept">
51527 <primary>callout</primary>
51528 <secondary>defer, action on</secondary>
51530 When this parameter is present, failure to contact any host, or any other kind
51531 of temporary error, is treated as success by the ACL. However, the cache is not
51532 updated in this circumstance.
51534 </listitem></varlistentry>
51536 <term><emphasis role="bold">fullpostmaster</emphasis></term>
51539 <indexterm role="concept">
51540 <primary>callout</primary>
51541 <secondary>full postmaster check</secondary>
51543 This operates like the <option>postmaster</option> option (see below), but if the check for
51544 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
51545 accordance with the specification in RFC 2821. The RFC states that the
51546 unqualified address <emphasis>postmaster</emphasis> should be accepted.
51548 </listitem></varlistentry>
51550 <term><emphasis role="bold">mailfrom = </emphasis><<emphasis>email address</emphasis>></term>
51553 <indexterm role="concept">
51554 <primary>callout</primary>
51555 <secondary>sender when verifying header</secondary>
51557 When verifying addresses in header lines using the <option>header_sender</option>
51558 verification option, Exim behaves by default as if the addresses are envelope
51559 sender addresses from a message. Callout verification therefore tests to see
51560 whether a bounce message could be delivered, by using an empty address in the
51561 MAIL command. However, it is arguable that these addresses might never be used
51562 as envelope senders, and could therefore justifiably reject bounce messages
51563 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
51564 address to use in the MAIL command. For example:
51566 <literallayout class="monospaced">
51567 require verify = header_sender/callout=mailfrom=abcd@x.y.z
51570 This parameter is available only for the <option>header_sender</option> verification option.
51572 </listitem></varlistentry>
51574 <term><emphasis role="bold">maxwait = </emphasis><<emphasis>time interval</emphasis>></term>
51577 <indexterm role="concept">
51578 <primary>callout</primary>
51579 <secondary>overall timeout, specifying</secondary>
51581 This parameter sets an overall timeout for performing a callout verification.
51584 <literallayout class="monospaced">
51585 verify = sender/callout=5s,maxwait=30s
51588 This timeout defaults to four times the callout timeout for individual SMTP
51589 commands. The overall timeout applies when there is more than one host that can
51590 be tried. The timeout is checked before trying the next host. This prevents
51591 very long delays if there are a large number of hosts and all are timing out
51592 (for example, when network connections are timing out).
51594 </listitem></varlistentry>
51596 <term><emphasis role="bold">no_cache</emphasis></term>
51599 <indexterm role="concept">
51600 <primary>callout</primary>
51601 <secondary>cache, suppressing</secondary>
51603 <indexterm role="concept">
51604 <primary>caching callout, suppressing</primary>
51606 When this parameter is given, the callout cache is neither read nor updated.
51608 </listitem></varlistentry>
51610 <term><emphasis role="bold">postmaster</emphasis></term>
51613 <indexterm role="concept">
51614 <primary>callout</primary>
51615 <secondary>postmaster; checking</secondary>
51617 When this parameter is set, a successful callout check is followed by a similar
51618 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
51619 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
51620 the postmaster check is recorded in a cache record; if it is a failure, this is
51621 used to fail subsequent callouts for the domain without a connection being
51622 made, until the cache record expires.
51624 </listitem></varlistentry>
51626 <term><emphasis role="bold">postmaster_mailfrom = </emphasis><<emphasis>email address</emphasis>></term>
51629 The postmaster check uses an empty sender in the MAIL command by default.
51630 You can use this parameter to do a postmaster check using a different address.
51633 <literallayout class="monospaced">
51634 require verify = sender/callout=postmaster_mailfrom=abc@x.y.z
51637 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
51638 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
51640 <literallayout class="monospaced">
51641 require verify = sender/callout=postmaster_mailfrom=
51644 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
51645 account of the sender address. It is assumed that either the empty address or
51646 a fixed non-empty address will be used. All that Exim remembers is that the
51647 postmaster check for the domain succeeded or failed.
51649 </listitem></varlistentry>
51651 <term><emphasis role="bold">random</emphasis></term>
51654 <indexterm role="concept">
51655 <primary>callout</primary>
51656 <secondary><quote>random</quote> check</secondary>
51658 When this parameter is set, before doing the normal callout check, Exim does a
51659 check for a <quote>random</quote> local part at the same domain. The local part is not
51660 really random – it is defined by the expansion of the option
51661 <option>callout_random_local_part</option>, which defaults to
51663 <literallayout class="monospaced">
51664 $primary_host_name-$tod_epoch-testing
51667 The idea here is to try to determine whether the remote host accepts all local
51668 parts without checking. If it does, there is no point in doing callouts for
51669 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
51670 a cache record, and used to force the current and subsequent callout checks to
51671 succeed without a connection being made, until the cache record expires.
51673 </listitem></varlistentry>
51675 <term><emphasis role="bold">use_postmaster</emphasis></term>
51678 <indexterm role="concept">
51679 <primary>callout</primary>
51680 <secondary>sender for recipient check</secondary>
51682 This parameter applies to recipient callouts only. For example:
51684 <literallayout class="monospaced">
51685 deny !verify = recipient/callout=use_postmaster
51688 <indexterm role="variable">
51689 <primary><varname>$qualify_domain</varname></primary>
51691 It causes a non-empty postmaster address to be used in the MAIL command when
51692 performing the callout for the recipient, and also for a <quote>random</quote> check if
51693 that is configured. The local part of the address is <literal>postmaster</literal> and the
51694 domain is the contents of <varname>$qualify_domain</varname>.
51696 </listitem></varlistentry>
51698 <term><emphasis role="bold">use_sender</emphasis></term>
51701 This option applies to recipient callouts only. For example:
51703 <literallayout class="monospaced">
51704 require verify = recipient/callout=use_sender
51707 It causes the message’s actual sender address to be used in the MAIL
51708 command when performing the callout, instead of an empty address. There is no
51709 need to use this option unless you know that the called hosts make use of the
51710 sender when checking recipients. If used indiscriminately, it reduces the
51711 usefulness of callout caching.
51713 </listitem></varlistentry>
51716 If you use any of the parameters that set a non-empty sender for the MAIL
51717 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
51718 <option>use_sender</option>), you should think about possible loops. Recipient checking is
51719 usually done between two hosts that are under the same management, and the host
51720 that receives the callouts is not normally configured to do callouts itself.
51721 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
51722 these circumstances.
51725 However, if you use a non-empty sender address for a callout to an arbitrary
51726 host, there is the likelihood that the remote host will itself initiate a
51727 callout check back to your host. As it is checking what appears to be a message
51728 sender, it is likely to use an empty address in MAIL, thus avoiding a
51729 callout loop. However, to be on the safe side it would be best to set up your
51730 own ACLs so that they do not do sender verification checks when the recipient
51731 is the address you use for header sender or postmaster callout checking.
51734 Another issue to think about when using non-empty senders for callouts is
51735 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
51736 by the sender/recipient combination; thus, for any given recipient, many more
51737 actual callouts are performed than when an empty sender or postmaster is used.
51740 <section id="SECTcallvercache">
51741 <title>Callout caching</title>
51743 <indexterm role="concept">
51744 <primary>hints database</primary>
51745 <secondary>callout cache</secondary>
51747 <indexterm role="concept">
51748 <primary>callout</primary>
51749 <secondary>cache, description of</secondary>
51751 <indexterm role="concept">
51752 <primary>caching</primary>
51753 <secondary>callout</secondary>
51755 Exim caches the results of callouts in order to reduce the amount of resources
51756 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
51757 option. A hints database called <quote>callout</quote> is used for the cache. Two
51758 different record types are used: one records the result of a callout check for
51759 a specific address, and the other records information that applies to the
51760 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
51763 When an original callout fails, a detailed SMTP error message is given about
51764 the failure. However, for subsequent failures use the cache data, this message
51768 The expiry times for negative and positive address cache records are
51769 independent, and can be set by the global options <option>callout_negative_expire</option>
51770 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
51773 If a host gives a negative response to an SMTP connection, or rejects any
51774 commands up to and including
51776 <literallayout class="monospaced">
51780 (but not including the MAIL command with a non-empty address),
51781 any callout attempt is bound to fail. Exim remembers such failures in a
51782 domain cache record, which it uses to fail callouts for the domain without
51783 making new connections, until the domain record times out. There are two
51784 separate expiry times for domain cache records:
51785 <option>callout_domain_negative_expire</option> (default 3h) and
51786 <option>callout_domain_positive_expire</option> (default 7d).
51789 Domain records expire when the negative expiry time is reached if callouts
51790 cannot be made for the domain, or if the postmaster check failed.
51791 Otherwise, they expire when the positive expiry time is reached. This
51792 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
51793 will eventually be noticed.
51796 The callout caching mechanism is based on the domain of the address that is
51797 being tested. If the domain routes to several hosts, it is assumed that their
51798 behaviour will be the same.
51801 <section id="SECTsenaddver">
51802 <title>Sender address verification reporting</title>
51804 <indexterm role="concept">
51805 <primary>verifying</primary>
51806 <secondary>suppressing error details</secondary>
51808 See section <xref linkend="SECTaddressverification"/> for a general discussion of
51809 verification. When sender verification fails in an ACL, the details of the
51810 failure are given as additional output lines before the 550 response to the
51811 relevant SMTP command (RCPT or DATA). For example, if sender callout is in use,
51814 <literallayout class="monospaced">
51815 MAIL FROM:<xyz@abc.example>
51817 RCPT TO:<pqr@def.example>
51818 550-Verification failed for <xyz@abc.example>
51819 550-Called: 192.168.34.43
51820 550-Sent: RCPT TO:<xyz@abc.example>
51821 550-Response: 550 Unknown local part xyz in <xyz@abc.example>
51822 550 Sender verification failed
51825 If more than one RCPT command fails in the same way, the details are given
51826 only for the first of them. However, some administrators do not want to send
51827 out this much information. You can suppress the details by adding
51828 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
51831 <literallayout class="monospaced">
51832 verify = sender/no_details
51835 <section id="SECTredirwhilveri">
51836 <title>Redirection while verifying</title>
51838 <indexterm role="concept">
51839 <primary>verifying</primary>
51840 <secondary>redirection while</secondary>
51842 <indexterm role="concept">
51843 <primary>address redirection</primary>
51844 <secondary>while verifying</secondary>
51846 A dilemma arises when a local address is redirected by aliasing or forwarding
51847 during verification: should the generated addresses themselves be verified,
51848 or should the successful expansion of the original address be enough to verify
51849 it? By default, Exim takes the following pragmatic approach:
51854 When an incoming address is redirected to just one child address, verification
51855 continues with the child address, and if that fails to verify, the original
51856 verification also fails.
51861 When an incoming address is redirected to more than one child address,
51862 verification does not continue. A success result is returned.
51867 This seems the most reasonable behaviour for the common use of aliasing as a
51868 way of redirecting different local parts to the same mailbox. It means, for
51869 example, that a pair of alias entries of the form
51871 <literallayout class="monospaced">
51873 aw123: :fail: Gone away, no forwarding address
51876 work as expected, with both local parts causing verification failure. When a
51877 redirection generates more than one address, the behaviour is more like a
51878 mailing list, where the existence of the alias itself is sufficient for
51879 verification to succeed.
51882 It is possible, however, to change the default behaviour so that all successful
51883 redirections count as successful verifications, however many new addresses are
51884 generated. This is specified by the <option>success_on_redirect</option> verification
51885 option. For example:
51887 <literallayout class="monospaced">
51888 require verify = recipient/success_on_redirect/callout=10s
51891 In this example, verification succeeds if a router generates a new address, and
51892 the callout does not occur, because no address was routed to a remote host.
51895 When verification is being tested via the <option>-bv</option> option, the treatment of
51896 redirections is as just described, unless the <option>-v</option> or any debugging option is
51897 also specified. In that case, full verification is done for every generated
51898 address and a report is output for each of them.
51901 <section id="SECTverifyCSA">
51902 <title>Client SMTP authorization (CSA)</title>
51904 <indexterm role="concept">
51905 <primary>CSA</primary>
51906 <secondary>verifying</secondary>
51908 Client SMTP Authorization is a system that allows a site to advertise
51909 which machines are and are not permitted to send email. This is done by placing
51910 special SRV records in the DNS; these are looked up using the client’s HELO
51911 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
51912 Authorization checks in Exim are performed by the ACL condition:
51914 <literallayout class="monospaced">
51918 This fails if the client is not authorized. If there is a DNS problem, or if no
51919 valid CSA SRV record is found, or if the client is authorized, the condition
51920 succeeds. These three cases can be distinguished using the expansion variable
51921 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
51922 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
51923 be likely to cause problems for legitimate email.
51926 The error messages produced by the CSA code include slightly more
51927 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
51928 looking up the CSA SRV record, or problems looking up the CSA target
51929 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
51934 The client’s host name is explicitly not authorized.
51939 The client’s IP address does not match any of the CSA target IP addresses.
51944 The client’s host name is authorized but it has no valid target IP addresses
51945 (for example, the target’s addresses are IPv6 and the client is using IPv4).
51950 The client’s host name has no CSA SRV record but a parent domain has asserted
51951 that all subdomains must be explicitly authorized.
51956 The <option>csa</option> verification condition can take an argument which is the domain to
51957 use for the DNS query. The default is:
51959 <literallayout class="monospaced">
51960 verify = csa/$sender_helo_name
51963 This implementation includes an extension to CSA. If the query domain
51964 is an address literal such as [192.0.2.95], or if it is a bare IP
51965 address, Exim searches for CSA SRV records in the reverse DNS as if
51966 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
51969 <literallayout class="monospaced">
51970 verify = csa/$sender_host_address
51973 In fact, this is the check that Exim performs if the client does not say HELO.
51974 This extension can be turned off by setting the main configuration option
51975 <option>dns_csa_use_reverse</option> to be false.
51978 If a CSA SRV record is not found for the domain itself, a search
51979 is performed through its parent domains for a record which might be
51980 making assertions about subdomains. The maximum depth of this search is limited
51981 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
51982 default. Exim does not look for CSA SRV records in a top level domain, so the
51983 default settings handle HELO domains as long as seven
51984 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
51985 of legitimate HELO domains.
51988 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
51989 direct SRV lookups, this is not sufficient because of the extra parent domain
51990 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
51991 addresses into lookups in the reverse DNS space. The result of a successful
51994 <literallayout class="monospaced">
51995 ${lookup dnsdb {csa=$sender_helo_name}}
51998 has two space-separated fields: an authorization code and a target host name.
51999 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
52000 authorization required but absent, or <quote>?</quote> for unknown.
52003 <section id="SECTverifyPRVS">
52004 <title>Bounce address tag validation</title>
52006 <indexterm role="concept">
52007 <primary>BATV, verifying</primary>
52009 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
52010 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
52011 Genuine incoming bounce messages should therefore always be addressed to
52012 recipients that have a valid tag. This scheme is a way of detecting unwanted
52013 bounce messages caused by sender address forgeries (often called <quote>collateral
52014 spam</quote>), because the recipients of such messages do not include valid tags.
52017 There are two expansion items to help with the implementation of the BATV
52018 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
52019 the original envelope sender address by using a simple key to add a hash of the
52020 address and some time-based randomizing information. The <option>prvs</option> expansion
52021 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
52022 The syntax of these expansion items is described in section
52023 <xref linkend="SECTexpansionitems"/>.
52026 As an example, suppose the secret per-address keys are stored in an MySQL
52027 database. A query to look up the key for an address could be defined as a macro
52030 <literallayout class="monospaced">
52031 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
52032 WHERE sender='${quote_mysql:$prvscheck_address}'\
52036 Suppose also that the senders who make use of BATV are defined by an address
52037 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
52040 <literallayout class="monospaced">
52041 # Bounces: drop unsigned addresses for BATV senders
52042 deny message = This address does not send an unsigned reverse path
52044 recipients = +batv_senders
52046 # Bounces: In case of prvs-signed address, check signature.
52047 deny message = Invalid reverse path signature.
52049 condition = ${prvscheck {$local_part@$domain}\
52050 {PRVSCHECK_SQL}{1}}
52051 !condition = $prvscheck_result
52054 The first statement rejects recipients for bounce messages that are addressed
52055 to plain BATV sender addresses, because it is known that BATV senders do not
52056 send out messages with plain sender addresses. The second statement rejects
52057 recipients that are prvs-signed, but with invalid signatures (either because
52058 the key is wrong, or the signature has timed out).
52061 A non-prvs-signed address is not rejected by the second statement, because the
52062 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
52063 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
52064 the first argument is a syntactically valid prvs-signed address, the yield is
52065 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
52066 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
52067 of the checks (empty for failure, <quote>1</quote> for success).
52070 There is one more issue you must consider when implementing prvs-signing:
52071 you have to ensure that the routers accept prvs-signed addresses and
52072 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
52073 router to remove the signature with a configuration along these lines:
52075 <literallayout class="monospaced">
52078 data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
52081 This works because, if the third argument of <option>prvscheck</option> is empty, the result
52082 of the expansion of a prvs-signed address is the decoded value of the original
52083 address. This router should probably be the first of your routers that handles
52087 To create BATV-signed addresses in the first place, a transport of this form
52090 <literallayout class="monospaced">
52091 external_smtp_batv:
52093 return_path = ${prvs {$return_path} \
52094 {${lookup mysql{SELECT \
52095 secret FROM batv_prvs WHERE \
52096 sender='${quote_mysql:$sender_address}'} \
52100 If no key can be found for the existing return path, no signing takes place.
52103 <section id="SECTrelaycontrol">
52104 <title>Using an ACL to control relaying</title>
52106 <indexterm role="concept">
52107 <primary>access control lists (ACLs)</primary>
52108 <secondary>relay control</secondary>
52110 <indexterm role="concept">
52111 <primary>relaying</primary>
52112 <secondary>control by ACL</secondary>
52114 <indexterm role="concept">
52115 <primary>policy control</primary>
52116 <secondary>relay control</secondary>
52118 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
52119 delivers it directly to another host as a result of a remote address contained
52120 within it. Redirecting a local address via an alias or forward file and then
52121 passing the message on to another host is not relaying,
52122 <indexterm role="concept">
52123 <primary><quote>percent hack</quote></primary>
52125 but a redirection as a result of the <quote>percent hack</quote> is.
52128 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
52129 A host which is acting as a gateway or an MX backup is concerned with incoming
52130 relaying from arbitrary hosts to a specific set of domains. On the other hand,
52131 a host which is acting as a smart host for a number of clients is concerned
52132 with outgoing relaying from those clients to the Internet at large. Often the
52133 same host is fulfilling both functions,
52134 but in principle these two kinds of relaying are entirely independent. What is
52135 not wanted is the transmission of mail from arbitrary remote hosts through your
52136 system to arbitrary domains.
52139 You can implement relay control by means of suitable statements in the ACL that
52140 runs for each RCPT command. For convenience, it is often easiest to use
52141 Exim’s named list facility to define the domains and hosts involved. For
52142 example, suppose you want to do the following:
52147 Deliver a number of domains to mailboxes on the local host (or process them
52148 locally in some other way). Let’s say these are <emphasis>my.dom1.example</emphasis> and
52149 <emphasis>my.dom2.example</emphasis>.
52154 Relay mail for a number of other domains for which you are the secondary MX.
52155 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
52160 Relay mail from the hosts on your local LAN, to whatever domains are involved.
52161 Suppose your LAN is 192.168.45.0/24.
52166 In the main part of the configuration, you put the following definitions:
52168 <literallayout class="monospaced">
52169 domainlist local_domains = my.dom1.example : my.dom2.example
52170 domainlist relay_domains = friend1.example : friend2.example
52171 hostlist relay_hosts = 192.168.45.0/24
52174 Now you can use these definitions in the ACL that is run for every RCPT
52177 <literallayout class="monospaced">
52179 accept domains = +local_domains : +relay_domains
52180 accept hosts = +relay_hosts
52183 The first statement accepts any RCPT command that contains an address in
52184 the local or relay domains. For any other domain, control passes to the second
52185 statement, which accepts the command only if it comes from one of the relay
52186 hosts. In practice, you will probably want to make your ACL more sophisticated
52187 than this, for example, by including sender and recipient verification. The
52188 default configuration includes a more comprehensive example, which is described
52189 in chapter <xref linkend="CHAPdefconfil"/>.
52192 <section id="SECTcheralcon">
52193 <title>Checking a relay configuration</title>
52195 <indexterm role="concept">
52196 <primary>relaying</primary>
52197 <secondary>checking control of</secondary>
52199 You can check the relay characteristics of your configuration in the same way
52200 that you can test any ACL behaviour for an incoming SMTP connection, by using
52201 the <option>-bh</option> option to run a fake SMTP session with which you interact.
52204 For specifically testing for unwanted relaying, the host
52205 <emphasis>relay-test.mail-abuse.org</emphasis> provides a useful service. If you telnet to this
52206 host from the host on which Exim is running, using the normal telnet port, you
52207 will see a normal telnet connection message and then quite a long delay. Be
52208 patient. The remote host is making an SMTP connection back to your host, and
52209 trying a number of common probes to test for open relay vulnerability. The
52210 results of the tests will eventually appear on your terminal.
52211 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
52216 <chapter id="CHAPexiscan">
52217 <title>Content scanning at ACL time</title>
52219 <indexterm role="concept" id="IIDcosca" class="startofrange">
52220 <primary>content scanning</primary>
52221 <secondary>at ACL time</secondary>
52223 The extension of Exim to include content scanning at ACL time, formerly known
52224 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
52225 was integrated into the main source for Exim release 4.50, and Tom continues to
52226 maintain it. Most of the wording of this chapter is taken from Tom’s
52230 It is also possible to scan the content of messages at other times. The
52231 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
52232 scanning after all the ACLs have run. A transport filter can be used to scan
52233 messages at delivery time (see the <option>transport_filter</option> option, described in
52234 chapter <xref linkend="CHAPtransportgeneric"/>).
52237 If you want to include the ACL-time content-scanning features when you compile
52238 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
52239 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
52244 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
52245 for all MIME parts for SMTP and non-SMTP messages, respectively.
52250 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
52251 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
52252 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
52257 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
52258 of messages, or parts of messages, for debugging purposes.
52263 Additional expansion variables that are set in the new ACL and by the new
52269 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
52274 There is another content-scanning configuration option for <filename>Local/Makefile</filename>,
52275 called WITH_OLD_DEMIME. If this is set, the old, deprecated <option>demime</option> ACL
52276 condition is compiled, in addition to all the other content-scanning features.
52279 Content-scanning is continually evolving, and new features are still being
52280 added. While such features are still unstable and liable to incompatible
52281 changes, they are made available in Exim by setting options whose names begin
52282 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
52283 this manual. You can find out about them by reading the file called
52284 <filename>doc/experimental.txt</filename>.
52287 All the content-scanning facilities work on a MBOX copy of the message that is
52288 temporarily created in a file called:
52291 <<emphasis>spool_directory</emphasis>><literal>/scan/</literal><<emphasis>message_id</emphasis>>/<<emphasis>message_id</emphasis>><literal>.eml</literal>
52294 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
52295 expect an MBOX-like structure inside that file. The file is created when the
52296 first content scanning facility is called. Subsequent calls to content
52297 scanning conditions open the same file again. The directory is recursively
52298 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
52300 <literallayout class="monospaced">
52301 control = no_mbox_unspool
52304 has been encountered. When the MIME ACL decodes files, they are put into the
52305 same directory by default.
52307 <section id="SECTscanvirus">
52308 <title>Scanning for viruses</title>
52310 <indexterm role="concept">
52311 <primary>virus scanning</primary>
52313 <indexterm role="concept">
52314 <primary>content scanning</primary>
52315 <secondary>for viruses</secondary>
52317 <indexterm role="concept">
52318 <primary>content scanning</primary>
52319 <secondary>the <option>malware</option> condition</secondary>
52321 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
52322 It supports a <quote>generic</quote> interface to scanners called via the shell, and
52323 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
52324 in memory and thus are much faster.
52327 <indexterm role="option">
52328 <primary><option>av_scanner</option></primary>
52330 You can set the <option>av_scanner</option> option in first part of the Exim configuration
52331 file to specify which scanner to use, together with any additional options that
52332 are needed. The basic syntax is as follows:
52335 <literal>av_scanner = <</literal><emphasis>scanner-type</emphasis><literal>>:<</literal><emphasis>option1</emphasis><literal>>:<</literal><emphasis>option2</emphasis><literal>>:[...]</literal>
52338 If you do not set <option>av_scanner</option>, it defaults to
52340 <literallayout class="monospaced">
52341 av_scanner = sophie:/var/run/sophie
52344 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
52345 before use. The following scanner types are supported in this release:
52349 <term><option>aveserver</option></term>
52352 <indexterm role="concept">
52353 <primary>virus scanners</primary>
52354 <secondary>Kaspersky</secondary>
52356 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
52357 at <emphasis role="bold"><ulink url="http://www.kaspersky.com">http://www.kaspersky.com</ulink></emphasis>. This scanner type takes one option,
52358 which is the path to the daemon’s UNIX socket. The default is shown in this
52361 <literallayout class="monospaced">
52362 av_scanner = aveserver:/var/run/aveserver
52364 </listitem></varlistentry>
52366 <term><option>clamd</option></term>
52369 <indexterm role="concept">
52370 <primary>virus scanners</primary>
52371 <secondary>clamd</secondary>
52373 This daemon-type scanner is GPL and free. You can get it at
52374 <emphasis role="bold"><ulink url="http://www.clamav.net/">http://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
52375 unpack MIME containers, so it used to be recommended to unpack MIME attachments
52376 in the MIME ACL. This no longer believed to be necessary. One option is
52377 required: either the path and name of a UNIX socket file, or a hostname or IP
52378 number, and a port, separated by space, as in the second of these examples:
52380 <literallayout class="monospaced">
52381 av_scanner = clamd:/opt/clamd/socket
52382 av_scanner = clamd:192.0.2.3 1234
52383 av_scanner = clamd:192.0.2.3 1234:local
52386 If the value of av_scanner points to a UNIX socket file or contains the local
52387 keyword, then the ClamAV interface will pass a filename containing the data
52388 to be scanned, which will should normally result in less I/O happening and be
52389 more efficient. Normally in the TCP case, the data is streamed to ClamAV as
52390 Exim does not assume that there is a common filesystem with the remote host.
52391 There is an option WITH_OLD_CLAMAV_STREAM in <filename>src/EDITME</filename> available, should
52392 you be running a version of ClamAV prior to 0.95.
52393 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
52394 contributing the code for this scanner.
52396 </listitem></varlistentry>
52398 <term><option>cmdline</option></term>
52401 <indexterm role="concept">
52402 <primary>virus scanners</primary>
52403 <secondary>command line interface</secondary>
52405 This is the keyword for the generic command line scanner interface. It can be
52406 used to attach virus scanners that are invoked from the shell. This scanner
52407 type takes 3 mandatory options:
52409 <orderedlist numeration="arabic">
52412 The full path and name of the scanner binary, with all command line options,
52413 and a placeholder (<literal>%s</literal>) for the directory to scan.
52418 A regular expression to match against the STDOUT and STDERR output of the
52419 virus scanner. If the expression matches, a virus was found. You must make
52420 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
52421 the <quote>trigger</quote> expression.
52426 Another regular expression, containing exactly one pair of parentheses, to
52427 match the name of the virus found in the scanners output. This is called the
52428 <quote>name</quote> expression.
52433 For example, Sophos Sweep reports a virus on a line like this:
52435 <literallayout class="monospaced">
52436 Virus 'W32/Magistr-B' found in file ./those.bat
52439 For the trigger expression, we can match the phrase <quote>found in file</quote>. For the
52440 name expression, we want to extract the W32/Magistr-B string, so we can match
52441 for the single quotes left and right of it. Altogether, this makes the
52442 configuration setting:
52444 <literallayout class="monospaced">
52445 av_scanner = cmdline:\
52446 /path/to/sweep -ss -all -rec -archive %s:\
52447 found in file:'(.+)'
52449 </listitem></varlistentry>
52451 <term><option>drweb</option></term>
52454 <indexterm role="concept">
52455 <primary>virus scanners</primary>
52456 <secondary>DrWeb</secondary>
52458 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="http://www.sald.com/">http://www.sald.com/</ulink></emphasis>) interface takes one
52459 argument, either a full path to a UNIX socket, or an IP address and port
52460 separated by white space, as in these examples:
52462 <literallayout class="monospaced">
52463 av_scanner = drweb:/var/run/drwebd.sock
52464 av_scanner = drweb:192.168.2.20 31337
52467 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
52468 is used. Thanks to Alex Miller for contributing the code for this scanner.
52470 </listitem></varlistentry>
52472 <term><option>fsecure</option></term>
52475 <indexterm role="concept">
52476 <primary>virus scanners</primary>
52477 <secondary>F-Secure</secondary>
52479 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="http://www.f-secure.com">http://www.f-secure.com</ulink></emphasis>) takes one
52480 argument which is the path to a UNIX socket. For example:
52482 <literallayout class="monospaced">
52483 av_scanner = fsecure:/path/to/.fsav
52486 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
52487 Thelmen for contributing the code for this scanner.
52489 </listitem></varlistentry>
52491 <term><option>kavdaemon</option></term>
52494 <indexterm role="concept">
52495 <primary>virus scanners</primary>
52496 <secondary>Kaspersky</secondary>
52498 This is the scanner daemon of Kaspersky Version 4. This version of the
52499 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
52500 scanner type takes one option, which is the path to the daemon’s UNIX socket.
52503 <literallayout class="monospaced">
52504 av_scanner = kavdaemon:/opt/AVP/AvpCtl
52507 The default path is <filename>/var/run/AvpCtl</filename>.
52509 </listitem></varlistentry>
52511 <term><option>mksd</option></term>
52514 <indexterm role="concept">
52515 <primary>virus scanners</primary>
52516 <secondary>mksd</secondary>
52518 This is a daemon type scanner that is aimed mainly at Polish users, though some
52519 parts of documentation are now available in English. You can get it at
52520 <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
52521 the maximum number of processes used simultaneously to scan the attachments,
52522 provided that the demime facility is employed and also provided that mksd has
52523 been run with at least the same number of child processes. For example:
52525 <literallayout class="monospaced">
52526 av_scanner = mksd:2
52529 You can safely omit this option (the default value is 1).
52531 </listitem></varlistentry>
52533 <term><option>sophie</option></term>
52536 <indexterm role="concept">
52537 <primary>virus scanners</primary>
52538 <secondary>Sophos and Sophie</secondary>
52540 Sophie is a daemon that uses Sophos’ <option>libsavi</option> library to scan for viruses.
52541 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
52542 for this scanner type is the path to the UNIX socket that Sophie uses for
52543 client communication. For example:
52545 <literallayout class="monospaced">
52546 av_scanner = sophie:/tmp/sophie
52549 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
52552 </listitem></varlistentry>
52555 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
52556 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
52560 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
52561 makes it possible to use different scanners. See further below for an example.
52562 The <option>malware</option> condition caches its results, so when you use it multiple times
52563 for the same message, the actual scanning process is only carried out once.
52564 However, using expandable items in <option>av_scanner</option> disables this caching, in
52565 which case each use of the <option>malware</option> condition causes a new scan of the
52569 The <option>malware</option> condition takes a right-hand argument that is expanded before
52570 use. It can then be one of
52575 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
52576 The condition succeeds if a virus was found, and fail otherwise. This is the
52582 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
52583 the condition fails immediately.
52588 A regular expression, in which case the message is scanned for viruses. The
52589 condition succeeds if a virus is found and its name matches the regular
52590 expression. This allows you to take special actions on certain types of virus.
52595 You can append <literal>/defer_ok</literal> to the <option>malware</option> condition to accept messages
52596 even if there is a problem with the virus scanner. Otherwise, such a problem
52597 causes the ACL to defer.
52600 <indexterm role="variable">
52601 <primary><varname>$malware_name</varname></primary>
52603 When a virus is found, the condition sets up an expansion variable called
52604 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
52605 <option>message</option> modifier that specifies the error returned to the sender, and/or in
52609 If your virus scanner cannot unpack MIME and TNEF containers itself, you should
52610 use the <option>demime</option> condition (see section <xref linkend="SECTdemimecond"/>) before the
52611 <option>malware</option> condition.
52614 Beware the interaction of Exim’s <option>message_size_limit</option> with any size limits
52615 imposed by your anti-virus scanner.
52618 Here is a very simple scanning example:
52620 <literallayout class="monospaced">
52621 deny message = This message contains malware ($malware_name)
52626 The next example accepts messages when there is a problem with the scanner:
52628 <literallayout class="monospaced">
52629 deny message = This message contains malware ($malware_name)
52631 malware = */defer_ok
52634 The next example shows how to use an ACL variable to scan with both sophie and
52635 aveserver. It assumes you have set:
52637 <literallayout class="monospaced">
52638 av_scanner = $acl_m0
52641 in the main Exim configuration.
52643 <literallayout class="monospaced">
52644 deny message = This message contains malware ($malware_name)
52645 set acl_m0 = sophie
52648 deny message = This message contains malware ($malware_name)
52649 set acl_m0 = aveserver
52653 <section id="SECTscanspamass">
52654 <title>Scanning with SpamAssassin</title>
52656 <indexterm role="concept">
52657 <primary>content scanning</primary>
52658 <secondary>for spam</secondary>
52660 <indexterm role="concept">
52661 <primary>spam scanning</primary>
52663 <indexterm role="concept">
52664 <primary>SpamAssassin</primary>
52666 The <option>spam</option> ACL condition calls SpamAssassin’s <option>spamd</option> daemon to get a spam
52667 score and a report for the message. You can get SpamAssassin at
52668 <emphasis role="bold"><ulink url="http://www.spamassassin.org">http://www.spamassassin.org</ulink></emphasis>, or, if you have a working Perl
52669 installation, you can use CPAN by running:
52671 <literallayout class="monospaced">
52672 perl -MCPAN -e 'install Mail::SpamAssassin'
52675 SpamAssassin has its own set of configuration files. Please review its
52676 documentation to see how you can tweak it. The default installation should work
52680 <indexterm role="option">
52681 <primary><option>spamd_address</option></primary>
52683 After having installed and configured SpamAssassin, start the <option>spamd</option> daemon.
52684 By default, it listens on 127.0.0.1, TCP port 783. If you use another host or
52685 port for <option>spamd</option>, you must set the <option>spamd_address</option> option in the global
52686 part of the Exim configuration as follows (example):
52688 <literallayout class="monospaced">
52689 spamd_address = 192.168.99.45 387
52692 You do not need to set this option if you use the default. As of version 2.60,
52693 <option>spamd</option> also supports communication over UNIX sockets. If you want to use
52694 these, supply <option>spamd_address</option> with an absolute file name instead of a
52697 <literallayout class="monospaced">
52698 spamd_address = /var/run/spamd_socket
52701 You can have multiple <option>spamd</option> servers to improve scalability. These can
52702 reside on other hardware reachable over the network. To specify multiple
52703 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
52704 option, separated with colons:
52706 <literallayout class="monospaced">
52707 spamd_address = 192.168.2.10 783 : \
52708 192.168.2.11 783 : \
52712 Up to 32 <option>spamd</option> servers are supported. The servers are queried in a random
52713 fashion. When a server fails to respond to the connection attempt, all other
52714 servers are tried until one succeeds. If no server responds, the <option>spam</option>
52718 <emphasis role="bold">Warning</emphasis>: It is not possible to use the UNIX socket connection method with
52719 multiple <option>spamd</option> servers.
52722 The <option>spamd_address</option> variable is expanded before use if it starts with
52723 a dollar sign. In this case, the expansion may return a string that is
52724 used as the list so that multiple spamd servers can be the result of an
52728 <section id="SECID206">
52729 <title>Calling SpamAssassin from an Exim ACL</title>
52731 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
52733 <literallayout class="monospaced">
52734 deny message = This message was classified as SPAM
52738 The right-hand side of the <option>spam</option> condition specifies a name. This is
52739 relevant if you have set up multiple SpamAssassin profiles. If you do not want
52740 to scan using a specific profile, but rather use the SpamAssassin system-wide
52741 default profile, you can scan for an unknown name, or simply use <quote>nobody</quote>.
52742 However, you must put something on the right-hand side.
52745 The name allows you to use per-domain or per-user antispam profiles in
52746 principle, but this is not straightforward in practice, because a message may
52747 have multiple recipients, not necessarily all in the same domain. Because the
52748 <option>spam</option> condition has to be called from a DATA ACL in order to be able to
52749 read the contents of the message, the variables <varname>$local_part</varname> and <varname>$domain</varname>
52753 The right-hand side of the <option>spam</option> condition is expanded before being used, so
52754 you can put lookups or conditions there. When the right-hand side evaluates to
52755 <quote>0</quote> or <quote>false</quote>, no scanning is done and the condition fails immediately.
52758 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
52759 large ones may cause significant performance degradation. As most spam messages
52760 are quite small, it is recommended that you do not scan the big ones. For
52763 <literallayout class="monospaced">
52764 deny message = This message was classified as SPAM
52765 condition = ${if < {$message_size}{10K}}
52769 The <option>spam</option> condition returns true if the threshold specified in the user’s
52770 SpamAssassin profile has been matched or exceeded. If you want to use the
52771 <option>spam</option> condition for its side effects (see the variables below), you can make
52772 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
52775 <indexterm role="concept">
52776 <primary>spam scanning</primary>
52777 <secondary>returned variables</secondary>
52779 When the <option>spam</option> condition is run, it sets up a number of expansion
52780 variables. These variables are saved with the received message, thus they are
52781 available for use at delivery time.
52785 <term><varname>$spam_score</varname></term>
52788 The spam score of the message, for example <quote>3.4</quote> or <quote>30.5</quote>. This is useful
52789 for inclusion in log or reject messages.
52791 </listitem></varlistentry>
52793 <term><varname>$spam_score_int</varname></term>
52796 The spam score of the message, multiplied by ten, as an integer value. For
52797 example <quote>34</quote> or <quote>305</quote>. It may appear to disagree with <varname>$spam_score</varname>
52798 because <varname>$spam_score</varname> is rounded and <varname>$spam_score_int</varname> is truncated.
52799 The integer value is useful for numeric comparisons in conditions.
52801 </listitem></varlistentry>
52803 <term><varname>$spam_bar</varname></term>
52806 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
52807 integer part of the spam score value. A spam score of 4.4 would have a
52808 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
52809 headers, since MUAs can match on such strings.
52811 </listitem></varlistentry>
52813 <term><varname>$spam_report</varname></term>
52816 A multiline text table, containing the full SpamAssassin report for the
52817 message. Useful for inclusion in headers or reject messages.
52819 </listitem></varlistentry>
52822 The <option>spam</option> condition caches its results unless expansion in
52823 spamd_address was used. If you call it again with the same user name, it
52824 does not scan again, but rather returns the same values as before.
52827 The <option>spam</option> condition returns DEFER if there is any error while running
52828 the message through SpamAssassin or if the expansion of spamd_address
52829 failed. If you want to treat DEFER as FAIL (to pass on to the next ACL
52830 statement block), append <literal>/defer_ok</literal> to the right-hand side of the
52831 spam condition, like this:
52833 <literallayout class="monospaced">
52834 deny message = This message was classified as SPAM
52835 spam = joe/defer_ok
52838 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
52841 Here is a longer, commented example of the use of the <option>spam</option>
52844 <literallayout class="monospaced">
52845 # put headers in all messages (no matter if spam or not)
52846 warn spam = nobody:true
52847 add_header = X-Spam-Score: $spam_score ($spam_bar)
52848 add_header = X-Spam-Report: $spam_report
52850 # add second subject line with *SPAM* marker when message
52851 # is over threshold
52853 add_header = Subject: *SPAM* $h_Subject:
52855 # reject spam at high scores (> 12)
52856 deny message = This message scored $spam_score spam points.
52858 condition = ${if >{$spam_score_int}{120}{1}{0}}
52861 <section id="SECTscanmimepart">
52862 <title>Scanning MIME parts</title>
52864 <indexterm role="concept">
52865 <primary>content scanning</primary>
52866 <secondary>MIME parts</secondary>
52868 <indexterm role="concept">
52869 <primary>MIME content scanning</primary>
52871 <indexterm role="option">
52872 <primary><option>acl_smtp_mime</option></primary>
52874 <indexterm role="option">
52875 <primary><option>acl_not_smtp_mime</option></primary>
52877 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
52878 each MIME part of an SMTP message, including multipart types, in the sequence
52879 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
52880 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
52881 options may both refer to the same ACL if you want the same processing in both
52885 These ACLs are called (possibly many times) just before the <option>acl_smtp_data</option>
52886 ACL in the case of an SMTP message, or just before the <option>acl_not_smtp</option> ACL in
52887 the case of a non-SMTP message. However, a MIME ACL is called only if the
52888 message contains a <emphasis>Content-Type:</emphasis> header line. When a call to a MIME
52889 ACL does not yield <quote>accept</quote>, ACL processing is aborted and the appropriate
52890 result code is sent to the client. In the case of an SMTP message, the
52891 <option>acl_smtp_data</option> ACL is not called when this happens.
52894 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
52895 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
52896 condition to match against the raw MIME part. You can also use the
52897 <option>mime_regex</option> condition to match against the decoded MIME part (see section
52898 <xref linkend="SECTscanregex"/>).
52901 At the start of a MIME ACL, a number of variables are set from the header
52902 information for the relevant MIME part. These are described below. The contents
52903 of the MIME part are not by default decoded into a disk file except for MIME
52904 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
52905 part into a disk file, you can use the <option>decode</option> condition. The general
52909 <literal>decode = [/</literal><<emphasis>path</emphasis>><literal>/]</literal><<emphasis>filename</emphasis>>
52912 The right hand side is expanded before use. After expansion,
52915 <orderedlist numeration="arabic">
52918 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
52923 The string <quote>default</quote>. In that case, the file is put in the temporary
52924 <quote>default</quote> directory <<emphasis>spool_directory</emphasis>><filename>/scan/</filename><<emphasis>message_id</emphasis>><filename>/</filename> with
52925 a sequential file name consisting of the message id and a sequence number. The
52926 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
52931 A full path name starting with a slash. If the full name is an existing
52932 directory, it is used as a replacement for the default directory. The filename
52933 is then sequentially assigned. If the path does not exist, it is used as
52934 the full path and file name.
52939 If the string does not start with a slash, it is used as the
52940 filename, and the default path is then used.
52945 The <option>decode</option> condition normally succeeds. It is only false for syntax
52946 errors or unusual circumstances such as memory shortages. You can easily decode
52947 a file with its original, proposed filename using
52949 <literallayout class="monospaced">
52950 decode = $mime_filename
52953 However, you should keep in mind that <varname>$mime_filename</varname> might contain
52954 anything. If you place files outside of the default path, they are not
52955 automatically unlinked.
52958 For RFC822 attachments (these are messages attached to messages, with a
52959 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
52960 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
52961 variable is set (see below). Attached messages are always decoded to disk
52962 before being checked, and the files are unlinked once the check is done.
52965 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
52966 used to match regular expressions against raw and decoded MIME parts,
52967 respectively. They are described in section <xref linkend="SECTscanregex"/>.
52970 <indexterm role="concept">
52971 <primary>MIME content scanning</primary>
52972 <secondary>returned variables</secondary>
52974 The following list describes all expansion variables that are
52975 available in the MIME ACL:
52979 <term><varname>$mime_boundary</varname></term>
52982 If the current part is a multipart (see <varname>$mime_is_multipart</varname>) below, it should
52983 have a boundary string, which is stored in this variable. If the current part
52984 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
52985 contains the empty string.
52987 </listitem></varlistentry>
52989 <term><varname>$mime_charset</varname></term>
52992 This variable contains the character set identifier, if one was found in the
52993 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
52995 <literallayout class="monospaced">
53001 Please note that this value is not normalized, so you should do matches
53002 case-insensitively.
53004 </listitem></varlistentry>
53006 <term><varname>$mime_content_description</varname></term>
53009 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
53010 header. It can contain a human-readable description of the parts content. Some
53011 implementations repeat the filename for attachments here, but they are usually
53012 only used for display purposes.
53014 </listitem></varlistentry>
53016 <term><varname>$mime_content_disposition</varname></term>
53019 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
53020 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
53022 </listitem></varlistentry>
53024 <term><varname>$mime_content_id</varname></term>
53027 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
53028 This is a unique ID that can be used to reference a part from another part.
53030 </listitem></varlistentry>
53032 <term><varname>$mime_content_size</varname></term>
53035 This variable is set only after the <option>decode</option> modifier (see above) has been
53036 successfully run. It contains the size of the decoded part in kilobytes. The
53037 size is always rounded up to full kilobytes, so only a completely empty part
53038 has a <varname>$mime_content_size</varname> of zero.
53040 </listitem></varlistentry>
53042 <term><varname>$mime_content_transfer_encoding</varname></term>
53045 This variable contains the normalized content of the
53046 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
53047 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
53049 </listitem></varlistentry>
53051 <term><varname>$mime_content_type</varname></term>
53054 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
53055 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
53056 are some examples of popular MIME types, as they may appear in this variable:
53058 <literallayout class="monospaced">
53061 application/octet-stream
53066 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
53069 </listitem></varlistentry>
53071 <term><varname>$mime_decoded_filename</varname></term>
53074 This variable is set only after the <option>decode</option> modifier (see above) has been
53075 successfully run. It contains the full path and file name of the file
53076 containing the decoded data.
53078 </listitem></varlistentry>
53081 <indexterm role="concept">
53082 <primary>RFC 2047</primary>
53087 <term><varname>$mime_filename</varname></term>
53090 This is perhaps the most important of the MIME variables. It contains a
53091 proposed filename for an attachment, if one was found in either the
53092 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
53093 RFC2047 decoded, but no additional sanity checks are done. If no filename was
53094 found, this variable contains the empty string.
53096 </listitem></varlistentry>
53098 <term><varname>$mime_is_coverletter</varname></term>
53101 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
53102 attached data. It can be used to clamp down on flashy or unnecessarily encoded
53103 content in the cover letter, while not restricting attachments at all.
53106 The variable contains 1 (true) for a MIME part believed to be part of the
53107 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
53110 <orderedlist numeration="arabic">
53113 The outermost MIME part of a message is always a cover letter.
53118 If a multipart/alternative or multipart/related MIME part is a cover letter,
53119 so are all MIME subparts within that multipart.
53124 If any other multipart is a cover letter, the first subpart is a cover letter,
53125 and the rest are attachments.
53130 All parts contained within an attachment multipart are attachments.
53135 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
53136 alternative plain text), while allowing HTML files to be attached. HTML
53137 coverletter mail attached to non-HMTL coverletter mail will also be allowed:
53139 <literallayout class="monospaced">
53140 deny message = HTML mail is not accepted here
53141 !condition = $mime_is_rfc822
53142 condition = $mime_is_coverletter
53143 condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
53145 </listitem></varlistentry>
53147 <term><varname>$mime_is_multipart</varname></term>
53150 This variable has the value 1 (true) when the current part has the main type
53151 <quote>multipart</quote>, for example <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
53152 Since multipart entities only serve as containers for other parts, you may not
53153 want to carry out specific actions on them.
53155 </listitem></varlistentry>
53157 <term><varname>$mime_is_rfc822</varname></term>
53160 This variable has the value 1 (true) if the current part is not a part of the
53161 checked message itself, but part of an attached message. Attached message
53162 decoding is fully recursive.
53164 </listitem></varlistentry>
53166 <term><varname>$mime_part_count</varname></term>
53169 This variable is a counter that is raised for each processed MIME part. It
53170 starts at zero for the very first part (which is usually a multipart). The
53171 counter is per-message, so it is reset when processing RFC822 attachments (see
53172 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
53173 complete, so you can use it in the DATA ACL to determine the number of MIME
53174 parts of a message. For non-MIME messages, this variable contains the value -1.
53176 </listitem></varlistentry>
53179 <section id="SECTscanregex">
53180 <title>Scanning with regular expressions</title>
53182 <indexterm role="concept">
53183 <primary>content scanning</primary>
53184 <secondary>with regular expressions</secondary>
53186 <indexterm role="concept">
53187 <primary>regular expressions</primary>
53188 <secondary>content scanning with</secondary>
53190 You can specify your own custom regular expression matches on the full body of
53191 the message, or on individual MIME parts.
53194 The <option>regex</option> condition takes one or more regular expressions as arguments and
53195 matches them against the full message (when called in the DATA ACL) or a raw
53196 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
53197 linewise, with a maximum line length of 32K characters. That means you cannot
53198 have multiline matches with the <option>regex</option> condition.
53201 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
53202 to 32K of decoded content (the whole content at once, not linewise). If the
53203 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
53204 is decoded automatically when <option>mime_regex</option> is executed (using default path
53205 and filename values). If the decoded data is larger than 32K, only the first
53206 32K characters are checked.
53209 The regular expressions are passed as a colon-separated list. To include a
53210 literal colon, you must double it. Since the whole right-hand side string is
53211 expanded before being used, you must also escape dollar signs and backslashes
53212 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
53213 Here is a simple example that contains two regular expressions:
53215 <literallayout class="monospaced">
53216 deny message = contains blacklisted regex ($regex_match_string)
53217 regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
53220 The conditions returns true if any one of the regular expressions matches. The
53221 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
53222 matching regular expression.
53225 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
53229 <section id="SECTdemimecond">
53230 <title>The demime condition</title>
53232 <indexterm role="concept">
53233 <primary>content scanning</primary>
53234 <secondary>MIME checking</secondary>
53236 <indexterm role="concept">
53237 <primary>MIME content scanning</primary>
53239 The <option>demime</option> ACL condition provides MIME unpacking, sanity checking and file
53240 extension blocking. It is usable only in the DATA and non-SMTP ACLs. The
53241 <option>demime</option> condition uses a simpler interface to MIME decoding than the MIME
53242 ACL functionality, but provides no additional facilities. Please note that this
53243 condition is deprecated and kept only for backward compatibility. You must set
53244 the WITH_OLD_DEMIME option in <filename>Local/Makefile</filename> at build time to be able to
53245 use the <option>demime</option> condition.
53248 The <option>demime</option> condition unpacks MIME containers in the message. It detects
53249 errors in MIME containers and can match file extensions found in the message
53250 against a list. Using this facility produces files containing the unpacked MIME
53251 parts of the message in the temporary scan directory. If you do antivirus
53252 scanning, it is recommended that you use the <option>demime</option> condition before the
53253 antivirus (<option>malware</option>) condition.
53256 On the right-hand side of the <option>demime</option> condition you can pass a
53257 colon-separated list of file extensions that it should match against. For
53260 <literallayout class="monospaced">
53261 deny message = Found blacklisted file attachment
53262 demime = vbs:com:bat:pif:prf:lnk
53265 If one of the file extensions is found, the condition is true, otherwise it is
53266 false. If there is a temporary error while demimeing (for example, <quote>disk
53267 full</quote>), the condition defers, and the message is temporarily rejected (unless
53268 the condition is on a <option>warn</option> verb).
53271 The right-hand side is expanded before being treated as a list, so you can have
53272 conditions and lookups there. If it expands to an empty string, <quote>false</quote>, or
53273 zero (<quote>0</quote>), no demimeing is done and the condition is false.
53276 The <option>demime</option> condition set the following variables:
53280 <term><varname>$demime_errorlevel</varname></term>
53283 <indexterm role="variable">
53284 <primary><varname>$demime_errorlevel</varname></primary>
53286 When an error is detected in a MIME container, this variable contains the
53287 severity of the error, as an integer number. The higher the value, the more
53288 severe the error (the current maximum value is 3). If this variable is unset or
53289 zero, no error occurred.
53291 </listitem></varlistentry>
53293 <term><varname>$demime_reason</varname></term>
53296 <indexterm role="variable">
53297 <primary><varname>$demime_reason</varname></primary>
53299 When <varname>$demime_errorlevel</varname> is greater than zero, this variable contains a
53300 human-readable text string describing the MIME error that occurred.
53302 </listitem></varlistentry>
53306 <term><varname>$found_extension</varname></term>
53309 <indexterm role="variable">
53310 <primary><varname>$found_extension</varname></primary>
53312 When the <option>demime</option> condition is true, this variable contains the file
53313 extension it found.
53315 </listitem></varlistentry>
53318 Both <varname>$demime_errorlevel</varname> and <varname>$demime_reason</varname> are set by the first call of
53319 the <option>demime</option> condition, and are not changed on subsequent calls.
53322 If you do not want to check for file extensions, but rather use the <option>demime</option>
53323 condition for unpacking or error checking purposes, pass <quote>*</quote> as the
53324 right-hand side value. Here is a more elaborate example of how to use this
53327 <literallayout class="monospaced">
53328 # Reject messages with serious MIME container errors
53329 deny message = Found MIME error ($demime_reason).
53331 condition = ${if >{$demime_errorlevel}{2}{1}{0}}
53333 # Reject known virus spreading file extensions.
53334 # Accepting these is pretty much braindead.
53335 deny message = contains $found_extension file (blacklisted).
53336 demime = com:vbs:bat:pif:scr
53338 # Freeze .exe and .doc files. Postmaster can
53339 # examine them and eventually thaw them.
53340 deny log_message = Another $found_extension file.
53345 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
53350 <chapter id="CHAPlocalscan">
53351 <title>Adding a local scan function to Exim</title>
53352 <titleabbrev>Local scan function</titleabbrev>
53354 <indexterm role="concept" id="IIDlosca" class="startofrange">
53355 <primary><function>local_scan()</function> function</primary>
53356 <secondary>description of</secondary>
53358 <indexterm role="concept">
53359 <primary>customizing</primary>
53360 <secondary>input scan using C function</secondary>
53362 <indexterm role="concept">
53363 <primary>policy control</primary>
53364 <secondary>by local scan function</secondary>
53366 In these days of email worms, viruses, and ever-increasing spam, some sites
53367 want to apply a lot of checking to messages before accepting them.
53370 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
53371 passing messages to external virus and spam scanning software. You can also do
53372 a certain amount in Exim itself through string expansions and the <option>condition</option>
53373 condition in the ACL that runs after the SMTP DATA command or the ACL for
53374 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
53377 To allow for further customization to a site’s own requirements, there is the
53378 possibility of linking Exim with a private message scanning function, written
53379 in C. If you want to run code that is written in something other than C, you
53380 can of course use a little C stub to call it.
53383 The local scan function is run once for every incoming message, at the point
53384 when Exim is just about to accept the message.
53385 It can therefore be used to control non-SMTP messages from local processes as
53386 well as messages arriving via SMTP.
53389 Exim applies a timeout to calls of the local scan function, and there is an
53390 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
53391 Zero means <quote>no timeout</quote>.
53392 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
53393 before calling the local scan function, so that the most common types of crash
53394 are caught. If the timeout is exceeded or one of those signals is caught, the
53395 incoming message is rejected with a temporary error if it is an SMTP message.
53396 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
53397 code. The incident is logged on the main and reject logs.
53399 <section id="SECID207">
53400 <title>Building Exim to use a local scan function</title>
53402 <indexterm role="concept">
53403 <primary><function>local_scan()</function> function</primary>
53404 <secondary>building Exim to use</secondary>
53406 To make use of the local scan function feature, you must tell Exim where your
53407 function is before building Exim, by setting LOCAL_SCAN_SOURCE in your
53408 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
53409 directory, so you might set
53411 <literallayout class="monospaced">
53412 LOCAL_SCAN_SOURCE=Local/local_scan.c
53415 for example. The function must be called <function>local_scan()</function>. It is called by
53416 Exim after it has received a message, when the success return code is about to
53417 be sent. This is after all the ACLs have been run. The return code from your
53418 function controls whether the message is actually accepted or not. There is a
53419 commented template function (that just accepts the message) in the file
53420 _src/local_scan.c_.
53423 If you want to make use of Exim’s run time configuration file to set options
53424 for your <function>local_scan()</function> function, you must also set
53426 <literallayout class="monospaced">
53427 LOCAL_SCAN_HAS_OPTIONS=yes
53430 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
53433 <section id="SECTapiforloc">
53434 <title>API for local_scan()</title>
53436 <indexterm role="concept">
53437 <primary><function>local_scan()</function> function</primary>
53438 <secondary>API description</secondary>
53440 You must include this line near the start of your code:
53442 <literallayout class="monospaced">
53443 #include "local_scan.h"
53446 This header file defines a number of variables and other values, and the
53447 prototype for the function itself. Exim is coded to use unsigned char values
53448 almost exclusively, and one of the things this header defines is a shorthand
53449 for <literal>unsigned char</literal> called <literal>uschar</literal>.
53450 It also contains the following macro definitions, to simplify casting character
53451 strings and pointers to character strings:
53453 <literallayout class="monospaced">
53454 #define CS (char *)
53455 #define CCS (const char *)
53456 #define CSS (char **)
53457 #define US (unsigned char *)
53458 #define CUS (const unsigned char *)
53459 #define USS (unsigned char **)
53462 The function prototype for <function>local_scan()</function> is:
53464 <literallayout class="monospaced">
53465 extern int local_scan(int fd, uschar **return_text);
53468 The arguments are as follows:
53473 <option>fd</option> is a file descriptor for the file that contains the body of the message
53474 (the -D file). The file is open for reading and writing, but updating it is not
53475 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
53478 The descriptor is positioned at character 19 of the file, which is the first
53479 character of the body itself, because the first 19 characters are the message
53480 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
53481 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
53482 case this changes in some future version.
53487 <option>return_text</option> is an address which you can use to return a pointer to a text
53488 string at the end of the function. The value it points to on entry is NULL.
53493 The function must return an <option>int</option> value which is one of the following macros:
53497 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
53500 <indexterm role="variable">
53501 <primary><varname>$local_scan_data</varname></primary>
53503 The message is accepted. If you pass back a string of text, it is saved with
53504 the message, and made available in the variable <varname>$local_scan_data</varname>. No
53505 newlines are permitted (if there are any, they are turned into spaces) and the
53506 maximum length of text is 1000 characters.
53508 </listitem></varlistentry>
53510 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
53513 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
53514 queued without immediate delivery, and is frozen.
53516 </listitem></varlistentry>
53518 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
53521 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
53522 queued without immediate delivery.
53524 </listitem></varlistentry>
53526 <term><literal>LOCAL_SCAN_REJECT</literal></term>
53529 The message is rejected; the returned text is used as an error message which is
53530 passed back to the sender and which is also logged. Newlines are permitted –
53531 they cause a multiline response for SMTP rejections, but are converted to
53532 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
53535 </listitem></varlistentry>
53537 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
53540 The message is temporarily rejected; the returned text is used as an error
53541 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
53542 problem</quote> is used.
53544 </listitem></varlistentry>
53546 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
53549 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
53550 message is not written to the reject log. It has the effect of unsetting the
53551 <option>rejected_header</option> log selector for just this rejection. If
53552 <option>rejected_header</option> is already unset (see the discussion of the
53553 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
53554 same as LOCAL_SCAN_REJECT.
53556 </listitem></varlistentry>
53558 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
53561 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
53562 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
53564 </listitem></varlistentry>
53567 If the message is not being received by interactive SMTP, rejections are
53568 reported by writing to <option>stderr</option> or by sending an email, as configured by the
53569 <option>-oe</option> command line options.
53572 <section id="SECTconoptloc">
53573 <title>Configuration options for local_scan()</title>
53575 <indexterm role="concept">
53576 <primary><function>local_scan()</function> function</primary>
53577 <secondary>configuration options</secondary>
53579 It is possible to have option settings in the main configuration file
53580 that set values in static variables in the <function>local_scan()</function> module. If you
53581 want to do this, you must have the line
53583 <literallayout class="monospaced">
53584 LOCAL_SCAN_HAS_OPTIONS=yes
53587 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
53588 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
53589 file, you must define static variables to hold the option values, and a table
53593 The table must be a vector called <option>local_scan_options</option>, of type
53594 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
53595 and a pointer to the variable that holds the value. The entries must appear in
53596 alphabetical order. Following <option>local_scan_options</option> you must also define a
53597 variable called <option>local_scan_options_count</option> that contains the number of
53598 entries in the table. Here is a short example, showing two kinds of option:
53600 <literallayout class="monospaced">
53601 static int my_integer_option = 42;
53602 static uschar *my_string_option = US"a default string";
53604 optionlist local_scan_options[] = {
53605 { "my_integer", opt_int, &my_integer_option },
53606 { "my_string", opt_stringptr, &my_string_option }
53609 int local_scan_options_count =
53610 sizeof(local_scan_options)/sizeof(optionlist);
53613 The values of the variables can now be changed from Exim’s runtime
53614 configuration file by including a local scan section as in this example:
53616 <literallayout class="monospaced">
53619 my_string = some string of text...
53622 The available types of option data are as follows:
53626 <term><emphasis role="bold">opt_bool</emphasis></term>
53629 This specifies a boolean (true/false) option. The address should point to a
53630 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
53631 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
53632 whether such a variable has been set at all, you can initialize it to
53633 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
53636 </listitem></varlistentry>
53638 <term><emphasis role="bold">opt_fixed</emphasis></term>
53641 This specifies a fixed point number, such as is used for load averages.
53642 The address should point to a variable of type <literal>int</literal>. The value is stored
53643 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
53645 </listitem></varlistentry>
53647 <term><emphasis role="bold">opt_int</emphasis></term>
53650 This specifies an integer; the address should point to a variable of type
53651 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
53654 </listitem></varlistentry>
53656 <term><emphasis role="bold">opt_mkint</emphasis></term>
53659 This is the same as <option>opt_int</option>, except that when such a value is output in a
53660 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
53661 printed with the suffix K or M.
53663 </listitem></varlistentry>
53665 <term><emphasis role="bold">opt_octint</emphasis></term>
53668 This also specifies an integer, but the value is always interpreted as an
53669 octal integer, whether or not it starts with the digit zero, and it is
53670 always output in octal.
53672 </listitem></varlistentry>
53674 <term><emphasis role="bold">opt_stringptr</emphasis></term>
53677 This specifies a string value; the address must be a pointer to a
53678 variable that points to a string (for example, of type <literal>uschar *</literal>).
53680 </listitem></varlistentry>
53682 <term><emphasis role="bold">opt_time</emphasis></term>
53685 This specifies a time interval value. The address must point to a variable of
53686 type <literal>int</literal>. The value that is placed there is a number of seconds.
53688 </listitem></varlistentry>
53691 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
53692 out the values of all the <function>local_scan()</function> options.
53695 <section id="SECID208">
53696 <title>Available Exim variables</title>
53698 <indexterm role="concept">
53699 <primary><function>local_scan()</function> function</primary>
53700 <secondary>available Exim variables</secondary>
53702 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
53703 are the only ones that are guaranteed to be maintained from release to release.
53704 Note, however, that you can obtain the value of any Exim expansion variable,
53705 including <varname>$recipients</varname>, by calling <emphasis>expand_string()</emphasis>. The exported
53706 C variables are as follows:
53710 <term><emphasis role="bold">int body_linecount</emphasis></term>
53713 This variable contains the number of lines in the message’s body.
53715 </listitem></varlistentry>
53717 <term><emphasis role="bold">int body_zerocount</emphasis></term>
53720 This variable contains the number of binary zero bytes in the message’s body.
53722 </listitem></varlistentry>
53724 <term><emphasis role="bold">unsigned int debug_selector</emphasis></term>
53727 This variable is set to zero when no debugging is taking place. Otherwise, it
53728 is a bitmap of debugging selectors. Two bits are identified for use in
53729 <function>local_scan()</function>; they are defined as macros:
53734 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
53735 testing option that is not privileged – any caller may set it. All the
53736 other selector bits can be set only by admin users.
53741 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
53742 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
53748 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
53749 selected, you should use code like this:
53751 <literallayout class="monospaced">
53752 if ((debug_selector & D_local_scan) != 0)
53753 debug_printf("xxx", ...);
53755 </listitem></varlistentry>
53757 <term><emphasis role="bold">uschar *expand_string_message</emphasis></term>
53760 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
53761 variable <option>expand_string_message</option> contains the error message, zero-terminated.
53763 </listitem></varlistentry>
53765 <term><emphasis role="bold">header_line *header_list</emphasis></term>
53768 A pointer to a chain of header lines. The <option>header_line</option> structure is
53771 </listitem></varlistentry>
53773 <term><emphasis role="bold">header_line *header_last</emphasis></term>
53776 A pointer to the last of the header lines.
53778 </listitem></varlistentry>
53780 <term><emphasis role="bold">uschar *headers_charset</emphasis></term>
53783 The value of the <option>headers_charset</option> configuration option.
53785 </listitem></varlistentry>
53787 <term><emphasis role="bold">BOOL host_checking</emphasis></term>
53790 This variable is TRUE during a host checking session that is initiated by the
53791 <option>-bh</option> command line option.
53793 </listitem></varlistentry>
53795 <term><emphasis role="bold">uschar *interface_address</emphasis></term>
53798 The IP address of the interface that received the message, as a string. This
53799 is NULL for locally submitted messages.
53801 </listitem></varlistentry>
53803 <term><emphasis role="bold">int interface_port</emphasis></term>
53806 The port on which this message was received. When testing with the <option>-bh</option>
53807 command line option, the value of this variable is -1 unless a port has been
53808 specified via the <option>-oMi</option> option.
53810 </listitem></varlistentry>
53812 <term><emphasis role="bold">uschar *message_id</emphasis></term>
53815 This variable contains Exim’s message id for the incoming message (the value of
53816 <varname>$message_exim_id</varname>) as a zero-terminated string.
53818 </listitem></varlistentry>
53820 <term><emphasis role="bold">uschar *received_protocol</emphasis></term>
53823 The name of the protocol by which the message was received.
53825 </listitem></varlistentry>
53827 <term><emphasis role="bold">int recipients_count</emphasis></term>
53830 The number of accepted recipients.
53832 </listitem></varlistentry>
53834 <term><emphasis role="bold">recipient_item *recipients_list</emphasis></term>
53837 <indexterm role="concept">
53838 <primary>recipient</primary>
53839 <secondary>adding in local scan</secondary>
53841 <indexterm role="concept">
53842 <primary>recipient</primary>
53843 <secondary>removing in local scan</secondary>
53845 The list of accepted recipients, held in a vector of length
53846 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
53847 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
53848 below). You can delete recipients by removing them from the vector and
53849 adjusting the value in <option>recipients_count</option>. In particular, by setting
53850 <option>recipients_count</option> to zero you remove all recipients. If you then return the
53851 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
53852 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
53853 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
53855 </listitem></varlistentry>
53857 <term><emphasis role="bold">uschar *sender_address</emphasis></term>
53860 The envelope sender address. For bounce messages this is the empty string.
53862 </listitem></varlistentry>
53864 <term><emphasis role="bold">uschar *sender_host_address</emphasis></term>
53867 The IP address of the sending host, as a string. This is NULL for
53868 locally-submitted messages.
53870 </listitem></varlistentry>
53872 <term><emphasis role="bold">uschar *sender_host_authenticated</emphasis></term>
53875 The name of the authentication mechanism that was used, or NULL if the message
53876 was not received over an authenticated SMTP connection.
53878 </listitem></varlistentry>
53880 <term><emphasis role="bold">uschar *sender_host_name</emphasis></term>
53883 The name of the sending host, if known.
53885 </listitem></varlistentry>
53887 <term><emphasis role="bold">int sender_host_port</emphasis></term>
53890 The port on the sending host.
53892 </listitem></varlistentry>
53894 <term><emphasis role="bold">BOOL smtp_input</emphasis></term>
53897 This variable is TRUE for all SMTP input, including BSMTP.
53899 </listitem></varlistentry>
53901 <term><emphasis role="bold">BOOL smtp_batched_input</emphasis></term>
53904 This variable is TRUE for BSMTP input.
53906 </listitem></varlistentry>
53908 <term><emphasis role="bold">int store_pool</emphasis></term>
53911 The contents of this variable control which pool of memory is used for new
53912 requests. See section <xref linkend="SECTmemhanloc"/> for details.
53914 </listitem></varlistentry>
53917 <section id="SECID209">
53918 <title>Structure of header lines</title>
53920 The <option>header_line</option> structure contains the members listed below.
53921 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
53922 (see below). You can cause header lines to be ignored (deleted) by setting
53927 <term><emphasis role="bold">struct header_line *next</emphasis></term>
53930 A pointer to the next header line, or NULL for the last line.
53932 </listitem></varlistentry>
53934 <term><emphasis role="bold">int type</emphasis></term>
53937 A code identifying certain headers that Exim recognizes. The codes are printing
53938 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
53939 Notice in particular that any header line whose type is * is not transmitted
53940 with the message. This flagging is used for header lines that have been
53941 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
53942 lines.) Effectively, * means <quote>deleted</quote>.
53944 </listitem></varlistentry>
53946 <term><emphasis role="bold">int slen</emphasis></term>
53949 The number of characters in the header line, including the terminating and any
53952 </listitem></varlistentry>
53954 <term><emphasis role="bold">uschar *text</emphasis></term>
53957 A pointer to the text of the header. It always ends with a newline, followed by
53958 a zero byte. Internal newlines are preserved.
53960 </listitem></varlistentry>
53963 <section id="SECID210">
53964 <title>Structure of recipient items</title>
53966 The <option>recipient_item</option> structure contains these members:
53970 <term><emphasis role="bold">uschar *address</emphasis></term>
53973 This is a pointer to the recipient address as it was received.
53975 </listitem></varlistentry>
53977 <term><emphasis role="bold">int pno</emphasis></term>
53980 This is used in later Exim processing when top level addresses are created by
53981 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
53982 and must always contain -1 at this stage.
53984 </listitem></varlistentry>
53986 <term><emphasis role="bold">uschar *errors_to</emphasis></term>
53989 If this value is not NULL, bounce messages caused by failing to deliver to the
53990 recipient are sent to the address it contains. In other words, it overrides the
53991 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
53992 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
53993 an unqualified address, Exim qualifies it using the domain from
53994 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
53995 is NULL for all recipients.
53997 </listitem></varlistentry>
54000 <section id="SECID211">
54001 <title>Available Exim functions</title>
54003 <indexterm role="concept">
54004 <primary><function>local_scan()</function> function</primary>
54005 <secondary>available Exim functions</secondary>
54007 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
54008 These are the only ones that are guaranteed to be maintained from release to
54013 <term><emphasis role="bold">pid_t child_open(uschar **argv, uschar **envp, int newumask, int *infdptr, int *outfdptr, BOOL make_leader)</emphasis></term>
54016 This function creates a child process that runs the command specified by
54017 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
54018 be NULL if no environment variables are to be passed. A new umask is supplied
54019 for the process in <option>newumask</option>.
54022 Pipes to the standard input and output of the new process are set up
54023 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
54024 standard error is cloned to the standard output. If there are any file
54025 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
54026 argument is TRUE, the new process is made into a process group leader.
54029 The function returns the pid of the new process, or -1 if things go wrong.
54031 </listitem></varlistentry>
54033 <term><emphasis role="bold">int child_close(pid_t pid, int timeout)</emphasis></term>
54036 This function waits for a child process to terminate, or for a timeout (in
54037 seconds) to expire. A timeout value of zero means wait as long as it takes. The
54038 return value is as follows:
54046 The process terminated by a normal exit and the value is the process
54052 < 0 and > –256
54055 The process was terminated by a signal and the value is the negation of the
54064 The process timed out.
54072 The was some other error in wait(); <option>errno</option> is still set.
54076 </listitem></varlistentry>
54078 <term><emphasis role="bold">pid_t child_open_exim(int *fd)</emphasis></term>
54081 This function provide you with a means of submitting a new message to
54082 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
54083 want, but this packages it all up for you.) The function creates a pipe,
54084 forks a subprocess that is running
54086 <literallayout class="monospaced">
54087 exim -t -oem -oi -f <>
54090 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
54091 that is connected to the standard input. The yield of the function is the PID
54092 of the subprocess. You can then write a message to the file descriptor, with
54093 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
54096 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
54097 finish and to collect its ending status. A timeout value of zero is usually
54098 fine in this circumstance. Unless you have made a mistake with the recipient
54099 addresses, you should get a return code of zero.
54101 </listitem></varlistentry>
54103 <term><emphasis role="bold">pid_t child_open_exim2(int *fd, uschar *sender, uschar *sender_authentication)</emphasis></term>
54106 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
54110 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
54113 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
54115 </listitem></varlistentry>
54117 <term><emphasis role="bold">void debug_printf(char *, ...)</emphasis></term>
54120 This is Exim’s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
54121 output is written to the standard error stream. If no debugging is selected,
54122 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
54123 conditional on the <literal>local_scan</literal> debug selector by coding like this:
54125 <literallayout class="monospaced">
54126 if ((debug_selector & D_local_scan) != 0)
54127 debug_printf("xxx", ...);
54129 </listitem></varlistentry>
54131 <term><emphasis role="bold">uschar *expand_string(uschar *string)</emphasis></term>
54134 This is an interface to Exim’s string expansion code. The return value is the
54135 expanded string, or NULL if there was an expansion failure.
54136 The C variable <option>expand_string_message</option> contains an error message after an
54137 expansion failure. If expansion does not change the string, the return value is
54138 the pointer to the input string. Otherwise, the return value points to a new
54139 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
54140 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
54142 </listitem></varlistentry>
54144 <term><emphasis role="bold">void header_add(int type, char *format, ...)</emphasis></term>
54147 This function allows you to an add additional header line at the end of the
54148 existing ones. The first argument is the type, and should normally be a space
54149 character. The second argument is a format string and any number of
54150 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
54151 if you want, and you must ensure that the string ends with a newline.
54153 </listitem></varlistentry>
54155 <term><emphasis role="bold">void header_add_at_position(BOOL after, uschar *name, BOOL topnot, int type, char *format, ...)</emphasis></term>
54158 This function adds a new header line at a specified point in the header
54159 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
54162 If <option>name</option> is NULL, the new header is added at the end of the chain if
54163 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
54164 NULL, the header lines are searched for the first non-deleted header that
54165 matches the name. If one is found, the new header is added before it if
54166 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
54167 found header and any adjacent subsequent ones with the same name (even if
54168 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
54169 option controls where the header is added. If it is true, addition is at the
54170 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
54171 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
54173 <literallayout class="monospaced">
54174 header_add_at_position(TRUE, US"Received", TRUE,
54175 ' ', "X-xxx: ...");
54178 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
54179 there may not be if <option>received_header_text</option> expands to an empty string.
54181 </listitem></varlistentry>
54183 <term><emphasis role="bold">void header_remove(int occurrence, uschar *name)</emphasis></term>
54186 This function removes header lines. If <option>occurrence</option> is zero or negative, all
54187 occurrences of the header are removed. If occurrence is greater than zero, that
54188 particular instance of the header is removed. If no header(s) can be found that
54189 match the specification, the function does nothing.
54191 </listitem></varlistentry>
54193 <term><emphasis role="bold">BOOL header_testname(header_line *hdr, uschar *name, int length, BOOL notdel)</emphasis></term>
54196 This function tests whether the given header has the given name. It is not just
54197 a string comparison, because white space is permitted between the name and the
54198 colon. If the <option>notdel</option> argument is true, a false return is forced for all
54199 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
54201 <literallayout class="monospaced">
54202 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
54204 </listitem></varlistentry>
54206 <term><emphasis role="bold">uschar *lss_b64encode(uschar *cleartext, int length)</emphasis></term>
54209 <indexterm role="concept">
54210 <primary>base64 encoding</primary>
54211 <secondary>functions for <function>local_scan()</function> use</secondary>
54213 This function base64-encodes a string, which is passed by address and length.
54214 The text may contain bytes of any value, including zero. The result is passed
54215 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
54218 </listitem></varlistentry>
54220 <term><emphasis role="bold">int lss_b64decode(uschar *codetext, uschar **cleartext)</emphasis></term>
54223 This function decodes a base64-encoded string. Its arguments are a
54224 zero-terminated base64-encoded string and the address of a variable that is set
54225 to point to the result, which is in dynamic memory. The length of the decoded
54226 string is the yield of the function. If the input is invalid base64 data, the
54227 yield is -1. A zero byte is added to the end of the output string to make it
54228 easy to interpret as a C string (assuming it contains no zeros of its own). The
54229 added zero byte is not included in the returned count.
54231 </listitem></varlistentry>
54233 <term><emphasis role="bold">int lss_match_domain(uschar *domain, uschar *list)</emphasis></term>
54236 This function checks for a match in a domain list. Domains are always
54237 matched caselessly. The return value is one of the following:
54240 <literal>OK </literal> match succeeded
54241 <literal>FAIL </literal> match failed
54242 <literal>DEFER </literal> match deferred
54245 DEFER is usually caused by some kind of lookup defer, such as the
54246 inability to contact a database.
54248 </listitem></varlistentry>
54250 <term><emphasis role="bold">int lss_match_local_part(uschar *localpart, uschar *list, BOOL caseless)</emphasis></term>
54253 This function checks for a match in a local part list. The third argument
54254 controls case-sensitivity. The return values are as for
54255 <emphasis>lss_match_domain()</emphasis>.
54257 </listitem></varlistentry>
54259 <term><emphasis role="bold">int lss_match_address(uschar *address, uschar *list, BOOL caseless)</emphasis></term>
54262 This function checks for a match in an address list. The third argument
54263 controls the case-sensitivity of the local part match. The domain is always
54264 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
54266 </listitem></varlistentry>
54268 <term><emphasis role="bold">int lss_match_host(uschar *host_name, uschar *host_address, uschar *list)</emphasis></term>
54271 This function checks for a match in a host list. The most common usage is
54274 <literallayout class="monospaced">
54275 lss_match_host(sender_host_name, sender_host_address, ...)
54278 <indexterm role="variable">
54279 <primary><varname>$sender_host_address</varname></primary>
54281 An empty address field matches an empty item in the host list. If the host name
54282 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
54283 looked up if a host name is required to match an item in the list. The return
54284 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
54285 returns ERROR in the case when it had to look up a host name, but the lookup
54288 </listitem></varlistentry>
54290 <term><emphasis role="bold">void log_write(unsigned int selector, int which, char *format, ...)</emphasis></term>
54293 This function writes to Exim’s log files. The first argument should be zero (it
54294 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
54295 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
54296 them. It specifies to which log or logs the message is written. The remaining
54297 arguments are a format and relevant insertion arguments. The string should not
54298 contain any newlines, not even at the end.
54300 </listitem></varlistentry>
54302 <term><emphasis role="bold">void receive_add_recipient(uschar *address, int pno)</emphasis></term>
54305 This function adds an additional recipient to the message. The first argument
54306 is the recipient address. If it is unqualified (has no domain), it is qualified
54307 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
54310 This function does not allow you to specify a private <option>errors_to</option> address (as
54311 described with the structure of <option>recipient_item</option> above), because it pre-dates
54312 the addition of that field to the structure. However, it is easy to add such a
54313 value afterwards. For example:
54315 <literallayout class="monospaced">
54316 receive_add_recipient(US"monitor@mydom.example", -1);
54317 recipients_list[recipients_count-1].errors_to =
54318 US"postmaster@mydom.example";
54320 </listitem></varlistentry>
54322 <term><emphasis role="bold">BOOL receive_remove_recipient(uschar *recipient)</emphasis></term>
54325 This is a convenience function to remove a named recipient from the list of
54326 recipients. It returns true if a recipient was removed, and false if no
54327 matching recipient could be found. The argument must be a complete email
54330 </listitem></varlistentry>
54333 <indexterm role="concept">
54334 <primary>RFC 2047</primary>
54339 <term><emphasis role="bold">uschar rfc2047_decode(uschar *string, BOOL lencheck, uschar *target, int zeroval, int *lenptr, uschar **error)</emphasis></term>
54342 This function decodes strings that are encoded according to RFC 2047. Typically
54343 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
54344 from the Q or B encoding into a byte-string. Then, if provided with the name of
54345 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
54346 made to translate the result to the named character set. If this fails, the
54347 binary string is returned with an error message.
54350 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
54351 maximum MIME word length is enforced. The third argument is the target
54352 encoding, or NULL if no translation is wanted.
54355 <indexterm role="concept">
54356 <primary>binary zero</primary>
54357 <secondary>in RFC 2047 decoding</secondary>
54359 <indexterm role="concept">
54360 <primary>RFC 2047</primary>
54361 <secondary>binary zero in</secondary>
54363 If a binary zero is encountered in the decoded string, it is replaced by the
54364 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
54365 not be 0 because header lines are handled as zero-terminated strings.
54368 The function returns the result of processing the string, zero-terminated; if
54369 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
54370 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
54373 If an error is encountered, the function returns NULL and uses the <option>error</option>
54374 argument to return an error message. The variable pointed to by <option>error</option> is
54375 set to NULL if there is no error; it may be set non-NULL even when the function
54376 returns a non-NULL value if decoding was successful, but there was a problem
54379 </listitem></varlistentry>
54381 <term><emphasis role="bold">int smtp_fflush(void)</emphasis></term>
54384 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
54387 </listitem></varlistentry>
54389 <term><emphasis role="bold">void smtp_printf(char *, ...)</emphasis></term>
54392 The arguments of this function are like <function>printf()</function>; it writes to the SMTP
54393 output stream. You should use this function only when there is an SMTP output
54394 stream, that is, when the incoming message is being received via interactive
54395 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
54396 is FALSE. If you want to test for an incoming message from another host (as
54397 opposed to a local process that used the <option>-bs</option> command line option), you can
54398 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
54402 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
54403 output function, so it can be used for all forms of SMTP connection.
54406 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
54407 must start with an appropriate response code: 550 if you are going to return
54408 LOCAL_SCAN_REJECT, 451 if you are going to return
54409 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
54410 initial lines of a multi-line response, the code must be followed by a hyphen
54411 to indicate that the line is not the final response line. You must also ensure
54412 that the lines you write terminate with CRLF. For example:
54414 <literallayout class="monospaced">
54415 smtp_printf("550-this is some extra info\r\n");
54416 return LOCAL_SCAN_REJECT;
54419 Note that you can also create multi-line responses by including newlines in
54420 the data returned via the <option>return_text</option> argument. The added value of using
54421 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
54422 multiple output lines.
54425 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
54426 does not automatically flush pending output, and therefore does not test
54427 the state of the stream. (In the main code of Exim, flushing and error
54428 detection is done when Exim is ready for the next SMTP input command.) If
54429 you want to flush the output and check for an error (for example, the
54430 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
54431 arguments. It flushes the output stream, and returns a non-zero value if there
54434 </listitem></varlistentry>
54436 <term><emphasis role="bold">void *store_get(int)</emphasis></term>
54439 This function accesses Exim’s internal store (memory) manager. It gets a new
54440 chunk of memory whose size is given by the argument. Exim bombs out if it ever
54441 runs out of memory. See the next section for a discussion of memory handling.
54443 </listitem></varlistentry>
54445 <term><emphasis role="bold">void *store_get_perm(int)</emphasis></term>
54448 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
54449 permanent pool. See the next section for a discussion of memory handling.
54451 </listitem></varlistentry>
54453 <term><emphasis role="bold">uschar *string_copy(uschar *string)</emphasis></term>
54458 </listitem></varlistentry>
54460 <term><emphasis role="bold">uschar *string_copyn(uschar *string, int length)</emphasis></term>
54465 </listitem></varlistentry>
54467 <term><emphasis role="bold">uschar *string_sprintf(char *format, ...)</emphasis></term>
54470 These three functions create strings using Exim’s dynamic memory facilities.
54471 The first makes a copy of an entire string. The second copies up to a maximum
54472 number of characters, indicated by the second argument. The third uses a format
54473 and insertion arguments to create a new string. In each case, the result is a
54474 pointer to a new string in the current memory pool. See the next section for
54477 </listitem></varlistentry>
54480 <section id="SECTmemhanloc">
54481 <title>More about Exim’s memory handling</title>
54483 <indexterm role="concept">
54484 <primary><function>local_scan()</function> function</primary>
54485 <secondary>memory handling</secondary>
54487 No function is provided for freeing memory, because that is never needed.
54488 The dynamic memory that Exim uses when receiving a message is automatically
54489 recycled if another message is received by the same process (this applies only
54490 to incoming SMTP connections – other input methods can supply only one
54491 message at a time). After receiving the last message, a reception process
54495 Because it is recycled, the normal dynamic memory cannot be used for holding
54496 data that must be preserved over a number of incoming messages on the same SMTP
54497 connection. However, Exim in fact uses two pools of dynamic memory; the second
54498 one is not recycled, and can be used for this purpose.
54501 If you want to allocate memory that remains available for subsequent messages
54502 in the same SMTP connection, you should set
54504 <literallayout class="monospaced">
54505 store_pool = POOL_PERM
54508 before calling the function that does the allocation. There is no need to
54509 restore the value if you do not need to; however, if you do want to revert to
54510 the normal pool, you can either restore the previous value of <option>store_pool</option> or
54511 set it explicitly to POOL_MAIN.
54514 The pool setting applies to all functions that get dynamic memory, including
54515 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
54516 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
54517 block of memory from the permanent pool while preserving the value of
54518 <option>store_pool</option>.
54519 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
54524 <chapter id="CHAPsystemfilter">
54525 <title>System-wide message filtering</title>
54527 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
54528 <primary>filter</primary>
54529 <secondary>system filter</secondary>
54531 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
54532 <primary>filtering all mail</primary>
54534 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
54535 <primary>system filter</primary>
54537 The previous chapters (on ACLs and the local scan function) describe checks
54538 that can be applied to messages before they are accepted by a host. There is
54539 also a mechanism for checking messages once they have been received, but before
54540 they are delivered. This is called the <emphasis>system filter</emphasis>.
54543 The system filter operates in a similar manner to users’ filter files, but it
54544 is run just once per message (however many recipients the message has).
54545 It should not normally be used as a substitute for routing, because <option>deliver</option>
54546 commands in a system router provide new envelope recipient addresses.
54547 The system filter must be an Exim filter. It cannot be a Sieve filter.
54550 The system filter is run at the start of a delivery attempt, before any routing
54551 is done. If a message fails to be completely delivered at the first attempt,
54552 the system filter is run again at the start of every retry.
54553 If you want your filter to do something only once per message, you can make use
54554 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
54555 prevent it happening on retries.
54558 <indexterm role="variable">
54559 <primary><varname>$domain</varname></primary>
54561 <indexterm role="variable">
54562 <primary><varname>$local_part</varname></primary>
54564 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
54565 specific to individual recipient addresses, such as <varname>$local_part</varname> and
54566 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
54567 you want to run a centrally-specified filter for each recipient address
54568 independently, you can do so by setting up a suitable <command>redirect</command> router, as
54569 described in section <xref linkend="SECTperaddfil"/> below.
54571 <section id="SECID212">
54572 <title>Specifying a system filter</title>
54574 <indexterm role="concept">
54575 <primary>uid (user id)</primary>
54576 <secondary>system filter</secondary>
54578 <indexterm role="concept">
54579 <primary>gid (group id)</primary>
54580 <secondary>system filter</secondary>
54582 The name of the file that contains the system filter must be specified by
54583 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
54584 other than root, you must also set <option>system_filter_user</option> and
54585 <option>system_filter_group</option> as appropriate. For example:
54587 <literallayout class="monospaced">
54588 system_filter = /etc/mail/exim.filter
54589 system_filter_user = exim
54592 If a system filter generates any deliveries directly to files or pipes (via the
54593 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
54594 specified by setting <option>system_filter_file_transport</option> and
54595 <option>system_filter_pipe_transport</option>, respectively. Similarly,
54596 <option>system_filter_reply_transport</option> must be set to handle any messages generated
54597 by the <option>reply</option> command.
54600 <section id="SECID213">
54601 <title>Testing a system filter</title>
54603 You can run simple tests of a system filter in the same way as for a user
54604 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
54605 are permitted only in system filters are recognized.
54608 If you want to test the combined effect of a system filter and a user filter,
54609 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
54612 <section id="SECID214">
54613 <title>Contents of a system filter</title>
54615 The language used to specify system filters is the same as for users’ filter
54616 files. It is described in the separate end-user document <emphasis>Exim’s interface to
54617 mail filtering</emphasis>. However, there are some additional features that are
54618 available only in system filters; these are described in subsequent sections.
54619 If they are encountered in a user’s filter file or when testing with <option>-bf</option>,
54623 <indexterm role="concept">
54624 <primary>frozen messages</primary>
54625 <secondary>manual thaw; testing in filter</secondary>
54627 There are two special conditions which, though available in users’ filter
54628 files, are designed for use in system filters. The condition <option>first_delivery</option>
54629 is true only for the first attempt at delivering a message, and
54630 <option>manually_thawed</option> is true only if the message has been frozen, and
54631 subsequently thawed by an admin user. An explicit forced delivery counts as a
54632 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
54635 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
54636 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
54637 succeed, it will not be tried again.
54638 If you want Exim to retry an unseen delivery until it succeeds, you should
54639 arrange to set it up every time the filter runs.
54642 When a system filter finishes running, the values of the variables <varname>$n0</varname> –
54643 <varname>$n9</varname> are copied into <varname>$sn0</varname> – <varname>$sn9</varname> and are thereby made available to
54644 users’ filter files. Thus a system filter can, for example, set up <quote>scores</quote>
54645 to which users’ filter files can refer.
54648 <section id="SECID215">
54649 <title>Additional variable for system filters</title>
54651 <indexterm role="variable">
54652 <primary><varname>$recipients</varname></primary>
54654 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
54655 of the message (separated by commas and white space), is available in system
54656 filters. It is not available in users’ filters for privacy reasons.
54659 <section id="SECID216">
54660 <title>Defer, freeze, and fail commands for system filters</title>
54662 <indexterm role="concept">
54663 <primary>freezing messages</primary>
54665 <indexterm role="concept">
54666 <primary>message</primary>
54667 <secondary>freezing</secondary>
54669 <indexterm role="concept">
54670 <primary>message</primary>
54671 <secondary>forced failure</secondary>
54673 <indexterm role="concept">
54674 <primary><option>fail</option></primary>
54675 <secondary>in system filter</secondary>
54677 <indexterm role="concept">
54678 <primary><option>freeze</option> in system filter</primary>
54680 <indexterm role="concept">
54681 <primary><option>defer</option> in system filter</primary>
54683 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
54684 always available in system filters, but are not normally enabled in users’
54685 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
54686 for the <command>redirect</command> router.) These commands can optionally be followed by the
54687 word <option>text</option> and a string containing an error message, for example:
54689 <literallayout class="monospaced">
54690 fail text "this message looks like spam to me"
54693 The keyword <option>text</option> is optional if the next character is a double quote.
54696 The <option>defer</option> command defers delivery of the original recipients of the
54697 message. The <option>fail</option> command causes all the original recipients to be failed,
54698 and a bounce message to be created. The <option>freeze</option> command suspends all
54699 delivery attempts for the original recipients. In all cases, any new deliveries
54700 that are specified by the filter are attempted as normal after the filter has
54704 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
54705 not manually frozen since. This means that automatic freezing by a system
54706 filter can be used as a way of checking out suspicious messages. If a message
54707 is found to be all right, manually unfreezing it allows it to be delivered.
54710 <indexterm role="concept">
54711 <primary>log</primary>
54712 <secondary><option>fail</option> command log line</secondary>
54714 <indexterm role="concept">
54715 <primary><option>fail</option></primary>
54716 <secondary>log line; reducing</secondary>
54718 The text given with a fail command is used as part of the bounce message as
54719 well as being written to the log. If the message is quite long, this can fill
54720 up a lot of log space when such failures are common. To reduce the size of the
54721 log message, Exim interprets the text in a special way if it starts with the
54722 two characters <literal><<</literal> and contains <literal>>></literal> later. The text between these two
54723 strings is written to the log, and the rest of the text is used in the bounce
54724 message. For example:
54726 <literallayout class="monospaced">
54727 fail "<<filter test 1>>Your message is rejected \
54728 because it contains attachments that we are \
54729 not prepared to receive."
54732 <indexterm role="concept">
54733 <primary>loop</primary>
54734 <secondary>caused by <option>fail</option></secondary>
54736 Take great care with the <option>fail</option> command when basing the decision to fail on
54737 the contents of the message, because the bounce message will of course include
54738 the contents of the original message and will therefore trigger the <option>fail</option>
54739 command again (causing a mail loop) unless steps are taken to prevent this.
54740 Testing the <option>error_message</option> condition is one way to prevent this. You could
54743 <literallayout class="monospaced">
54744 if $message_body contains "this is spam" and not error_message
54745 then fail text "spam is not wanted here" endif
54748 though of course that might let through unwanted bounce messages. The
54749 alternative is clever checking of the body and/or headers to detect bounces
54750 generated by the filter.
54753 The interpretation of a system filter file ceases after a
54754 <option>defer</option>,
54755 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
54756 set up earlier in the filter file are honoured, so you can use a sequence such
54759 <literallayout class="monospaced">
54764 to send a specified message when the system filter is freezing (or deferring or
54765 failing) a message. The normal deliveries for the message do not, of course,
54769 <section id="SECTaddremheasys">
54770 <title>Adding and removing headers in a system filter</title>
54772 <indexterm role="concept">
54773 <primary>header lines</primary>
54774 <secondary>adding; in system filter</secondary>
54776 <indexterm role="concept">
54777 <primary>header lines</primary>
54778 <secondary>removing; in system filter</secondary>
54780 <indexterm role="concept">
54781 <primary>filter</primary>
54782 <secondary>header lines; adding/removing</secondary>
54784 Two filter commands that are available only in system filters are:
54786 <literallayout class="monospaced">
54787 headers add <string>
54788 headers remove <string>
54791 The argument for the <option>headers add</option> is a string that is expanded and then
54792 added to the end of the message’s headers. It is the responsibility of the
54793 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
54794 space is ignored, and if the string is otherwise empty, or if the expansion is
54795 forced to fail, the command has no effect.
54798 You can use <quote>\n</quote> within the string, followed by white space, to specify
54799 continued header lines. More than one header may be added in one command by
54800 including <quote>\n</quote> within the string without any following white space. For
54803 <literallayout class="monospaced">
54804 headers add "X-header-1: ....\n \
54805 continuation of X-header-1 ...\n\
54809 Note that the header line continuation white space after the first newline must
54810 be placed before the backslash that continues the input string, because white
54811 space after input continuations is ignored.
54814 The argument for <option>headers remove</option> is a colon-separated list of header names.
54815 This command applies only to those headers that are stored with the message;
54816 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
54817 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
54818 header with the same name, they are all removed.
54821 The <option>headers</option> command in a system filter makes an immediate change to the set
54822 of header lines that was received with the message (with possible additions
54823 from ACL processing). Subsequent commands in the system filter operate on the
54824 modified set, which also forms the basis for subsequent message delivery.
54825 Unless further modified during routing or transporting, this set of headers is
54826 used for all recipients of the message.
54829 During routing and transporting, the variables that refer to the contents of
54830 header lines refer only to those lines that are in this set. Thus, header lines
54831 that are added by a system filter are visible to users’ filter files and to all
54832 routers and transports. This contrasts with the manipulation of header lines by
54833 routers and transports, which is not immediate, but which instead is saved up
54834 until the message is actually being written (see section
54835 <xref linkend="SECTheadersaddrem"/>).
54838 If the message is not delivered at the first attempt, header lines that were
54839 added by the system filter are stored with the message, and so are still
54840 present at the next delivery attempt. Header lines that were removed are still
54841 present, but marked <quote>deleted</quote> so that they are not transported with the
54842 message. For this reason, it is usual to make the <option>headers</option> command
54843 conditional on <option>first_delivery</option> so that the set of header lines is not
54844 modified more than once.
54847 Because header modification in a system filter acts immediately, you have to
54848 use an indirect approach if you want to modify the contents of a header line.
54851 <literallayout class="monospaced">
54852 headers add "Old-Subject: $h_subject:"
54853 headers remove "Subject"
54854 headers add "Subject: new subject (was: $h_old-subject:)"
54855 headers remove "Old-Subject"
54858 <section id="SECID217">
54859 <title>Setting an errors address in a system filter</title>
54861 <indexterm role="concept">
54862 <primary>envelope sender</primary>
54864 In a system filter, if a <option>deliver</option> command is followed by
54866 <literallayout class="monospaced">
54867 errors_to <some address>
54870 in order to change the envelope sender (and hence the error reporting) for that
54871 delivery, any address may be specified. (In a user filter, only the current
54872 user’s address can be set.) For example, if some mail is being monitored, you
54875 <literallayout class="monospaced">
54876 unseen deliver monitor@spying.example errors_to root@local.example
54879 to take a copy which would not be sent back to the normal error reporting
54880 address if its delivery failed.
54883 <section id="SECTperaddfil">
54884 <title>Per-address filtering</title>
54886 <indexterm role="variable">
54887 <primary><varname>$domain</varname></primary>
54889 <indexterm role="variable">
54890 <primary><varname>$local_part</varname></primary>
54892 In contrast to the system filter, which is run just once per message for each
54893 delivery attempt, it is also possible to set up a system-wide filtering
54894 operation that runs once for each recipient address. In this case, variables
54895 such as <varname>$local_part</varname> and <varname>$domain</varname> can be used, and indeed, the choice of
54896 filter file could be made dependent on them. This is an example of a router
54897 which implements such a filter:
54899 <literallayout class="monospaced">
54903 domains = +local_domains
54904 file = /central/filters/$local_part
54910 The filter is run in a separate process under its own uid. Therefore, either
54911 <option>check_local_user</option> must be set (as above), in which case the filter is run as
54912 the local user, or the <option>user</option> option must be used to specify which user to
54913 use. If both are set, <option>user</option> overrides.
54916 Care should be taken to ensure that none of the commands in the filter file
54917 specify a significant delivery if the message is to go on to be delivered to
54918 its intended recipient. The router will not then claim to have dealt with the
54919 address, so it will be passed on to subsequent routers to be delivered in the
54921 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
54922 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
54923 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
54928 <chapter id="CHAPmsgproc">
54929 <title>Message processing</title>
54931 <indexterm role="concept" id="IIDmesproc" class="startofrange">
54932 <primary>message</primary>
54933 <secondary>general processing</secondary>
54935 Exim performs various transformations on the sender and recipient addresses of
54936 all messages that it handles, and also on the messages’ header lines. Some of
54937 these are optional and configurable, while others always take place. All of
54938 this processing, except rewriting as a result of routing, and the addition or
54939 removal of header lines while delivering, happens when a message is received,
54940 before it is placed on Exim’s queue.
54943 Some of the automatic processing takes place by default only for
54944 <quote>locally-originated</quote> messages. This adjective is used to describe messages
54945 that are not received over TCP/IP, but instead are passed to an Exim process on
54946 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
54947 set up by the <option>-bs</option> command line option.
54950 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
54951 or ::1) are not considered to be locally-originated. Exim does not treat the
54952 loopback interface specially in any way.
54955 If you want the loopback interface to be treated specially, you must ensure
54956 that there are appropriate entries in your ACLs.
54958 <section id="SECTsubmodnon">
54959 <title>Submission mode for non-local messages</title>
54961 <indexterm role="concept">
54962 <primary>message</primary>
54963 <secondary>submission</secondary>
54965 <indexterm role="concept">
54966 <primary>submission mode</primary>
54968 Processing that happens automatically for locally-originated messages (unless
54969 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
54970 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
54971 state. Submission mode is set by the modifier
54973 <literallayout class="monospaced">
54974 control = submission
54977 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
54978 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
54979 a local submission, and is normally used when the source of the message is
54980 known to be an MUA running on a client host (as opposed to an MTA). For
54981 example, to set submission mode for messages originating on the IPv4 loopback
54982 interface, you could include the following in the MAIL ACL:
54984 <literallayout class="monospaced">
54985 warn hosts = 127.0.0.1
54986 control = submission
54989 <indexterm role="concept">
54990 <primary><option>sender_retain</option> submission option</primary>
54992 There are some options that can be used when setting submission mode. A slash
54993 is used to separate options. For example:
54995 <literallayout class="monospaced">
54996 control = submission/sender_retain
54999 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
55000 true and <option>local_from_check</option> false for the current incoming message. The first
55001 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
55002 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
55003 authenticated sender. With this setting, Exim still fixes up messages by adding
55004 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
55005 attempt to check sender authenticity in header lines.
55008 When <option>sender_retain</option> is not set, a submission mode setting may specify a
55009 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
55012 <literallayout class="monospaced">
55013 control = submission/domain=some.domain
55016 The domain may be empty. How this value is used is described in sections
55017 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
55018 that allows you to specify the user’s full name for inclusion in a created
55019 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
55021 <literallayout class="monospaced">
55022 accept authenticated = *
55023 control = submission/domain=wonderland.example/\
55024 name=${lookup {$authenticated_id} \
55025 lsearch {/etc/exim/namelist}}
55028 Because the name may contain any characters, including slashes, the <option>name</option>
55029 option must be given last. The remainder of the string is used as the name. For
55030 the example above, if <filename>/etc/exim/namelist</filename> contains:
55032 <literallayout class="monospaced">
55033 bigegg: Humpty Dumpty
55036 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
55039 <literallayout class="monospaced">
55040 Sender: Humpty Dumpty <bigegg@wonderland.example>
55043 <indexterm role="concept">
55044 <primary>return path</primary>
55045 <secondary>in submission mode</secondary>
55047 By default, submission mode forces the return path to the same address as is
55048 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
55049 specified, the return path is also left unchanged.
55052 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
55053 ACL. This means that any sender checks performed before the fix-ups use the
55054 untrusted sender address specified by the user, not the trusted sender address
55055 specified by submission mode. Although this might be slightly unexpected, it
55056 does mean that you can configure ACL checks to spot that a user is trying to
55057 spoof another’s address.
55060 <section id="SECTlineendings">
55061 <title>Line endings</title>
55063 <indexterm role="concept">
55064 <primary>line endings</primary>
55066 <indexterm role="concept">
55067 <primary>carriage return</primary>
55069 <indexterm role="concept">
55070 <primary>linefeed</primary>
55072 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
55073 linefeed) is the line ending for messages transmitted over the Internet using
55074 SMTP over TCP/IP. However, within individual operating systems, different
55075 conventions are used. For example, Unix-like systems use just LF, but others
55076 use CRLF or just CR.
55079 Exim was designed for Unix-like systems, and internally, it stores messages
55080 using the system’s convention of a single LF as a line terminator. When
55081 receiving a message, all line endings are translated to this standard format.
55082 Originally, it was thought that programs that passed messages directly to an
55083 MTA within an operating system would use that system’s convention. Experience
55084 has shown that this is not the case; for example, there are Unix applications
55085 that use CRLF in this circumstance. For this reason, and for compatibility with
55086 other MTAs, the way Exim handles line endings for all messages is now as
55092 LF not preceded by CR is treated as a line ending.
55097 CR is treated as a line ending; if it is immediately followed by LF, the LF
55103 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
55104 nor a local message in the state where a line containing only a dot is a
55110 If a bare CR is encountered within a header line, an extra space is added after
55111 the line terminator so as not to end the header line. The reasoning behind this
55112 is that bare CRs in header lines are most likely either to be mistakes, or
55113 people trying to play silly games.
55118 If the first header line received in a message ends with CRLF, a subsequent
55119 bare LF in a header line is treated in the same way as a bare CR in a header
55125 <section id="SECID218">
55126 <title>Unqualified addresses</title>
55128 <indexterm role="concept">
55129 <primary>unqualified addresses</primary>
55131 <indexterm role="concept">
55132 <primary>address</primary>
55133 <secondary>qualification</secondary>
55135 By default, Exim expects every envelope address it receives from an external
55136 host to be fully qualified. Unqualified addresses cause negative responses to
55137 SMTP commands. However, because SMTP is used as a means of transporting
55138 messages from MUAs running on personal workstations, there is sometimes a
55139 requirement to accept unqualified addresses from specific hosts or IP networks.
55142 Exim has two options that separately control which hosts may send unqualified
55143 sender or recipient addresses in SMTP commands, namely
55144 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
55145 cases, if an unqualified address is accepted, it is qualified by adding the
55146 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
55149 <indexterm role="option">
55150 <primary><option>qualify_domain</option></primary>
55152 <indexterm role="option">
55153 <primary><option>qualify_recipient</option></primary>
55155 Unqualified addresses in header lines are automatically qualified for messages
55156 that are locally originated, unless the <option>-bnq</option> option is given on the command
55157 line. For messages received over SMTP, unqualified addresses in header lines
55158 are qualified only if unqualified addresses are permitted in SMTP commands. In
55159 other words, such qualification is also controlled by
55160 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
55163 <section id="SECID219">
55164 <title>The UUCP From line</title>
55166 <indexterm role="concept">
55167 <primary><quote>From</quote> line</primary>
55169 <indexterm role="concept">
55170 <primary>UUCP</primary>
55171 <secondary><quote>From</quote> line</secondary>
55173 <indexterm role="concept">
55174 <primary>sender</primary>
55175 <secondary>address</secondary>
55177 <indexterm role="option">
55178 <primary><option>uucp_from_pattern</option></primary>
55180 <indexterm role="option">
55181 <primary><option>uucp_from_sender</option></primary>
55183 <indexterm role="concept">
55184 <primary>envelope sender</primary>
55186 <indexterm role="concept">
55187 <primary>Sendmail compatibility</primary>
55188 <secondary><quote>From</quote> line</secondary>
55190 Messages that have come from UUCP (and some other applications) often begin
55191 with a line containing the envelope sender and a timestamp, following the word
55192 <quote>From</quote>. Examples of two common formats are:
55194 <literallayout class="monospaced">
55195 From a.oakley@berlin.mus Fri Jan 5 12:35 GMT 1996
55196 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
55199 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
55200 Exim recognizes such lines at the start of messages that are submitted to it
55201 via the command line (that is, on the standard input). It does not recognize
55202 such lines in incoming SMTP messages, unless the sending host matches
55203 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
55204 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
55205 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
55206 default value matches the two common cases shown above and puts the address
55207 that follows <quote>From</quote> into <varname>$1</varname>.
55210 <indexterm role="concept">
55211 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
55212 <secondary>in <quote>From </quote> line handling</secondary>
55214 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
55215 a trusted user, the message’s sender address is constructed by expanding the
55216 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
55217 then parsed as an RFC 2822 address. If there is no domain, the local part is
55218 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
55219 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
55222 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
55223 sender address is not changed. This is also the case for incoming SMTP messages
55224 that are permitted to contain <quote>From</quote> lines.
55227 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
55228 treated as a data line that starts the body of the message, as it is not valid
55229 as a header line. This also happens if a <quote>From</quote> line is present in an
55230 incoming SMTP message from a source that is not permitted to send them.
55233 <section id="SECID220">
55234 <title>Resent- header lines</title>
55236 <indexterm role="concept">
55237 <primary><option>Resent-</option> header lines</primary>
55239 RFC 2822 makes provision for sets of header lines starting with the string
55240 <literal>Resent-</literal> to be added to a message when it is resent by the original
55241 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
55242 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
55243 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
55247 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
55248 processing of replies or other such automatic actions on messages.</emphasis>
55252 This leaves things a bit vague as far as other processing actions such as
55253 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
55259 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
55260 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
55265 If there’s a rewriting rule for a particular header line, it is also applied to
55266 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
55267 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
55272 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
55278 For a locally-submitted message,
55279 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
55280 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
55281 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
55282 included in log lines in this case.
55287 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
55288 <option>Resent-</option> header lines are present.
55293 <section id="SECID221">
55294 <title>The Auto-Submitted: header line</title>
55296 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
55297 includes the header line:
55299 <literallayout class="monospaced">
55300 Auto-Submitted: auto-replied
55303 <section id="SECID222">
55304 <title>The Bcc: header line</title>
55306 <indexterm role="concept">
55307 <primary><emphasis>Bcc:</emphasis> header line</primary>
55309 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
55310 message’s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
55311 extracting its addresses). If <option>-t</option> is not present on the command line, any
55312 existing <emphasis>Bcc:</emphasis> is not removed.
55315 <section id="SECID223">
55316 <title>The Date: header line</title>
55318 <indexterm role="concept">
55319 <primary><emphasis>Date:</emphasis> header line</primary>
55321 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
55322 Exim adds one, using the current date and time, unless the
55323 <option>suppress_local_fixups</option> control has been specified.
55326 <section id="SECID224">
55327 <title>The Delivery-date: header line</title>
55329 <indexterm role="concept">
55330 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
55332 <indexterm role="option">
55333 <primary><option>delivery_date_remove</option></primary>
55335 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
55336 set. Exim can be configured to add them to the final delivery of messages. (See
55337 the generic <option>delivery_date_add</option> transport option.) They should not be present
55338 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
55339 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
55343 <section id="SECID225">
55344 <title>The Envelope-to: header line</title>
55346 <indexterm role="concept">
55347 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
55349 <indexterm role="option">
55350 <primary><option>envelope_to_remove</option></primary>
55352 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
55353 Exim can be configured to add them to the final delivery of messages. (See the
55354 generic <option>envelope_to_add</option> transport option.) They should not be present in
55355 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
55356 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
55360 <section id="SECTthefrohea">
55361 <title>The From: header line</title>
55363 <indexterm role="concept">
55364 <primary><emphasis>From:</emphasis> header line</primary>
55366 <indexterm role="concept">
55367 <primary>Sendmail compatibility</primary>
55368 <secondary><quote>From</quote> line</secondary>
55370 <indexterm role="concept">
55371 <primary>message</primary>
55372 <secondary>submission</secondary>
55374 <indexterm role="concept">
55375 <primary>submission mode</primary>
55377 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
55378 adds one if either of the following conditions is true:
55383 The envelope sender address is not empty (that is, this is not a bounce
55384 message). The added header line copies the envelope sender address.
55389 <indexterm role="variable">
55390 <primary><varname>$authenticated_id</varname></primary>
55392 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
55394 <orderedlist numeration="arabic">
55397 <indexterm role="variable">
55398 <primary><varname>$qualify_domain</varname></primary>
55400 If no domain is specified by the submission control, the local part is
55401 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
55406 If a non-empty domain is specified by the submission control, the local
55407 part is <varname>$authenticated_id</varname>, and the domain is the specified domain.
55412 If an empty domain is specified by the submission control,
55413 <varname>$authenticated_id</varname> is assumed to be the complete address.
55420 A non-empty envelope sender takes precedence.
55423 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
55424 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
55425 containing the sender’s address. The calling user’s login name and full name
55426 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
55427 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
55428 <option>unknown_login</option> configuration option). The address is qualified with
55429 <option>qualify_domain</option>.
55432 For compatibility with Sendmail, if an incoming, non-SMTP message has a
55433 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
55434 user, this is replaced by an address containing the user’s login name and full
55435 name as described in section <xref linkend="SECTconstr"/>.
55438 <section id="SECID226">
55439 <title>The Message-ID: header line</title>
55441 <indexterm role="concept">
55442 <primary><emphasis>Message-ID:</emphasis> header line</primary>
55444 <indexterm role="concept">
55445 <primary>message</primary>
55446 <secondary>submission</secondary>
55448 <indexterm role="option">
55449 <primary><option>message_id_header_text</option></primary>
55451 If a locally-generated or submission-mode incoming message does not contain a
55452 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
55453 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
55454 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
55455 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim’s internal
55456 message id, preceded by the letter E to ensure it starts with a letter, and
55457 followed by @ and the primary host name. Additional information can be included
55458 in this header line by setting the <option>message_id_header_text</option> and/or
55459 <option>message_id_header_domain</option> options.
55462 <section id="SECID227">
55463 <title>The Received: header line</title>
55465 <indexterm role="concept">
55466 <primary><emphasis>Received:</emphasis> header line</primary>
55468 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
55469 contents are defined by the <option>received_header_text</option> configuration option, and
55470 Exim automatically adds a semicolon and a timestamp to the configured string.
55473 The <emphasis>Received:</emphasis> header is generated as soon as the message’s header lines
55474 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
55475 line is the time that the message started to be received. This is the value
55476 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
55479 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
55480 changed to the time of acceptance, which is (apart from a small delay while the
55481 -H spool file is written) the earliest time at which delivery could start.
55484 <section id="SECID228">
55485 <title>The References: header line</title>
55487 <indexterm role="concept">
55488 <primary><emphasis>References:</emphasis> header line</primary>
55490 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
55491 header line. This is constructed according to the rules that are described in
55492 section 3.64 of RFC 2822 (which states that replies should contain such a
55493 header line), and section 3.14 of RFC 3834 (which states that automatic
55494 responses are not different in this respect). However, because some mail
55495 processing software does not cope well with very long header lines, no more
55496 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
55497 incoming message. If there are more than 12, the first one and then the final
55498 11 are copied, before adding the message ID of the incoming message.
55501 <section id="SECID229">
55502 <title>The Return-path: header line</title>
55504 <indexterm role="concept">
55505 <primary><emphasis>Return-path:</emphasis> header line</primary>
55507 <indexterm role="option">
55508 <primary><option>return_path_remove</option></primary>
55510 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
55511 it does the final delivery of messages. (See the generic <option>return_path_add</option>
55512 transport option.) Therefore, they should not be present in messages in
55513 transit. If the <option>return_path_remove</option> configuration option is set (the
55514 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
55517 <section id="SECTthesenhea">
55518 <title>The Sender: header line</title>
55520 <indexterm role="concept">
55521 <primary><emphasis>Sender:</emphasis> header line</primary>
55523 <indexterm role="concept">
55524 <primary>message</primary>
55525 <secondary>submission</secondary>
55527 For a locally-originated message from an untrusted user, Exim may remove an
55528 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
55529 these actions by setting the <option>local_sender_retain</option> option true, the
55530 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
55534 When a local message is received from an untrusted user and
55535 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
55536 control has not been set, a check is made to see if the address given in the
55537 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
55538 that is expected has the login name as the local part and the value of
55539 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
55540 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
55541 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
55542 line is added to the message.
55545 If you set <option>local_from_check</option> false, this checking does not occur. However,
55546 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
55547 <option>local_sender_retain</option> to be true. It is not possible to set both of these
55548 options true at the same time.
55551 <indexterm role="concept">
55552 <primary>submission mode</primary>
55554 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
55555 received over TCP/IP or for messages submitted by trusted users. However, when
55556 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
55557 not specified on the submission control, the following processing takes place:
55560 <indexterm role="variable">
55561 <primary><varname>$authenticated_id</varname></primary>
55563 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
55564 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
55565 created as follows:
55570 <indexterm role="variable">
55571 <primary><varname>$qualify_domain</varname></primary>
55573 If no domain is specified by the submission control, the local part is
55574 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
55579 If a non-empty domain is specified by the submission control, the local part
55580 is <varname>$authenticated_id</varname>, and the domain is the specified domain.
55585 If an empty domain is specified by the submission control,
55586 <varname>$authenticated_id</varname> is assumed to be the complete address.
55591 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
55592 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
55593 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
55594 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
55597 <indexterm role="concept">
55598 <primary>return path</primary>
55599 <secondary>created from <emphasis>Sender:</emphasis></secondary>
55601 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
55602 the message (the envelope sender address) is changed to be the same address,
55603 except in the case of submission mode when <option>sender_retain</option> is specified.
55606 <section id="SECTheadersaddrem">
55607 <title>Adding and removing header lines in routers and transports</title>
55609 <indexterm role="concept">
55610 <primary>header lines</primary>
55611 <secondary>adding; in router or transport</secondary>
55613 <indexterm role="concept">
55614 <primary>header lines</primary>
55615 <secondary>removing; in router or transport</secondary>
55617 When a message is delivered, the addition and removal of header lines can be
55618 specified in a system filter, or on any of the routers and transports that
55619 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
55620 modifying headers in a system filter. Header lines can also be added in an ACL
55621 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
55624 In contrast to what happens in a system filter, header modifications that are
55625 specified on routers and transports apply only to the particular recipient
55626 addresses that are being processed by those routers and transports. These
55627 changes do not actually take place until a copy of the message is being
55628 transported. Therefore, they do not affect the basic set of header lines, and
55629 they do not affect the values of the variables that refer to header lines.
55632 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
55633 the transport cannot refer to the modified header lines, because such
55634 expansions all occur before the message is actually transported.
55637 For both routers and transports, the result of expanding a <option>headers_add</option>
55638 option must be in the form of one or more RFC 2822 header lines, separated by
55639 newlines (coded as <quote>\n</quote>). For example:
55641 <literallayout class="monospaced">
55642 headers_add = X-added-header: added by $primary_hostname\n\
55643 X-added-second: another added header line
55646 Exim does not check the syntax of these added header lines.
55649 The result of expanding <option>headers_remove</option> must consist of a colon-separated
55650 list of header names. This is confusing, because header names themselves are
55651 often terminated by colons. In this case, the colons are the list separators,
55652 not part of the names. For example:
55654 <literallayout class="monospaced">
55655 headers_remove = return-receipt-to:acknowledge-to
55658 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router, its value
55659 is expanded at routing time, and then associated with all addresses that are
55660 accepted by that router, and also with any new addresses that it generates. If
55661 an address passes through several routers as a result of aliasing or
55662 forwarding, the changes are cumulative.
55665 <indexterm role="option">
55666 <primary><option>unseen</option></primary>
55668 However, this does not apply to multiple routers that result from the use of
55669 the <option>unseen</option> option. Any header modifications that were specified by the
55670 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
55673 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
55674 settings cannot be delivered together in a batch, so a transport is always
55675 dealing with a set of addresses that have the same header-processing
55679 The transport starts by writing the original set of header lines that arrived
55680 with the message, possibly modified by the system filter. As it writes out
55681 these lines, it consults the list of header names that were attached to the
55682 recipient address(es) by <option>headers_remove</option> options in routers, and it also
55683 consults the transport’s own <option>headers_remove</option> option. Header lines whose
55684 names are on either of these lists are not written out. If there are multiple
55685 instances of any listed header, they are all skipped.
55688 After the remaining original header lines have been written, new header
55689 lines that were specified by routers’ <option>headers_add</option> options are written, in
55690 the order in which they were attached to the address. These are followed by any
55691 header lines specified by the transport’s <option>headers_add</option> option.
55694 This way of handling header line modifications in routers and transports has
55695 the following consequences:
55700 The original set of header lines, possibly modified by the system filter,
55701 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
55702 to it, at all times.
55707 Header lines that are added by a router’s
55708 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
55709 expansion syntax in subsequent routers or the transport.
55714 Conversely, header lines that are specified for removal by <option>headers_remove</option>
55715 in a router remain visible to subsequent routers and the transport.
55720 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
55721 a later router or by a transport.
55726 An added header can refer to the contents of an original header that is to be
55727 removed, even it has the same name as the added header. For example:
55729 <literallayout class="monospaced">
55730 headers_remove = subject
55731 headers_add = Subject: new subject (was: $h_subject:)
55736 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
55737 for a <command>redirect</command> router that has the <option>one_time</option> option set.
55740 <section id="SECTconstr">
55741 <title>Constructed addresses</title>
55743 <indexterm role="concept">
55744 <primary>address</primary>
55745 <secondary>constructed</secondary>
55747 <indexterm role="concept">
55748 <primary>constructed address</primary>
55750 When Exim constructs a sender address for a locally-generated message, it uses
55754 <<emphasis>user name</emphasis>> <<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>>
55759 <literallayout class="monospaced">
55760 Zaphod Beeblebrox <zaphod@end.univ.example>
55763 The user name is obtained from the <option>-F</option> command line option if set, or
55764 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
55765 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
55766 ampersand character, this is replaced by the login name with the first letter
55767 upper cased, as is conventional in a number of operating systems. See the
55768 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
55769 The <option>unknown_username</option> option can be used to specify user names in cases when
55770 there is no password file entry.
55773 <indexterm role="concept">
55774 <primary>RFC 2047</primary>
55776 In all cases, the user name is made to conform to RFC 2822 by quoting all or
55777 parts of it if necessary. In addition, if it contains any non-printing
55778 characters, it is encoded as described in RFC 2047, which defines a way of
55779 including non-ASCII characters in header lines. The value of the
55780 <option>headers_charset</option> option specifies the name of the encoding that is used (the
55781 characters are assumed to be in this encoding). The setting of
55782 <option>print_topbitchars</option> controls whether characters with the top bit set (that
55783 is, with codes greater than 127) count as printing characters or not.
55786 <section id="SECID230">
55787 <title>Case of local parts</title>
55789 <indexterm role="concept">
55790 <primary>case of local parts</primary>
55792 <indexterm role="concept">
55793 <primary>local part</primary>
55794 <secondary>case of</secondary>
55796 RFC 2822 states that the case of letters in the local parts of addresses cannot
55797 be assumed to be non-significant. Exim preserves the case of local parts of
55798 addresses, but by default it uses a lower-cased form when it is routing,
55799 because on most Unix systems, usernames are in lower case and case-insensitive
55800 routing is required. However, any particular router can be made to use the
55801 original case for local parts by setting the <option>caseful_local_part</option> generic
55805 <indexterm role="concept">
55806 <primary>mixed-case login names</primary>
55808 If you must have mixed-case user names on your system, the best way to proceed,
55809 assuming you want case-independent handling of incoming email, is to set up
55810 your first router to convert incoming local parts in your domains to the
55811 correct case by means of a file lookup. For example:
55813 <literallayout class="monospaced">
55816 domains = +local_domains
55817 data = ${lookup{$local_part}cdb\
55818 {/etc/usercased.cdb}{$value}fail}\
55822 For this router, the local part is forced to lower case by the default action
55823 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
55824 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
55825 on any subsequent routers which process your domains, they will operate on
55826 local parts with the correct case in a case-sensitive manner.
55829 <section id="SECID231">
55830 <title>Dots in local parts</title>
55832 <indexterm role="concept">
55833 <primary>dot</primary>
55834 <secondary>in local part</secondary>
55836 <indexterm role="concept">
55837 <primary>local part</primary>
55838 <secondary>dots in</secondary>
55840 RFC 2822 forbids empty components in local parts. That is, an unquoted local
55841 part may not begin or end with a dot, nor have two consecutive dots in the
55842 middle. However, it seems that many MTAs do not enforce this, so Exim permits
55843 empty components for compatibility.
55846 <section id="SECID232">
55847 <title>Rewriting addresses</title>
55849 <indexterm role="concept">
55850 <primary>rewriting</primary>
55851 <secondary>addresses</secondary>
55853 Rewriting of sender and recipient addresses, and addresses in headers, can
55854 happen automatically, or as the result of configuration options, as described
55855 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
55856 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
55859 Automatic rewriting includes qualification, as mentioned above. The other case
55860 in which it can happen is when an incomplete non-local domain is given. The
55861 routing process may cause this to be expanded into the full domain name. For
55862 example, a header such as
55864 <literallayout class="monospaced">
55868 might get rewritten as
55870 <literallayout class="monospaced">
55871 To: hare@teaparty.wonderland.fict.example
55874 Rewriting as a result of routing is the one kind of message processing that
55875 does not happen at input time, as it cannot be done until the address has
55879 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
55880 addresses have been routed, in case any of the headers get changed as a
55881 result of routing. However, doing this in practice would hold up many
55882 deliveries for unreasonable amounts of time, just because one address could not
55883 immediately be routed. Exim therefore does not delay other deliveries when
55884 routing of one or more addresses is deferred.
55885 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
55890 <chapter id="CHAPSMTP">
55891 <title>SMTP processing</title>
55893 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
55894 <primary>SMTP</primary>
55895 <secondary>processing details</secondary>
55897 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
55898 <primary>LMTP</primary>
55899 <secondary>processing details</secondary>
55901 Exim supports a number of different ways of using the SMTP protocol, and its
55902 LMTP variant, which is an interactive protocol for transferring messages into a
55903 closed mail store application. This chapter contains details of how SMTP is
55904 processed. For incoming mail, the following are available:
55909 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
55914 SMTP over the standard input and output (the <option>-bs</option> option);
55919 Batched SMTP on the standard input (the <option>-bS</option> option).
55924 For mail delivery, the following are available:
55929 SMTP over TCP/IP (the <command>smtp</command> transport);
55934 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
55935 <quote>lmtp</quote>);
55940 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
55946 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
55947 the <option>use_bsmtp</option> option set).
55952 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
55953 stored in or read from files (or pipes), in a format in which SMTP commands are
55954 used to contain the envelope information.
55956 <section id="SECToutSMTPTCP">
55957 <title>Outgoing SMTP and LMTP over TCP/IP</title>
55959 <indexterm role="concept">
55960 <primary>SMTP</primary>
55961 <secondary>outgoing over TCP/IP</secondary>
55963 <indexterm role="concept">
55964 <primary>outgoing SMTP over TCP/IP</primary>
55966 <indexterm role="concept">
55967 <primary>LMTP</primary>
55968 <secondary>over TCP/IP</secondary>
55970 <indexterm role="concept">
55971 <primary>outgoing LMTP over TCP/IP</primary>
55973 <indexterm role="concept">
55974 <primary>EHLO</primary>
55976 <indexterm role="concept">
55977 <primary>HELO</primary>
55979 <indexterm role="concept">
55980 <primary>SIZE option on MAIL command</primary>
55982 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
55983 The <option>protocol</option> option selects which protocol is to be used, but the actual
55984 processing is the same in both cases.
55987 If, in response to its EHLO command, Exim is told that the SIZE
55988 parameter is supported, it adds SIZE=<<emphasis>n</emphasis>> to each subsequent MAIL
55989 command. The value of <<emphasis>n</emphasis>> is the message size plus the value of the
55990 <option>size_addition</option> option (default 1024) to allow for additions to the message
55991 such as per-transport header lines, or changes made in a
55992 <indexterm role="concept">
55993 <primary>transport</primary>
55994 <secondary>filter</secondary>
55996 <indexterm role="concept">
55997 <primary>filter</primary>
55998 <secondary>transport filter</secondary>
56000 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
56004 If the remote server advertises support for PIPELINING, Exim uses the
56005 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
56006 required for the transaction.
56009 If the remote server advertises support for the STARTTLS command, and Exim
56010 was built to support TLS encryption, it tries to start a TLS session unless the
56011 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
56014 If the remote server advertises support for the AUTH command, Exim scans
56015 the authenticators configuration for any suitable client settings, as described
56016 in chapter <xref linkend="CHAPSMTPAUTH"/>.
56019 <indexterm role="concept">
56020 <primary>carriage return</primary>
56022 <indexterm role="concept">
56023 <primary>linefeed</primary>
56025 Responses from the remote host are supposed to be terminated by CR followed by
56026 LF. However, there are known to be hosts that do not send CR characters, so in
56027 order to be able to interwork with such hosts, Exim treats LF on its own as a
56031 If a message contains a number of different addresses, all those with the same
56032 characteristics (for example, the same envelope sender) that resolve to the
56033 same set of hosts, in the same order, are sent in a single SMTP transaction,
56034 even if they are for different domains, unless there are more than the setting
56035 of the <option>max_rcpt</option>s option in the <command>smtp</command> transport allows, in which case
56036 they are split into groups containing no more than <option>max_rcpt</option>s addresses
56037 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
56038 in parallel sessions. The order of hosts with identical MX values is not
56039 significant when checking whether addresses can be batched in this way.
56042 When the <command>smtp</command> transport suffers a temporary failure that is not
56043 message-related, Exim updates its transport-specific database, which contains
56044 records indexed by host name that remember which messages are waiting for each
56045 particular host. It also updates the retry database with new retry times.
56048 <indexterm role="concept">
56049 <primary>hints database</primary>
56050 <secondary>retry keys</secondary>
56052 Exim’s retry hints are based on host name plus IP address, so if one address of
56053 a multi-homed host is broken, it will soon be skipped most of the time.
56054 See the next section for more detail about error handling.
56057 <indexterm role="concept">
56058 <primary>SMTP</primary>
56059 <secondary>passed connection</secondary>
56061 <indexterm role="concept">
56062 <primary>SMTP</primary>
56063 <secondary>batching over TCP/IP</secondary>
56065 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
56066 looks in the hints database for the transport to see if there are any queued
56067 messages waiting for the host to which it is connected. If it finds one, it
56068 creates a new Exim process using the <option>-MC</option> option (which can only be used by
56069 a process running as root or the Exim user) and passes the TCP/IP socket to it
56070 so that it can deliver another message using the same socket. The new process
56071 does only those deliveries that are routed to the connected host, and may in
56072 turn pass the socket on to a third process, and so on.
56075 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
56076 limit the number of messages sent down a single TCP/IP connection.
56079 <indexterm role="concept">
56080 <primary>asterisk</primary>
56081 <secondary>after IP address</secondary>
56083 The second and subsequent messages delivered down an existing connection are
56084 identified in the main log by the addition of an asterisk after the closing
56085 square bracket of the IP address.
56088 <section id="SECToutSMTPerr">
56089 <title>Errors in outgoing SMTP</title>
56091 <indexterm role="concept">
56092 <primary>error</primary>
56093 <secondary>in outgoing SMTP</secondary>
56095 <indexterm role="concept">
56096 <primary>SMTP</primary>
56097 <secondary>errors in outgoing</secondary>
56099 <indexterm role="concept">
56100 <primary>host</primary>
56101 <secondary>error</secondary>
56103 Three different kinds of error are recognized for outgoing SMTP: host errors,
56104 message errors, and recipient errors.
56108 <term><emphasis role="bold">Host errors</emphasis></term>
56111 A host error is not associated with a particular message or with a
56112 particular recipient of a message. The host errors are:
56117 Connection refused or timed out,
56122 Any error response code on connection,
56127 Any error response code to EHLO or HELO,
56132 Loss of connection at any time, except after <quote>.</quote>,
56137 I/O errors at any time,
56142 Timeouts during the session, other than in response to MAIL, RCPT or
56143 the <quote>.</quote> at the end of the data.
56148 For a host error, a permanent error response on connection, or in response to
56149 EHLO, causes all addresses routed to the host to be failed. Any other host
56150 error causes all addresses to be deferred, and retry data to be created for the
56151 host. It is not tried again, for any message, until its retry time arrives. If
56152 the current set of addresses are not all delivered in this run (to some
56153 alternative host), the message is added to the list of those waiting for this
56154 host, so if it is still undelivered when a subsequent successful delivery is
56155 made to the host, it will be sent down the same SMTP connection.
56157 </listitem></varlistentry>
56159 <term><emphasis role="bold">Message errors</emphasis></term>
56162 <indexterm role="concept">
56163 <primary>message</primary>
56164 <secondary>error</secondary>
56166 A message error is associated with a particular message when sent to a
56167 particular host, but not with a particular recipient of the message. The
56168 message errors are:
56173 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
56179 Timeout after MAIL,
56184 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
56185 timeout after the DATA command itself is treated as a host error, as is loss of
56186 connection at any other time.
56191 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
56192 to be failed, and a delivery error report to be returned to the sender. A
56193 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
56194 addresses to be deferred. Retry data is not created for the host, but instead,
56195 a retry record for the combination of host plus message id is created. The
56196 message is not added to the list of those waiting for this host. This ensures
56197 that the failing message will not be sent to this host again until the retry
56198 time arrives. However, other messages that are routed to the host are not
56199 affected, so if it is some property of the message that is causing the error,
56200 it will not stop the delivery of other mail.
56203 If the remote host specified support for the SIZE parameter in its response
56204 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
56205 over-large message will cause a message error because the error arrives as a
56208 </listitem></varlistentry>
56210 <term><emphasis role="bold">Recipient errors</emphasis></term>
56213 <indexterm role="concept">
56214 <primary>recipient</primary>
56215 <secondary>error</secondary>
56217 A recipient error is associated with a particular recipient of a message. The
56218 recipient errors are:
56223 Any error response to RCPT,
56228 Timeout after RCPT.
56233 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
56234 recipient address to be failed, and a bounce message to be returned to the
56235 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
56236 address to be deferred, and routing retry data to be created for it. This is
56237 used to delay processing of the address in subsequent queue runs, until its
56238 routing retry time arrives. This applies to all messages, but because it
56239 operates only in queue runs, one attempt will be made to deliver a new message
56240 to the failing address before the delay starts to operate. This ensures that,
56241 if the failure is really related to the message rather than the recipient
56242 (<quote>message too big for this recipient</quote> is a possible example), other messages
56243 have a chance of getting delivered. If a delivery to the address does succeed,
56244 the retry information gets cleared, so all stuck messages get tried again, and
56245 the retry clock is reset.
56248 The message is not added to the list of those waiting for this host. Use of the
56249 host for other messages is unaffected, and except in the case of a timeout,
56250 other recipients are processed independently, and may be successfully delivered
56251 in the current SMTP session. After a timeout it is of course impossible to
56252 proceed with the session, so all addresses get deferred. However, those other
56253 than the one that failed do not suffer any subsequent retry delays. Therefore,
56254 if one recipient is causing trouble, the others have a chance of getting
56255 through when a subsequent delivery attempt occurs before the failing
56256 recipient’s retry time.
56258 </listitem></varlistentry>
56261 In all cases, if there are other hosts (or IP addresses) available for the
56262 current set of addresses (for example, from multiple MX records), they are
56263 tried in this run for any undelivered addresses, subject of course to their
56264 own retry data. In other words, recipient error retry data does not take effect
56265 until the next delivery attempt.
56268 Some hosts have been observed to give temporary error responses to every
56269 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
56270 would be nice if such circumstances could be recognized, and defer data for the
56271 host itself created, but this is not possible within the current Exim design.
56272 What actually happens is that retry data for every (host, message) combination
56276 The reason that timeouts after MAIL and RCPT are treated specially is that
56277 these can sometimes arise as a result of the remote host’s verification
56278 procedures. Exim makes this assumption, and treats them as if a temporary error
56279 response had been received. A timeout after <quote>.</quote> is treated specially because
56280 it is known that some broken implementations fail to recognize the end of the
56281 message if the last character of the last line is a binary zero. Thus, it is
56282 helpful to treat this case as a message error.
56285 Timeouts at other times are treated as host errors, assuming a problem with the
56286 host, or the connection to it. If a timeout after MAIL, RCPT,
56287 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
56288 the timeout is likely to occur at some other point in the dialogue, causing it
56289 then to be treated as a host error.
56292 There is experimental evidence that some MTAs drop the connection after the
56293 terminating <quote>.</quote> if they do not like the contents of the message for some
56294 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
56295 should be given. That is why Exim treats this case as a message rather than a
56296 host error, in order not to delay other messages to the same host.
56299 <section id="SECID233">
56300 <title>Incoming SMTP messages over TCP/IP</title>
56302 <indexterm role="concept">
56303 <primary>SMTP</primary>
56304 <secondary>incoming over TCP/IP</secondary>
56306 <indexterm role="concept">
56307 <primary>incoming SMTP over TCP/IP</primary>
56309 <indexterm role="concept">
56310 <primary>inetd</primary>
56312 <indexterm role="concept">
56313 <primary>daemon</primary>
56315 Incoming SMTP messages can be accepted in one of two ways: by running a
56316 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
56317 <filename>/etc/inetd.conf</filename> should be like this:
56319 <literallayout class="monospaced">
56320 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
56323 Exim distinguishes between this case and the case of a locally running user
56324 agent using the <option>-bs</option> option by checking whether or not the standard input is
56325 a socket. When it is, either the port must be privileged (less than 1024), or
56326 the caller must be root or the Exim user. If any other user passes a socket
56327 with an unprivileged port number, Exim prints a message on the standard error
56328 stream and exits with an error code.
56331 By default, Exim does not make a log entry when a remote host connects or
56332 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
56333 unexpected. It can be made to write such log entries by setting the
56334 <option>smtp_connection</option> log selector.
56337 <indexterm role="concept">
56338 <primary>carriage return</primary>
56340 <indexterm role="concept">
56341 <primary>linefeed</primary>
56343 Commands from the remote host are supposed to be terminated by CR followed by
56344 LF. However, there are known to be hosts that do not send CR characters. In
56345 order to be able to interwork with such hosts, Exim treats LF on its own as a
56347 Furthermore, because common code is used for receiving messages from all
56348 sources, a CR on its own is also interpreted as a line terminator. However, the
56349 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
56352 <indexterm role="concept">
56353 <primary>EHLO</primary>
56354 <secondary>invalid data</secondary>
56356 <indexterm role="concept">
56357 <primary>HELO</primary>
56358 <secondary>invalid data</secondary>
56360 One area that sometimes gives rise to problems concerns the EHLO or
56361 HELO commands. Some clients send syntactically invalid versions of these
56362 commands, which Exim rejects by default. (This is nothing to do with verifying
56363 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
56364 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
56365 match the broken hosts that send invalid commands.
56368 <indexterm role="concept">
56369 <primary>SIZE option on MAIL command</primary>
56371 <indexterm role="concept">
56372 <primary>MAIL</primary>
56373 <secondary>SIZE option</secondary>
56375 The amount of disk space available is checked whenever SIZE is received on
56376 a MAIL command, independently of whether <option>message_size_limit</option> or
56377 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
56378 false. A temporary error is given if there is not enough space. If
56379 <option>check_spool_space</option> is set, the check is for that amount of space plus the
56380 value given with SIZE, that is, it checks that the addition of the incoming
56381 message will not reduce the space below the threshold.
56384 When a message is successfully received, Exim includes the local message id in
56385 its response to the final <quote>.</quote> that terminates the data. If the remote host
56386 logs this text it can help with tracing what has happened to a message.
56389 The Exim daemon can limit the number of simultaneous incoming connections it is
56390 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
56391 number of simultaneous incoming connections from a single remote host (see the
56392 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
56393 rejected using the SMTP temporary error code 421.
56396 The Exim daemon does not rely on the SIGCHLD signal to detect when a
56397 subprocess has finished, as this can get lost at busy times. Instead, it looks
56398 for completed subprocesses every time it wakes up. Provided there are other
56399 things happening (new incoming calls, starts of queue runs), completed
56400 processes will be noticed and tidied away. On very quiet systems you may
56401 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
56402 it will be noticed when the daemon next wakes up.
56405 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
56406 and can also be set up to reject SMTP calls from non-reserved hosts at times of
56407 high system load – for details see the <option>smtp_accept_reserve</option>,
56408 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
56409 applies in both the daemon and <emphasis>inetd</emphasis> cases.
56412 Exim normally starts a delivery process for each message received, though this
56413 can be varied by means of the <option>-odq</option> command line option and the
56414 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
56415 number of simultaneously running delivery processes started in this way from
56416 SMTP input can be limited by the <option>smtp_accept_queue</option> and
56417 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
56418 subsequently received messages are just put on the input queue without starting
56419 a delivery process.
56422 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
56423 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
56424 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
56425 handled by an entirely independent Exim process. Control by load average is,
56426 however, available with <emphasis>inetd</emphasis>.
56429 Exim can be configured to verify addresses in incoming SMTP commands as they
56430 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
56431 to rewrite addresses at this time – before any syntax checking is done. See
56432 section <xref linkend="SECTrewriteS"/>.
56435 Exim can also be configured to limit the rate at which a client host submits
56436 MAIL and RCPT commands in a single SMTP session. See the
56437 <option>smtp_ratelimit_hosts</option> option.
56440 <section id="SECID234">
56441 <title>Unrecognized SMTP commands</title>
56443 <indexterm role="concept">
56444 <primary>SMTP</primary>
56445 <secondary>unrecognized commands</secondary>
56447 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
56448 commands during a single SMTP connection, it drops the connection after sending
56449 the error response to the last command. The default value for
56450 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
56451 abuse that subvert web servers into making connections to SMTP ports; in these
56452 circumstances, a number of non-SMTP lines are sent first.
56455 <section id="SECID235">
56456 <title>Syntax and protocol errors in SMTP commands</title>
56458 <indexterm role="concept">
56459 <primary>SMTP</primary>
56460 <secondary>syntax errors</secondary>
56462 <indexterm role="concept">
56463 <primary>SMTP</primary>
56464 <secondary>protocol errors</secondary>
56466 A syntax error is detected if an SMTP command is recognized, but there is
56467 something syntactically wrong with its data, for example, a malformed email
56468 address in a RCPT command. Protocol errors include invalid command
56469 sequencing such as RCPT before MAIL. If Exim receives more than
56470 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
56471 drops the connection after sending the error response to the last command. The
56472 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
56473 broken clients that loop sending bad commands (yes, it has been seen).
56476 <section id="SECID236">
56477 <title>Use of non-mail SMTP commands</title>
56479 <indexterm role="concept">
56480 <primary>SMTP</primary>
56481 <secondary>non-mail commands</secondary>
56483 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
56484 DATA. Exim counts such commands, and drops the connection if there are too
56485 many of them in a single SMTP session. This action catches some
56486 denial-of-service attempts and things like repeated failing AUTHs, or a mad
56487 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
56488 defines what <quote>too many</quote> means. Its default value is 10.
56491 When a new message is expected, one occurrence of RSET is not counted. This
56492 allows a client to send one RSET between messages (this is not necessary,
56493 but some clients do it). Exim also allows one uncounted occurrence of HELO
56494 or EHLO, and one occurrence of STARTTLS between messages. After
56495 starting up a TLS session, another EHLO is expected, and so it too is not
56499 The first occurrence of AUTH in a connection, or immediately following
56500 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
56501 RCPT, DATA, and QUIT are counted.
56504 You can control which hosts are subject to the limit set by
56505 <option>smtp_accept_max_nonmail</option> by setting
56506 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
56507 the limit apply to all hosts. This option means that you can exclude any
56508 specific badly-behaved hosts that you have to live with.
56511 <section id="SECID237">
56512 <title>The VRFY and EXPN commands</title>
56514 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
56515 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
56516 appropriate) in order to decide whether the command should be accepted or not.
56517 If no ACL is defined, the command is rejected.
56520 <indexterm role="concept">
56521 <primary>VRFY</primary>
56522 <secondary>processing</secondary>
56524 When VRFY is accepted, it runs exactly the same code as when Exim is
56525 called with the <option>-bv</option> option.
56528 <indexterm role="concept">
56529 <primary>EXPN</primary>
56530 <secondary>processing</secondary>
56532 When EXPN is accepted, a single-level expansion of the address is done.
56533 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
56534 than a verification (the <option>-bv</option> option). If an unqualified local part is given
56535 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
56536 of VRFY and EXPN commands are logged on the main and reject logs, and
56537 VRFY verification failures are logged on the main log for consistency with
56541 <section id="SECTETRN">
56542 <title>The ETRN command</title>
56544 <indexterm role="concept">
56545 <primary>ETRN</primary>
56546 <secondary>processing</secondary>
56548 RFC 1985 describes an SMTP command called ETRN that is designed to
56549 overcome the security problems of the TURN command (which has fallen into
56550 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
56551 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
56552 should be accepted or not. If no ACL is defined, the command is rejected.
56555 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
56556 delivery to certain hosts. As Exim does not organize its message queue by host,
56557 the only form of ETRN that is supported by default is the one where the
56558 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
56559 specific to the SMTP server. A valid ETRN command causes a run of Exim with
56560 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
56561 argument. For example,
56563 <literallayout class="monospaced">
56569 <literallayout class="monospaced">
56573 which causes a delivery attempt on all messages with undelivered addresses
56574 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
56575 default), Exim prevents the simultaneous execution of more than one queue run
56576 for the same argument string as a result of an ETRN command. This stops
56577 a misbehaving client from starting more than one queue runner at once.
56580 <indexterm role="concept">
56581 <primary>hints database</primary>
56582 <secondary>ETRN serialization</secondary>
56584 Exim implements the serialization by means of a hints database in which a
56585 record is written whenever a process is started by ETRN, and deleted when
56586 the process completes. However, Exim does not keep the SMTP session waiting for
56587 the ETRN process to complete. Once ETRN is accepted, the client is sent
56588 a <quote>success</quote> return code. Obviously there is scope for hints records to get
56589 left lying around if there is a system or program crash. To guard against this,
56590 Exim ignores any records that are more than six hours old.
56593 <indexterm role="option">
56594 <primary><option>smtp_etrn_command</option></primary>
56596 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
56597 used. This specifies a command that is run whenever ETRN is received,
56598 whatever the form of its argument. For
56601 <literallayout class="monospaced">
56602 smtp_etrn_command = /etc/etrn_command $domain \
56603 $sender_host_address
56606 <indexterm role="variable">
56607 <primary><varname>$domain</varname></primary>
56609 The string is split up into arguments which are independently expanded. The
56610 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
56611 and no syntax checking is done on the contents of this argument. Exim does not
56612 wait for the command to complete, so its status code is not checked. Exim runs
56613 under its own uid and gid when receiving incoming SMTP, so it is not possible
56614 for it to change them before running the command.
56617 <section id="SECID238">
56618 <title>Incoming local SMTP</title>
56620 <indexterm role="concept">
56621 <primary>SMTP</primary>
56622 <secondary>local incoming</secondary>
56624 Some user agents use SMTP to pass messages to their local MTA using the
56625 standard input and output, as opposed to passing the envelope on the command
56626 line and writing the message to the standard input. This is supported by the
56627 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
56628 messages over TCP/IP (including the use of ACLs), except that the envelope
56629 sender given in a MAIL command is ignored unless the caller is trusted. In
56630 an ACL you can detect this form of SMTP input by testing for an empty host
56631 identification. It is common to have this as the first line in the ACL that
56632 runs for RCPT commands:
56634 <literallayout class="monospaced">
56638 This accepts SMTP messages from local processes without doing any other tests.
56641 <section id="SECTbatchSMTP">
56642 <title>Outgoing batched SMTP</title>
56644 <indexterm role="concept">
56645 <primary>SMTP</primary>
56646 <secondary>batched outgoing</secondary>
56648 <indexterm role="concept">
56649 <primary>batched SMTP output</primary>
56651 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
56652 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
56653 be output in BSMTP format. No SMTP responses are possible for this form of
56654 delivery. All it is doing is using SMTP commands as a way of transmitting the
56655 envelope along with the message.
56658 The message is written to the file or pipe preceded by the SMTP commands
56659 MAIL and RCPT, and followed by a line containing a single dot. Lines in
56660 the message that start with a dot have an extra dot added. The SMTP command
56661 HELO is not normally used. If it is required, the <option>message_prefix</option> option
56662 can be used to specify it.
56665 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
56666 one recipient address at a time by default. However, you can arrange for them
56667 to handle several addresses at once by setting the <option>batch_max</option> option. When
56668 this is done for BSMTP, messages may contain multiple RCPT commands. See
56669 chapter <xref linkend="CHAPbatching"/> for more details.
56672 <indexterm role="variable">
56673 <primary><varname>$host</varname></primary>
56675 When one or more addresses are routed to a BSMTP transport by a router that
56676 sets up a host list, the name of the first host on the list is available to the
56677 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
56680 <literallayout class="monospaced">
56683 driver = manualroute
56684 transport = smtp_appendfile
56685 route_list = domain.example batch.host.example
56689 driver = appendfile
56690 directory = /var/bsmtp/$host
56696 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
56697 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
56698 message (unless there are more than 1000 recipients).
56701 <section id="SECTincomingbatchedSMTP">
56702 <title>Incoming batched SMTP</title>
56704 <indexterm role="concept">
56705 <primary>SMTP</primary>
56706 <secondary>batched incoming</secondary>
56708 <indexterm role="concept">
56709 <primary>batched SMTP input</primary>
56711 The <option>-bS</option> command line option causes Exim to accept one or more messages by
56712 reading SMTP on the standard input, but to generate no responses. If the caller
56713 is trusted, the senders in the MAIL commands are believed; otherwise the
56714 sender is always the caller of Exim. Unqualified senders and receivers are not
56715 rejected (there seems little point) but instead just get qualified. HELO
56716 and EHLO act as RSET; VRFY, EXPN, ETRN and HELP, act
56717 as NOOP; QUIT quits.
56720 No policy checking is done for BSMTP input. That is, no ACL is run at anytime.
56721 In this respect it is like non-SMTP local input.
56724 If an error is detected while reading a message, including a missing <quote>.</quote> at
56725 the end, Exim gives up immediately. It writes details of the error to the
56726 standard output in a stylized way that the calling program should be able to
56727 make some use of automatically, for example:
56729 <literallayout class="monospaced">
56730 554 Unexpected end of file
56731 Transaction started in line 10
56732 Error detected in line 14
56735 It writes a more verbose version, for human consumption, to the standard error
56738 <literallayout class="monospaced">
56739 An error was detected while processing a file of BSMTP input.
56740 The error message was:
56742 501 '>' missing at end of address
56744 The SMTP transaction started in line 10.
56745 The error was detected in line 12.
56746 The SMTP command at fault was:
56748 rcpt to:<malformed@in.com.plete
56750 1 previous message was successfully processed.
56751 The rest of the batch was abandoned.
56754 The return code from Exim is zero only if there were no errors. It is 1 if some
56755 messages were accepted before an error was detected, and 2 if no messages were
56757 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
56758 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
56763 <chapter id="CHAPemsgcust">
56764 <title>Customizing bounce and warning messages</title>
56765 <titleabbrev>Customizing messages</titleabbrev>
56767 When a message fails to be delivered, or remains on the queue for more than a
56768 configured amount of time, Exim sends a message to the original sender, or
56769 to an alternative configured address. The text of these messages is built into
56770 the code of Exim, but it is possible to change it, either by adding a single
56771 string, or by replacing each of the paragraphs by text supplied in a file.
56774 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
56775 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
56776 option. Exim also adds the line
56778 <literallayout class="monospaced">
56779 Auto-Submitted: auto-generated
56782 to all warning and bounce messages,
56784 <section id="SECID239">
56785 <title>Customizing bounce messages</title>
56787 <indexterm role="concept">
56788 <primary>customizing</primary>
56789 <secondary>bounce message</secondary>
56791 <indexterm role="concept">
56792 <primary>bounce message</primary>
56793 <secondary>customizing</secondary>
56795 If <option>bounce_message_text</option> is set, its contents are included in the default
56796 message immediately after <quote>This message was created automatically by mail
56797 delivery software.</quote> The string is not expanded. It is not used if
56798 <option>bounce_message_file</option> is set.
56801 When <option>bounce_message_file</option> is set, it must point to a template file for
56802 constructing error messages. The file consists of a series of text items,
56803 separated by lines consisting of exactly four asterisks. If the file cannot be
56804 opened, default text is used and a message is written to the main and panic
56805 logs. If any text item in the file is empty, default text is used for that
56809 <indexterm role="variable">
56810 <primary><varname>$bounce_recipient</varname></primary>
56812 <indexterm role="variable">
56813 <primary><varname>$bounce_return_size_limit</varname></primary>
56815 Each item of text that is read from the file is expanded, and there are two
56816 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
56817 the recipient of an error message while it is being created, and
56818 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
56819 option, rounded to a whole number.
56822 The items must appear in the file in the following order:
56827 The first item is included in the headers, and should include at least a
56828 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
56833 The second item forms the start of the error message. After it, Exim lists the
56834 failing addresses with their error messages.
56839 The third item is used to introduce any text from pipe transports that is to be
56840 returned to the sender. It is omitted if there is no such text.
56845 The fourth item is used to introduce the copy of the message that is returned
56846 as part of the error report.
56851 The fifth item is added after the fourth one if the returned message is
56852 truncated because it is bigger than <option>return_size_limit</option>.
56857 The sixth item is added after the copy of the original message.
56862 The default state (<option>bounce_message_file</option> unset) is equivalent to the
56863 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
56864 other lines have been split in order to fit them on the page:
56866 <literallayout class="monospaced">
56867 Subject: Mail delivery failed
56868 ${if eq{$sender_address}{$bounce_recipient}
56869 {: returning message to sender}}
56871 This message was created automatically by mail delivery software.
56873 A message ${if eq{$sender_address}{$bounce_recipient}
56874 {that you sent }{sent by
56876 <$sender_address>
56878 }}could not be delivered to all of its recipients.
56879 This is a permanent error. The following address(es) failed:
56881 The following text was generated during the delivery attempt(s):
56883 ------ This is a copy of the message, including all the headers.
56886 ------ The body of the message is $message_size characters long;
56888 ------ $bounce_return_size_limit or so are included here.
56892 <section id="SECTcustwarn">
56893 <title>Customizing warning messages</title>
56895 <indexterm role="concept">
56896 <primary>customizing</primary>
56897 <secondary>warning message</secondary>
56899 <indexterm role="concept">
56900 <primary>warning of delay</primary>
56901 <secondary>customizing the message</secondary>
56903 The option <option>warn_message_file</option> can be pointed at a template file for use when
56904 warnings about message delays are created. In this case there are only three
56910 The first item is included in the headers, and should include at least a
56911 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
56916 The second item forms the start of the warning message. After it, Exim lists
56917 the delayed addresses.
56922 The third item then ends the message.
56927 The default state is equivalent to the following file, except that some lines
56928 have been split here, in order to fit them on the page:
56930 <literallayout class="monospaced">
56931 Subject: Warning: message $message_exim_id delayed
56932 $warn_message_delay
56934 This message was created automatically by mail delivery software.
56936 A message ${if eq{$sender_address}{$warn_message_recipients}
56937 {that you sent }{sent by
56939 <$sender_address>
56941 }}has not been delivered to all of its recipients after
56942 more than $warn_message_delay on the queue on $primary_hostname.
56944 The message identifier is: $message_exim_id
56945 The subject of the message is: $h_subject
56946 The date of the message is: $h_date
56948 The following address(es) have not yet been delivered:
56950 No action is required on your part. Delivery attempts will
56951 continue for some time, and this warning may be repeated at
56952 intervals if the message remains undelivered. Eventually the
56953 mail delivery software will give up, and when that happens,
56954 the message will be returned to you.
56957 <indexterm role="variable">
56958 <primary><varname>$warn_message_delay</varname></primary>
56960 <indexterm role="variable">
56961 <primary><varname>$warn_message_recipients</varname></primary>
56963 However, in the default state the subject and date lines are omitted if no
56964 appropriate headers exist. During the expansion of this file,
56965 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote><<emphasis>n</emphasis>>
56966 minutes</quote> or <quote><<emphasis>n</emphasis>> hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
56967 of recipients for the warning message. There may be more than one if there are
56968 multiple addresses with different <option>errors_to</option> settings on the routers that
56974 <chapter id="CHAPcomconreq">
56975 <title>Some common configuration settings</title>
56977 This chapter discusses some configuration settings that seem to be fairly
56978 common. More examples and discussion can be found in the Exim book.
56980 <section id="SECID240">
56981 <title>Sending mail to a smart host</title>
56983 <indexterm role="concept">
56984 <primary>smart host</primary>
56985 <secondary>example router</secondary>
56987 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
56988 should replace the default <command>dnslookup</command> router with a router which does the
56989 routing explicitly:
56991 <literallayout class="monospaced">
56992 send_to_smart_host:
56993 driver = manualroute
56994 route_list = !+local_domains smart.host.name
56995 transport = remote_smtp
56998 You can use the smart host’s IP address instead of the name if you wish.
56999 If you are using Exim only to submit messages to a smart host, and not for
57000 receiving incoming messages, you can arrange for it to do the submission
57001 synchronously by setting the <option>mua_wrapper</option> option (see chapter
57002 <xref linkend="CHAPnonqueueing"/>).
57005 <section id="SECTmailinglists">
57006 <title>Using Exim to handle mailing lists</title>
57008 <indexterm role="concept">
57009 <primary>mailing lists</primary>
57011 Exim can be used to run simple mailing lists, but for large and/or complicated
57012 requirements, the use of additional specialized mailing list software such as
57013 Majordomo or Mailman is recommended.
57016 The <command>redirect</command> router can be used to handle mailing lists where each list
57017 is maintained in a separate file, which can therefore be managed by an
57018 independent manager. The <option>domains</option> router option can be used to run these
57019 lists in a separate domain from normal mail. For example:
57021 <literallayout class="monospaced">
57024 domains = lists.example
57025 file = /usr/lists/$local_part
57028 errors_to = $local_part-request@lists.example
57032 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
57033 in that domain, it looks for a file that matches the local part. If there is no
57034 such file, the router declines, but because <option>no_more</option> is set, no subsequent
57035 routers are tried, and so the whole delivery fails.
57038 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
57039 expanded into a file name or a pipe delivery, which is usually inappropriate in
57043 <indexterm role="option">
57044 <primary><option>errors_to</option></primary>
57046 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
57047 taken from a mailing list are to be sent to the given address rather than the
57048 original sender of the message. However, before acting on this, Exim verifies
57049 the error address, and ignores it if verification fails.
57052 For example, using the configuration above, mail sent to
57053 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
57054 <filename>/usr/lists/dicts</filename>, with error reports directed to
57055 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
57056 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
57057 the address(es) of this particular list’s manager(s), but other approaches,
57058 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
57059 or <option>local_part_suffix</option> options) to handle addresses of the form
57060 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
57063 <section id="SECID241">
57064 <title>Syntax errors in mailing lists</title>
57066 <indexterm role="concept">
57067 <primary>mailing lists</primary>
57068 <secondary>syntax errors in</secondary>
57070 If an entry in redirection data contains a syntax error, Exim normally defers
57071 delivery of the original address. That means that a syntax error in a mailing
57072 list holds up all deliveries to the list. This may not be appropriate when a
57073 list is being maintained automatically from data supplied by users, and the
57074 addresses are not rigorously checked.
57077 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
57078 entries that fail to parse, noting the incident in the log. If in addition
57079 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
57080 whenever a broken address is skipped. It is usually appropriate to set
57081 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
57084 <section id="SECID242">
57085 <title>Re-expansion of mailing lists</title>
57087 <indexterm role="concept">
57088 <primary>mailing lists</primary>
57089 <secondary>re-expansion of</secondary>
57091 Exim remembers every individual address to which a message has been delivered,
57092 in order to avoid duplication, but it normally stores only the original
57093 recipient addresses with a message. If all the deliveries to a mailing list
57094 cannot be done at the first attempt, the mailing list is re-expanded when the
57095 delivery is next tried. This means that alterations to the list are taken into
57096 account at each delivery attempt, so addresses that have been added to
57097 the list since the message arrived will therefore receive a copy of the
57098 message, even though it pre-dates their subscription.
57101 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
57102 on the <command>redirect</command> router. If this is done, any addresses generated by the
57103 router that fail to deliver at the first attempt are added to the message as
57104 <quote>top level</quote> addresses, and the parent address that generated them is marked
57105 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
57106 subsequent delivery attempts. The disadvantage of this is that if any of the
57107 failing addresses are incorrect, correcting them in the file has no effect on
57108 pre-existing messages.
57111 The original top-level address is remembered with each of the generated
57112 addresses, and is output in any log messages. However, any intermediate parent
57113 addresses are not recorded. This makes a difference to the log only if the
57114 <option>all_parents</option> selector is set, but for mailing lists there is normally only
57115 one level of expansion anyway.
57118 <section id="SECID243">
57119 <title>Closed mailing lists</title>
57121 <indexterm role="concept">
57122 <primary>mailing lists</primary>
57123 <secondary>closed</secondary>
57125 The examples so far have assumed open mailing lists, to which anybody may
57126 send mail. It is also possible to set up closed lists, where mail is accepted
57127 from specified senders only. This is done by making use of the generic
57128 <option>senders</option> option to restrict the router that handles the list.
57131 The following example uses the same file as a list of recipients and as a list
57132 of permitted senders. It requires three routers:
57134 <literallayout class="monospaced">
57137 domains = lists.example
57138 local_part_suffix = -request
57139 file = /usr/lists/$local_part$local_part_suffix
57144 domains = lists.example
57145 senders = ${if exists {/usr/lists/$local_part}\
57146 {lsearch;/usr/lists/$local_part}{*}}
57147 file = /usr/lists/$local_part
57150 errors_to = $local_part-request@lists.example
57155 domains = lists.example
57157 data = :fail: $local_part@lists.example is a closed mailing list
57160 All three routers have the same <option>domains</option> setting, so for any other domains,
57161 they are all skipped. The first router runs only if the local part ends in
57162 <option>-request</option>. It handles messages to the list manager(s) by means of an open
57166 The second router runs only if the <option>senders</option> precondition is satisfied. It
57167 checks for the existence of a list that corresponds to the local part, and then
57168 checks that the sender is on the list by means of a linear search. It is
57169 necessary to check for the existence of the file before trying to search it,
57170 because otherwise Exim thinks there is a configuration error. If the file does
57171 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
57172 means that the router runs, but because there is no list, declines, and
57173 <option>no_more</option> ensures that no further routers are run. The address fails with an
57174 <quote>unrouteable address</quote> error.
57177 The third router runs only if the second router is skipped, which happens when
57178 a mailing list exists, but the sender is not on it. This router forcibly fails
57179 the address, giving a suitable error message.
57182 <section id="SECTverp">
57183 <title>Variable Envelope Return Paths (VERP)</title>
57185 <indexterm role="concept">
57186 <primary>VERP</primary>
57188 <indexterm role="concept">
57189 <primary>Variable Envelope Return Paths</primary>
57191 <indexterm role="concept">
57192 <primary>envelope sender</primary>
57194 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> –
57195 are a way of helping mailing list administrators discover which subscription
57196 address is the cause of a particular delivery failure. The idea is to encode
57197 the original recipient address in the outgoing envelope sender address, so that
57198 if the message is forwarded by another host and then subsequently bounces, the
57199 original recipient can be extracted from the recipient address of the bounce.
57202 <indexterm role="option">
57203 <primary><option>errors_to</option></primary>
57205 <indexterm role="option">
57206 <primary><option>return_path</option></primary>
57208 Envelope sender addresses can be modified by Exim using two different
57209 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
57210 list examples), or the <option>return_path</option> option on a transport. The second of
57211 these is effective only if the message is successfully delivered to another
57212 host; it is not used for errors detected on the local host (see the description
57213 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
57214 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
57216 <literallayout class="monospaced">
57221 ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
57222 {$1-request+$local_part=$domain@your.dom.example}fail}
57225 This has the effect of rewriting the return path (envelope sender) on outgoing
57226 SMTP messages, if the local part of the original return path ends in
57227 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
57228 local part and domain of the recipient into the return path. Suppose, for
57229 example, that a message whose return path has been set to
57230 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
57231 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
57234 <literallayout class="monospaced">
57235 somelist-request+subscriber=other.dom.example@your.dom.example
57238 <indexterm role="variable">
57239 <primary><varname>$local_part</varname></primary>
57241 For this to work, you must tell Exim to send multiple copies of messages that
57242 have more than one recipient, so that each copy has just one recipient. This is
57243 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
57244 might be sent to several different recipients in the same domain, in which case
57245 <varname>$local_part</varname> is not available in the transport, because it is not unique.
57248 Unless your host is doing nothing but mailing list deliveries, you should
57249 probably use a separate transport for the VERP deliveries, so as not to use
57250 extra resources in making one-per-recipient copies for other deliveries. This
57251 can easily be done by expanding the <option>transport</option> option in the router:
57253 <literallayout class="monospaced">
57256 domains = ! +local_domains
57258 ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
57259 {verp_smtp}{remote_smtp}}
57263 If you want to change the return path using <option>errors_to</option> in a router instead
57264 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
57265 routers that handle mailing list addresses. This will ensure that all delivery
57266 errors, including those detected on the local host, are sent to the VERP
57270 On a host that does no local deliveries and has no manual routing, only the
57271 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
57272 SMTP deliveries. Every mailing list recipient has its own return path value,
57273 and so Exim must hand them to the transport one at a time. Here is an example
57274 of a <command>dnslookup</command> router that implements VERP:
57276 <literallayout class="monospaced">
57279 domains = ! +local_domains
57280 transport = remote_smtp
57282 ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
57283 {$1-request+$local_part=$domain@your.dom.example}fail}
57287 Before you start sending out messages with VERPed return paths, you must also
57288 configure Exim to accept the bounce messages that come back to those paths.
57289 Typically this is done by setting a <option>local_part_suffix</option> option for a
57290 router, and using this to route the messages to wherever you want to handle
57294 The overhead incurred in using VERP depends very much on the size of the
57295 message, the number of recipient addresses that resolve to the same remote
57296 host, and the speed of the connection over which the message is being sent. If
57297 a lot of addresses resolve to the same host and the connection is slow, sending
57298 a separate copy of the message for each address may take substantially longer
57299 than sending a single copy with many recipients (for which VERP cannot be
57303 <section id="SECTvirtualdomains">
57304 <title>Virtual domains</title>
57306 <indexterm role="concept">
57307 <primary>virtual domains</primary>
57309 <indexterm role="concept">
57310 <primary>domain</primary>
57311 <secondary>virtual</secondary>
57313 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
57319 A domain for which there are no real mailboxes; all valid local parts are
57320 aliases for other email addresses. Common examples are organizational
57321 top-level domains and <quote>vanity</quote> domains.
57326 One of a number of independent domains that are all handled by the same host,
57327 with mailboxes on that host, but where the mailbox owners do not necessarily
57328 have login accounts on that host.
57333 The first usage is probably more common, and does seem more <quote>virtual</quote> than
57334 the second. This kind of domain can be handled in Exim with a straightforward
57335 aliasing router. One approach is to create a separate alias file for each
57336 virtual domain. Exim can test for the existence of the alias file to determine
57337 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
57338 to a router of this form:
57340 <literallayout class="monospaced">
57343 domains = dsearch;/etc/mail/virtual
57344 data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain}}
57348 The <option>domains</option> option specifies that the router is to be skipped, unless there
57349 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
57350 domain that is being processed. When the router runs, it looks up the local
57351 part in the file to find a new address (or list of addresses). The <option>no_more</option>
57352 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
57353 string), Exim gives up on the address without trying any subsequent routers.
57356 This one router can handle all the virtual domains because the alias file names
57357 follow a fixed pattern. Permissions can be arranged so that appropriate people
57358 can edit the different alias files. A successful aliasing operation results in
57359 a new envelope recipient address, which is then routed from scratch.
57362 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
57363 way. One approach is to create a file for each domain containing a list of
57364 valid local parts, and use it in a router like this:
57366 <literallayout class="monospaced">
57369 domains = dsearch;/etc/mail/domains
57370 local_parts = lsearch;/etc/mail/domains/$domain
57371 transport = my_mailboxes
57374 The address is accepted if there is a file for the domain, and the local part
57375 can be found in the file. The <option>domains</option> option is used to check for the
57376 file’s existence because <option>domains</option> is tested before the <option>local_parts</option>
57377 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
57378 because that option is tested after <option>local_parts</option>. The transport is as
57381 <literallayout class="monospaced">
57383 driver = appendfile
57384 file = /var/mail/$domain/$local_part
57388 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
57389 required, to specify which uid is to be used for writing to the mailboxes.
57392 The configuration shown here is just one example of how you might support this
57393 requirement. There are many other ways this kind of configuration can be set
57394 up, for example, by using a database instead of separate files to hold all the
57395 information about the domains.
57398 <section id="SECTmulbox">
57399 <title>Multiple user mailboxes</title>
57401 <indexterm role="concept">
57402 <primary>multiple mailboxes</primary>
57404 <indexterm role="concept">
57405 <primary>mailbox</primary>
57406 <secondary>multiple</secondary>
57408 <indexterm role="concept">
57409 <primary>local part</primary>
57410 <secondary>prefix</secondary>
57412 <indexterm role="concept">
57413 <primary>local part</primary>
57414 <secondary>suffix</secondary>
57416 Heavy email users often want to operate with multiple mailboxes, into which
57417 incoming mail is automatically sorted. A popular way of handling this is to
57418 allow users to use multiple sender addresses, so that replies can easily be
57419 identified. Users are permitted to add prefixes or suffixes to their local
57420 parts for this purpose. The wildcard facility of the generic router options
57421 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
57422 example, consider this router:
57424 <literallayout class="monospaced">
57428 file = $home/.forward
57429 local_part_suffix = -*
57430 local_part_suffix_optional
57434 <indexterm role="variable">
57435 <primary><varname>$local_part_suffix</varname></primary>
57437 It runs a user’s <filename>.forward</filename> file for all local parts of the form
57438 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
57439 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
57441 <literallayout class="monospaced">
57442 if $local_part_suffix contains -special then
57443 save /home/$local_part/Mail/special
57447 If the filter file does not exist, or does not deal with such addresses, they
57448 fall through to subsequent routers, and, assuming no subsequent use of the
57449 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
57450 control over which suffixes are valid.
57453 Alternatively, a suffix can be used to trigger the use of a different
57454 <filename>.forward</filename> file – which is the way a similar facility is implemented in
57457 <literallayout class="monospaced">
57461 file = $home/.forward$local_part_suffix
57462 local_part_suffix = -*
57463 local_part_suffix_optional
57467 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
57468 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
57469 does not exist, or does not deal with the address, it is passed on to
57470 subsequent routers, which could, if required, look for an unqualified
57471 <filename>.forward</filename> file to use as a default.
57474 <section id="SECID244">
57475 <title>Simplified vacation processing</title>
57477 <indexterm role="concept">
57478 <primary>vacation processing</primary>
57480 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
57481 a pipe command in a <filename>.forward</filename> file
57482 (see section <xref linkend="SECTspecitredli"/> for syntax details).
57483 This is prone to error by inexperienced users. There are two features of Exim
57484 that can be used to make this process simpler for users:
57489 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
57490 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
57491 alternatively can use Exim’s <command>autoreply</command> transport. The contents of a user’s
57492 <filename>.forward</filename> file are then much simpler. For example:
57494 <literallayout class="monospaced">
57495 spqr, vacation-spqr
57500 The <option>require_files</option> generic router option can be used to trigger a
57501 vacation delivery by checking for the existence of a certain file in the
57502 user’s home directory. The <option>unseen</option> generic option should also be used, to
57503 ensure that the original delivery also proceeds. In this case, all the user has
57504 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
57510 Another advantage of both these methods is that they both work even when the
57511 use of arbitrary pipes by users is locked out.
57514 <section id="SECID245">
57515 <title>Taking copies of mail</title>
57517 <indexterm role="concept">
57518 <primary>message</primary>
57519 <secondary>copying every</secondary>
57521 Some installations have policies that require archive copies of all messages to
57522 be made. A single copy of each message can easily be taken by an appropriate
57523 command in a system filter, which could, for example, use a different file for
57524 each day’s messages.
57527 There is also a shadow transport mechanism that can be used to take copies of
57528 messages that are successfully delivered by local transports, one copy per
57529 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
57530 notification of delivery by sites that insist on doing such things.
57533 <section id="SECID246">
57534 <title>Intermittently connected hosts</title>
57536 <indexterm role="concept">
57537 <primary>intermittently connected hosts</primary>
57539 It has become quite common (because it is cheaper) for hosts to connect to the
57540 Internet periodically rather than remain connected all the time. The normal
57541 arrangement is that mail for such hosts accumulates on a system that is
57542 permanently connected.
57545 Exim was designed for use on permanently connected hosts, and so it is not
57546 particularly well-suited to use in an intermittently connected environment.
57547 Nevertheless there are some features that can be used.
57550 <section id="SECID247">
57551 <title>Exim on the upstream server host</title>
57553 It is tempting to arrange for incoming mail for the intermittently connected
57554 host to remain on Exim’s queue until the client connects. However, this
57555 approach does not scale very well. Two different kinds of waiting message are
57556 being mixed up in the same queue – those that cannot be delivered because of
57557 some temporary problem, and those that are waiting for their destination host
57558 to connect. This makes it hard to manage the queue, as well as wasting
57559 resources, because each queue runner scans the entire queue.
57562 A better approach is to separate off those messages that are waiting for an
57563 intermittently connected host. This can be done by delivering these messages
57564 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
57565 format, from where they are transmitted by other software when their
57566 destination connects. This makes it easy to collect all the mail for one host
57567 in a single directory, and to apply local timeout rules on a per-message basis
57571 On a very small scale, leaving the mail on Exim’s queue can be made to work. If
57572 you are doing this, you should configure Exim with a long retry period for the
57573 intermittent host. For example:
57575 <literallayout class="monospaced">
57576 cheshire.wonderland.fict.example * F,5d,24h
57579 This stops a lot of failed delivery attempts from occurring, but Exim remembers
57580 which messages it has queued up for that host. Once the intermittent host comes
57581 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
57582 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
57583 causes all the queued up messages to be delivered, often down a single SMTP
57584 connection. While the host remains connected, any new messages get delivered
57588 If the connecting hosts do not have fixed IP addresses, that is, if a host is
57589 issued with a different IP address each time it connects, Exim’s retry
57590 mechanisms on the holding host get confused, because the IP address is normally
57591 used as part of the key string for holding retry information. This can be
57592 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
57593 Since this has disadvantages for permanently connected hosts, it is best to
57594 arrange a separate transport for the intermittently connected ones.
57597 <section id="SECID248">
57598 <title>Exim on the intermittently connected client host</title>
57600 The value of <option>smtp_accept_queue_per_connection</option> should probably be
57601 increased, or even set to zero (that is, disabled) on the intermittently
57602 connected host, so that all incoming messages down a single connection get
57603 delivered immediately.
57606 <indexterm role="concept">
57607 <primary>SMTP</primary>
57608 <secondary>passed connection</secondary>
57610 <indexterm role="concept">
57611 <primary>SMTP</primary>
57612 <secondary>multiple deliveries</secondary>
57614 <indexterm role="concept">
57615 <primary>multiple SMTP deliveries</primary>
57617 Mail waiting to be sent from an intermittently connected host will probably
57618 not have been routed, because without a connection DNS lookups are not
57619 possible. This means that if a normal queue run is done at connection time,
57620 each message is likely to be sent in a separate SMTP session. This can be
57621 avoided by starting the queue run with a command line option beginning with
57622 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
57623 first pass, routing is done but no deliveries take place. The second pass is a
57624 normal queue run; since all the messages have been previously routed, those
57625 destined for the same host are likely to get sent as multiple deliveries in a
57626 single SMTP connection.
57631 <chapter id="CHAPnonqueueing">
57632 <title>Using Exim as a non-queueing client</title>
57633 <titleabbrev>Exim as a non-queueing client</titleabbrev>
57635 <indexterm role="concept">
57636 <primary>client, non-queueing</primary>
57638 <indexterm role="concept">
57639 <primary>smart host</primary>
57640 <secondary>suppressing queueing</secondary>
57642 On a personal computer, it is a common requirement for all
57643 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
57644 configured to operate that way, for all the popular operating systems.
57645 However, there are some MUAs for Unix-like systems that cannot be so
57646 configured: they submit messages using the command line interface of
57647 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
57651 If the personal computer runs continuously, there is no problem, because it can
57652 run a conventional MTA that handles delivery to the smart host, and deal with
57653 any delays via its queueing mechanism. However, if the computer does not run
57654 continuously or runs different operating systems at different times, queueing
57655 email is not desirable.
57658 There is therefore a requirement for something that can provide the
57659 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
57660 any queueing or retrying facilities. Furthermore, the delivery to the smart
57661 host should be synchronous, so that if it fails, the sending MUA is immediately
57662 informed. In other words, we want something that extends an MUA that submits
57663 to a local MTA via the command line so that it behaves like one that submits
57664 to a remote smart host using TCP/SMTP.
57667 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
57668 that do this job. However, people have found them to be lacking in various
57669 ways. For instance, you might want to allow aliasing and forwarding to be done
57670 before sending a message to the smart host.
57673 Exim already had the necessary infrastructure for doing this job. Just a few
57674 tweaks were needed to make it behave as required, though it is somewhat of an
57675 overkill to use a fully-featured MTA for this purpose.
57678 <indexterm role="option">
57679 <primary><option>mua_wrapper</option></primary>
57681 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
57682 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
57683 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
57684 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
57685 compatible router and transport configuration. Typically there will be just one
57686 router and one transport, sending everything to a smart host.
57689 When run in MUA wrapping mode, the behaviour of Exim changes in the
57695 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
57696 In other words, the only way to submit messages is via the command line.
57701 Each message is synchronously delivered as soon as it is received (<option>-odi</option> is
57702 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
57703 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
57704 does not finish until the delivery attempt is complete. If the delivery is
57705 successful, a zero return code is given.
57710 Address redirection is permitted, but the final routing for all addresses must
57711 be to the same remote transport, and to the same list of hosts. Furthermore,
57712 the return address (envelope sender) must be the same for all recipients, as
57713 must any added or deleted header lines. In other words, it must be possible to
57714 deliver the message in a single SMTP transaction, however many recipients there
57720 If these conditions are not met, or if routing any address results in a
57721 failure or defer status, or if Exim is unable to deliver all the recipients
57722 successfully to one of the smart hosts, delivery of the entire message fails.
57727 Because no queueing is allowed, all failures are treated as permanent; there
57728 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
57729 smart host. Furthermore, because only a single yes/no response can be given to
57730 the caller, it is not possible to deliver to some recipients and not others. If
57731 there is an error (temporary or permanent) for any recipient, all are failed.
57736 If more than one smart host is listed, Exim will try another host after a
57737 connection failure or a timeout, in the normal way. However, if this kind of
57738 failure happens for all the hosts, the delivery fails.
57743 When delivery fails, an error message is written to the standard error stream
57744 (as well as to Exim’s log), and Exim exits to the caller with a return code
57745 value 1. The message is expunged from Exim’s spool files. No bounce messages
57746 are ever generated.
57751 No retry data is maintained, and any retry rules are ignored.
57756 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
57757 true, <option>max_rcpt</option> in the <command>smtp</command> transport is forced to <quote>unlimited</quote>,
57758 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
57763 The overall effect is that Exim makes a single synchronous attempt to deliver
57764 the message, failing if there is any kind of problem. Because no local
57765 deliveries are done and no daemon can be run, Exim does not need root
57766 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
57767 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
57768 the advantages and disadvantages of running without root privilege.
57772 <chapter id="CHAPlog">
57773 <title>Log files</title>
57775 <indexterm role="concept" id="IIDloggen" class="startofrange">
57776 <primary>log</primary>
57777 <secondary>general description</secondary>
57779 <indexterm role="concept">
57780 <primary>log</primary>
57781 <secondary>types of</secondary>
57783 Exim writes three different logs, referred to as the main log, the reject log,
57789 <indexterm role="concept">
57790 <primary>main log</primary>
57792 The main log records the arrival of each message and each delivery in a single
57793 line in each case. The format is as compact as possible, in an attempt to keep
57794 down the size of log files. Two-character flag sequences make it easy to pick
57795 out these lines. A number of other events are recorded in the main log. Some of
57796 them are optional, in which case the <option>log_selector</option> option controls whether
57797 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
57798 analysis of main log files, is provided in the Exim distribution (see section
57799 <xref linkend="SECTmailstat"/>).
57804 <indexterm role="concept">
57805 <primary>reject log</primary>
57807 The reject log records information from messages that are rejected as a result
57808 of a configuration option (that is, for policy reasons).
57809 The first line of each rejection is a copy of the line that is also written to
57810 the main log. Then, if the message’s header has been read at the time the log
57811 is written, its contents are written to this log. Only the original header
57812 lines are available; header lines added by ACLs are not logged. You can use the
57813 reject log to check that your policy controls are working correctly; on a busy
57814 host this may be easier than scanning the main log for rejection messages. You
57815 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
57821 <indexterm role="concept">
57822 <primary>panic log</primary>
57824 <indexterm role="concept">
57825 <primary>system log</primary>
57827 When certain serious errors occur, Exim writes entries to its panic log. If the
57828 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
57829 are usually written to the main log as well, but can get lost amid the mass of
57830 other entries. The panic log should be empty under normal circumstances. It is
57831 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
57832 regularly, in order to become aware of any problems. When Exim cannot open its
57833 panic log, it tries as a last resort to write to the system log (syslog). This
57834 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
57835 message itself is written at priority LOG_CRIT.
57840 Every log line starts with a timestamp, in the format shown in the following
57841 example. Note that many of the examples shown in this chapter are line-wrapped.
57842 In the log file, this would be all on one line:
57844 <literallayout class="monospaced">
57845 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
57849 By default, the timestamps are in the local timezone. There are two
57850 ways of changing this:
57855 You can set the <option>timezone</option> option to a different time zone; in particular, if
57858 <literallayout class="monospaced">
57862 the timestamps will be in UTC (aka GMT).
57867 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
57870 <literallayout class="monospaced">
57871 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
57876 <indexterm role="concept">
57877 <primary>log</primary>
57878 <secondary>process ids in</secondary>
57880 <indexterm role="concept">
57881 <primary>pid (process id)</primary>
57882 <secondary>in log lines</secondary>
57884 Exim does not include its process id in log lines by default, but you can
57885 request that it does so by specifying the <literal>pid</literal> log selector (see section
57886 <xref linkend="SECTlogselector"/>). When this is set, the process id is output, in square
57887 brackets, immediately after the time and date.
57889 <section id="SECTwhelogwri">
57890 <title>Where the logs are written</title>
57892 <indexterm role="concept">
57893 <primary>log</primary>
57894 <secondary>destination</secondary>
57896 <indexterm role="concept">
57897 <primary>log</primary>
57898 <secondary>to file</secondary>
57900 <indexterm role="concept">
57901 <primary>log</primary>
57902 <secondary>to syslog</secondary>
57904 <indexterm role="concept">
57905 <primary>syslog</primary>
57907 The logs may be written to local files, or to syslog, or both. However, it
57908 should be noted that many syslog implementations use UDP as a transport, and
57909 are therefore unreliable in the sense that messages are not guaranteed to
57910 arrive at the loghost, nor is the ordering of messages necessarily maintained.
57911 It has also been reported that on large log files (tens of megabytes) you may
57912 need to tweak syslog to prevent it syncing the file with each write – on
57913 Linux this has been seen to make syslog take 90% plus of CPU time.
57916 The destination for Exim’s logs is configured by setting LOG_FILE_PATH in
57917 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the run time
57918 configuration. This latter string is expanded, so it can contain, for example,
57919 references to the host name:
57921 <literallayout class="monospaced">
57922 log_file_path = /var/log/$primary_hostname/exim_%slog
57925 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
57926 rather than at run time, because then the setting is available right from the
57927 start of Exim’s execution. Otherwise, if there’s something it wants to log
57928 before it has read the configuration file (for example, an error in the
57929 configuration file) it will not use the path you want, and may not be able to
57933 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
57934 list, currently limited to at most two items. This is one option where the
57935 facility for changing a list separator may not be used. The list must always be
57936 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
57937 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
57938 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
57939 implying the use of a default path.
57942 When Exim encounters an empty item in the list, it searches the list defined by
57943 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
57944 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
57945 mean <quote>use the path specified at build time</quote>. It no such item exists, log
57946 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
57947 equivalent to the setting:
57949 <literallayout class="monospaced">
57950 log_file_path = $spool_directory/log/%slog
57953 If you do not specify anything at build time or run time, that is where the
57957 A log file path may also contain <literal>%D</literal> if datestamped log file names are in
57958 use – see section <xref linkend="SECTdatlogfil"/> below.
57961 Here are some examples of possible settings:
57964 <literal>LOG_FILE_PATH=syslog </literal> syslog only
57965 <literal>LOG_FILE_PATH=:syslog </literal> syslog and default path
57966 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
57967 <literal>LOG_FILE_PATH=/usr/log/exim_%s </literal> specified path only
57970 If there are more than two paths in the list, the first is used and a panic
57974 <section id="SECID285">
57975 <title>Logging to local files that are periodically <quote>cycled</quote></title>
57977 <indexterm role="concept">
57978 <primary>log</primary>
57979 <secondary>cycling local files</secondary>
57981 <indexterm role="concept">
57982 <primary>cycling logs</primary>
57984 <indexterm role="concept">
57985 <primary><emphasis>exicyclog</emphasis></primary>
57987 <indexterm role="concept">
57988 <primary>log</primary>
57989 <secondary>local files; writing to</secondary>
57991 Some operating systems provide centralized and standardized methods for cycling
57992 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
57993 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
57994 main and reject logs each time it is called. The maximum number of old logs to
57995 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
57998 An Exim delivery process opens the main log when it first needs to write to it,
57999 and it keeps the file open in case subsequent entries are required – for
58000 example, if a number of different deliveries are being done for the same
58001 message. However, remote SMTP deliveries can take a long time, and this means
58002 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
58003 something similar is being used to rename log files on a regular basis. To
58004 ensure that a switch of log files is noticed as soon as possible, Exim calls
58005 <function>stat()</function> on the main log’s name before reusing an open file, and if the file
58006 does not exist, or its inode has changed, the old file is closed and Exim
58007 tries to open the main log from scratch. Thus, an old log file may remain open
58008 for quite some time, but no Exim processes should write to it once it has been
58012 <section id="SECTdatlogfil">
58013 <title>Datestamped log files</title>
58015 <indexterm role="concept">
58016 <primary>log</primary>
58017 <secondary>datestamped files</secondary>
58019 Instead of cycling the main and reject log files by renaming them
58020 periodically, some sites like to use files whose names contain a datestamp,
58021 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename>.
58022 Exim has support for this way of working. It is enabled by setting the
58023 <option>log_file_path</option> option to a path that includes <literal>%D</literal> at the point where the
58024 datestamp is required. For example:
58026 <literallayout class="monospaced">
58027 log_file_path = /var/spool/exim/log/%slog-%D
58028 log_file_path = /var/log/exim-%s-%D.log
58029 log_file_path = /var/spool/exim/log/%D-%slog
58032 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
58033 examples of names generated by the above examples:
58035 <literallayout class="monospaced">
58036 /var/spool/exim/log/mainlog-20021225
58037 /var/log/exim-reject-20021225.log
58038 /var/spool/exim/log/20021225-mainlog
58041 When this form of log file is specified, Exim automatically switches to new
58042 files at midnight. It does not make any attempt to compress old logs; you
58043 will need to write your own script if you require this. You should not
58044 run <emphasis>exicyclog</emphasis> with this form of logging.
58047 The location of the panic log is also determined by <option>log_file_path</option>, but it
58048 is not datestamped, because rotation of the panic log does not make sense.
58049 When generating the name of the panic log, <literal>%D</literal> is removed from the string.
58050 In addition, if it immediately follows a slash, a following non-alphanumeric
58051 character is removed; otherwise a preceding non-alphanumeric character is
58052 removed. Thus, the three examples above would give these panic log names:
58054 <literallayout class="monospaced">
58055 /var/spool/exim/log/paniclog
58056 /var/log/exim-panic.log
58057 /var/spool/exim/log/paniclog
58060 <section id="SECID249">
58061 <title>Logging to syslog</title>
58063 <indexterm role="concept">
58064 <primary>log</primary>
58065 <secondary>syslog; writing to</secondary>
58067 The use of syslog does not change what Exim logs or the format of its messages,
58068 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
58069 Exim’s log lines are omitted when these lines are sent to syslog. Apart from
58070 that, the same strings are written to syslog as to log files. The syslog
58071 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
58072 by default, but you can change these by setting the <option>syslog_facility</option> and
58073 <option>syslog_processname</option> options, respectively. If Exim was compiled with
58074 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
58075 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
58076 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
58077 the time and host name to each line.
58078 The three log streams are mapped onto syslog priorities as follows:
58083 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
58088 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
58093 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
58098 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
58099 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
58100 these are routed by syslog to the same place. You can suppress this duplication
58101 by setting <option>syslog_duplication</option> false.
58104 Exim’s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
58105 entries contain multiple lines when headers are included. To cope with both
58106 these cases, entries written to syslog are split into separate <function>syslog()</function>
58107 calls at each internal newline, and also after a maximum of
58108 870 data characters. (This allows for a total syslog line length of 1024, when
58109 additions such as timestamps are added.) If you are running a syslog
58110 replacement that can handle lines longer than the 1024 characters allowed by
58111 RFC 3164, you should set
58113 <literallayout class="monospaced">
58114 SYSLOG_LONG_LINES=yes
58117 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
58118 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
58121 To make it easy to re-assemble split lines later, each component of a split
58122 entry starts with a string of the form [<<emphasis>n</emphasis>>/<<emphasis>m</emphasis>>] or [<<emphasis>n</emphasis>>\<<emphasis>m</emphasis>>]
58123 where <<emphasis>n</emphasis>> is the component number and <<emphasis>m</emphasis>> is the total number of
58124 components in the entry. The / delimiter is used when the line was split
58125 because it was too long; if it was split because of an internal newline, the \
58126 delimiter is used. For example, supposing the length limit to be 50 instead of
58127 870, the following would be the result of a typical rejection message to
58128 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
58129 name, and pid as added by syslog:
58131 <literallayout class="monospaced">
58132 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
58133 [2/5] [127.0.0.1] (ph10): syntax error in 'From' header
58134 [3/5] when scanning for sender: missing or malformed lo
58135 [4/5] cal part in "<>" (envelope sender is <ph10@cam.exa
58139 The same error might cause the following lines to be written to <quote>rejectlog</quote>
58142 <literallayout class="monospaced">
58143 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
58144 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
58145 [3/18] er when scanning for sender: missing or malformed
58146 [4/18] local part in "<>" (envelope sender is <ph10@cam
58147 [5\18] .example>)
58148 [6\18] Recipients: ph10@some.domain.cam.example
58149 [7\18] P Received: from [127.0.0.1] (ident=ph10)
58150 [8\18] by xxxxx.cam.example with smtp (Exim 4.00)
58151 [9\18] id 16RdAL-0006pc-00
58152 [10/18] for ph10@cam.example; Mon, 16 Sep 2002 16:
58153 [11\18] 09:43 +0100
58154 [12\18] F From: <>
58155 [13\18] Subject: this is a test header
58156 [18\18] X-something: this is another header
58157 [15/18] I Message-Id: <E16RdAL-0006pc-00@xxxxx.cam.examp
58160 [18/18] Date: Mon, 16 Sep 2002 16:09:43 +0100
58163 Log lines that are neither too long nor contain newlines are written to syslog
58164 without modification.
58167 If only syslog is being used, the Exim monitor is unable to provide a log tail
58168 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
58169 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
58173 <section id="SECID250">
58174 <title>Log line flags</title>
58176 One line is written to the main log for each message received, and for each
58177 successful, unsuccessful, and delayed delivery. These lines can readily be
58178 picked out by the distinctive two-character flags that immediately follow the
58179 timestamp. The flags are:
58182 <literal><=</literal> message arrival
58183 <literal>=></literal> normal message delivery
58184 <literal>-></literal> additional address in same delivery
58185 <literal>*></literal> delivery suppressed by <option>-N</option>
58186 <literal>**</literal> delivery failed; address bounced
58187 <literal>==</literal> delivery deferred; temporary problem
58190 <section id="SECID251">
58191 <title>Logging message reception</title>
58193 <indexterm role="concept">
58194 <primary>log</primary>
58195 <secondary>reception line</secondary>
58197 The format of the single-line entry in the main log that is written for every
58198 message received is shown in the basic example below, which is split over
58199 several lines in order to fit it on the page:
58201 <literallayout class="monospaced">
58202 2002-10-31 08:57:53 16ZCW1-0005MB-00 <= kryten@dwarf.fict.example
58203 H=mailer.fict.example [192.168.123.123] U=exim
58204 P=smtp S=5678 id=<incoming message id>
58207 The address immediately following <quote><=</quote> is the envelope sender address. A
58208 bounce message is shown with the sender address <quote><></quote>, and if it is locally
58209 generated, this is followed by an item of the form
58211 <literallayout class="monospaced">
58212 R=<message id>
58215 which is a reference to the message that caused the bounce to be sent.
58218 <indexterm role="concept">
58219 <primary>HELO</primary>
58221 <indexterm role="concept">
58222 <primary>EHLO</primary>
58224 For messages from other hosts, the H and U fields identify the remote host and
58225 record the RFC 1413 identity of the user that sent the message, if one was
58226 received. The number given in square brackets is the IP address of the sending
58227 host. If there is a single, unparenthesized host name in the H field, as
58228 above, it has been verified to correspond to the IP address (see the
58229 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
58230 by the remote host in the SMTP HELO or EHLO command, and has not been
58231 verified. If verification yields a different name to that given for HELO or
58232 EHLO, the verified name appears first, followed by the HELO or EHLO
58233 name in parentheses.
58236 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
58237 without brackets, in the HELO or EHLO command, leading to entries in
58238 the log containing text like these examples:
58240 <literallayout class="monospaced">
58241 H=(10.21.32.43) [192.168.8.34]
58242 H=([10.21.32.43]) [192.168.8.34]
58245 This can be confusing. Only the final address in square brackets can be relied
58249 For locally generated messages (that is, messages not received over TCP/IP),
58250 the H field is omitted, and the U field contains the login name of the caller
58254 <indexterm role="concept">
58255 <primary>authentication</primary>
58256 <secondary>logging</secondary>
58258 <indexterm role="concept">
58259 <primary>AUTH</primary>
58260 <secondary>logging</secondary>
58262 For all messages, the P field specifies the protocol used to receive the
58263 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
58264 of incoming SMTP messages, the value indicates whether or not any SMTP
58265 extensions (ESMTP), encryption, or authentication were used. If the SMTP
58266 session was encrypted, there is an additional X field that records the cipher
58267 suite that was used.
58270 The protocol is set to <quote>esmtpsa</quote> or <quote>esmtpa</quote> for messages received from
58271 hosts that have authenticated themselves using the SMTP AUTH command. The first
58272 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
58273 there is an additional item A= followed by the name of the authenticator that
58274 was used. If an authenticated identification was set up by the authenticator’s
58275 <option>server_set_id</option> option, this is logged too, separated by a colon from the
58276 authenticator name.
58279 <indexterm role="concept">
58280 <primary>size</primary>
58281 <secondary>of message</secondary>
58283 The id field records the existing message id, if present. The size of the
58284 received message is given by the S field. When the message is delivered,
58285 headers may be removed or added, so that the size of delivered copies of the
58286 message may not correspond with this value (and indeed may be different to each
58290 The <option>log_selector</option> option can be used to request the logging of additional
58291 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
58294 <section id="SECID252">
58295 <title>Logging deliveries</title>
58297 <indexterm role="concept">
58298 <primary>log</primary>
58299 <secondary>delivery line</secondary>
58301 The format of the single-line entry in the main log that is written for every
58302 delivery is shown in one of the examples below, for local and remote
58303 deliveries, respectively. Each example has been split into two lines in order
58304 to fit it on the page:
58306 <literallayout class="monospaced">
58307 2002-10-31 08:59:13 16ZCW1-0005MB-00 => marv
58308 <marv@hitch.fict.example> R=localuser T=local_delivery
58309 2002-10-31 09:00:10 16ZCW1-0005MB-00 =>
58310 monk@holistic.fict.example R=dnslookup T=remote_smtp
58311 H=holistic.fict.example [192.168.234.234]
58314 For ordinary local deliveries, the original address is given in angle brackets
58315 after the final delivery address, which might be a pipe or a file. If
58316 intermediate address(es) exist between the original and the final address, the
58317 last of these is given in parentheses after the final address. The R and T
58318 fields record the router and transport that were used to process the address.
58321 If a shadow transport was run after a successful local delivery, the log line
58322 for the successful delivery has an item added on the end, of the form
58325 <literal>ST=<</literal><emphasis>shadow transport name</emphasis><literal>></literal>
58328 If the shadow transport did not succeed, the error message is put in
58329 parentheses afterwards.
58332 <indexterm role="concept">
58333 <primary>asterisk</primary>
58334 <secondary>after IP address</secondary>
58336 When more than one address is included in a single delivery (for example, two
58337 SMTP RCPT commands in one transaction) the second and subsequent addresses are
58338 flagged with <literal>-></literal> instead of <literal>=></literal>. When two or more messages are delivered
58339 down a single SMTP connection, an asterisk follows the IP address in the log
58340 lines for the second and subsequent messages.
58343 The generation of a reply message by a filter file gets logged as a
58344 <quote>delivery</quote> to the addressee, preceded by <quote>></quote>.
58347 The <option>log_selector</option> option can be used to request the logging of additional
58348 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
58351 <section id="SECID253">
58352 <title>Discarded deliveries</title>
58354 <indexterm role="concept">
58355 <primary>discarded messages</primary>
58357 <indexterm role="concept">
58358 <primary>message</primary>
58359 <secondary>discarded</secondary>
58361 <indexterm role="concept">
58362 <primary>delivery</primary>
58363 <secondary>discarded; logging</secondary>
58365 When a message is discarded as a result of the command <quote>seen finish</quote> being
58366 obeyed in a filter file which generates no deliveries, a log entry of the form
58368 <literallayout class="monospaced">
58369 2002-12-10 00:50:49 16auJc-0001UB-00 => discarded
58370 <low.club@bridge.example> R=userforward
58373 is written, to record why no deliveries are logged. When a message is discarded
58374 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
58376 <literallayout class="monospaced">
58377 1999-03-02 09:44:33 10HmaX-0005vi-00 => :blackhole:
58378 <hole@nowhere.example> R=blackhole_router
58381 <section id="SECID254">
58382 <title>Deferred deliveries</title>
58384 When a delivery is deferred, a line of the following form is logged:
58386 <literallayout class="monospaced">
58387 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
58388 R=dnslookup T=smtp defer (146): Connection refused
58391 In the case of remote deliveries, the error is the one that was given for the
58392 last IP address that was tried. Details of individual SMTP failures are also
58393 written to the log, so the above line would be preceded by something like
58395 <literallayout class="monospaced">
58396 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
58397 mail1.endrest.example [192.168.239.239]: Connection refused
58400 When a deferred address is skipped because its retry time has not been reached,
58401 a message is written to the log, but this can be suppressed by setting an
58402 appropriate value in <option>log_selector</option>.
58405 <section id="SECID255">
58406 <title>Delivery failures</title>
58408 <indexterm role="concept">
58409 <primary>delivery</primary>
58410 <secondary>failure; logging</secondary>
58412 If a delivery fails because an address cannot be routed, a line of the
58413 following form is logged:
58415 <literallayout class="monospaced">
58416 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
58417 <jim@trek99.example>: unknown mail domain
58420 If a delivery fails at transport time, the router and transport are shown, and
58421 the response from the remote host is included, as in this example:
58423 <literallayout class="monospaced">
58424 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
58425 R=dnslookup T=remote_smtp: SMTP error from remote mailer
58426 after pipelined RCPT TO:<ace400@pb.example>: host
58427 pbmail3.py.example [192.168.63.111]: 553 5.3.0
58428 <ace400@pb.example>...Addressee unknown
58431 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
58432 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
58433 disabling PIPELINING. The log lines for all forms of delivery failure are
58434 flagged with <literal>**</literal>.
58437 <section id="SECID256">
58438 <title>Fake deliveries</title>
58440 <indexterm role="concept">
58441 <primary>delivery</primary>
58442 <secondary>fake; logging</secondary>
58444 If a delivery does not actually take place because the <option>-N</option> option has been
58445 used to suppress it, a normal delivery line is written to the log, except that
58446 <quote>=></quote> is replaced by <quote>*></quote>.
58449 <section id="SECID257">
58450 <title>Completion</title>
58454 <literallayout class="monospaced">
58455 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
58458 is written to the main log when a message is about to be removed from the spool
58459 at the end of its processing.
58462 <section id="SECID258">
58463 <title>Summary of Fields in Log Lines</title>
58465 <indexterm role="concept">
58466 <primary>log</primary>
58467 <secondary>summary of fields</secondary>
58469 A summary of the field identifiers that are used in log lines is shown in
58470 the following table:
58473 <literal>A </literal> authenticator name (and optional id)
58474 <literal>C </literal> SMTP confirmation on delivery
58475 <literal> </literal> command list for <quote>no mail in SMTP session</quote>
58476 <literal>CV </literal> certificate verification status
58477 <literal>D </literal> duration of <quote>no mail in SMTP session</quote>
58478 <literal>DN </literal> distinguished name from peer certificate
58479 <literal>DT </literal> on <literal>=></literal> lines: time taken for a delivery
58480 <literal>F </literal> sender address (on delivery lines)
58481 <literal>H </literal> host name and IP address
58482 <literal>I </literal> local interface used
58483 <literal>id </literal> message id for incoming message
58484 <literal>P </literal> on <literal><=</literal> lines: protocol used
58485 <literal> </literal> on <literal>=></literal> and <literal>**</literal> lines: return path
58486 <literal>QT </literal> on <literal>=></literal> lines: time spent on queue so far
58487 <literal> </literal> on <quote>Completed</quote> lines: time spent on queue
58488 <literal>R </literal> on <literal><=</literal> lines: reference for local bounce
58489 <literal> </literal> on <literal>=></literal> <literal>**</literal> and <literal>==</literal> lines: router name
58490 <literal>S </literal> size of message
58491 <literal>ST </literal> shadow transport name
58492 <literal>T </literal> on <literal><=</literal> lines: message subject (topic)
58493 <literal> </literal> on <literal>=></literal> <literal>**</literal> and <literal>==</literal> lines: transport name
58494 <literal>U </literal> local user or RFC 1413 identity
58495 <literal>X </literal> TLS cipher suite
58498 <section id="SECID259">
58499 <title>Other log entries</title>
58501 Various other types of log entry are written from time to time. Most should be
58502 self-explanatory. Among the more common are:
58507 <indexterm role="concept">
58508 <primary>retry</primary>
58509 <secondary>time not reached</secondary>
58511 <emphasis>retry time not reached</emphasis> An address previously suffered a temporary error
58512 during routing or local delivery, and the time to retry has not yet arrived.
58513 This message is not written to an individual message log file unless it happens
58514 during the first delivery attempt.
58519 <emphasis>retry time not reached for any host</emphasis> An address previously suffered
58520 temporary errors during remote delivery, and the retry time has not yet arrived
58521 for any of the hosts to which it is routed.
58526 <indexterm role="concept">
58527 <primary>spool directory</primary>
58528 <secondary>file locked</secondary>
58530 <emphasis>spool file locked</emphasis> An attempt to deliver a message cannot proceed because
58531 some other Exim process is already working on the message. This can be quite
58532 common if queue running processes are started at frequent intervals. The
58533 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
58539 <indexterm role="concept">
58540 <primary>error</primary>
58541 <secondary>ignored</secondary>
58543 <emphasis>error ignored</emphasis> There are several circumstances that give rise to this
58546 <orderedlist numeration="arabic">
58549 Exim failed to deliver a bounce message whose age was greater than
58550 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
58555 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
58556 failed. The delivery was discarded.
58561 A delivery set up by a router configured with
58563 <literallayout class="monospaced">
58564 errors_to = <>
58567 failed. The delivery was discarded.
58574 <section id="SECTlogselector">
58575 <title>Reducing or increasing what is logged</title>
58577 <indexterm role="concept">
58578 <primary>log</primary>
58579 <secondary>selectors</secondary>
58581 By setting the <option>log_selector</option> global option, you can disable some of Exim’s
58582 default logging, or you can request additional logging. The value of
58583 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
58586 <literallayout class="monospaced">
58587 log_selector = +arguments -retry_defer
58590 The list of optional log items is in the following table, with the default
58591 selection marked by asterisks:
58594 <literal>*acl_warn_skipped </literal> skipped <option>warn</option> statement in ACL
58595 <literal> address_rewrite </literal> address rewriting
58596 <literal> all_parents </literal> all parents in => lines
58597 <literal> arguments </literal> command line arguments
58598 <literal>*connection_reject </literal> connection rejections
58599 <literal>*delay_delivery </literal> immediate delivery delayed
58600 <literal> deliver_time </literal> time taken to perform delivery
58601 <literal> delivery_size </literal> add <literal>S=</literal><emphasis>nnn</emphasis> to => lines
58602 <literal>*dnslist_defer </literal> defers of DNS list (aka RBL) lookups
58603 <literal>*etrn </literal> ETRN commands
58604 <literal>*host_lookup_failed </literal> as it says
58605 <literal> ident_timeout </literal> timeout for ident connection
58606 <literal> incoming_interface </literal> incoming interface on <= lines
58607 <literal> incoming_port </literal> incoming port on <= lines
58608 <literal>*lost_incoming_connection </literal> as it says (includes timeouts)
58609 <literal> outgoing_port </literal> add remote port to => lines
58610 <literal>*queue_run </literal> start and end queue runs
58611 <literal> queue_time </literal> time on queue for one recipient
58612 <literal> queue_time_overall </literal> time on queue for whole message
58613 <literal> pid </literal> Exim process id
58614 <literal> received_recipients </literal> recipients on <= lines
58615 <literal> received_sender </literal> sender on <= lines
58616 <literal>*rejected_header </literal> header contents on reject log
58617 <literal>*retry_defer </literal> <quote>retry time not reached</quote>
58618 <literal> return_path_on_delivery </literal> put return path on => and ** lines
58619 <literal> sender_on_delivery </literal> add sender to => lines
58620 <literal>*sender_verify_fail </literal> sender verification failures
58621 <literal>*size_reject </literal> rejection because too big
58622 <literal>*skip_delivery </literal> delivery skipped in a queue run
58623 <literal> smtp_confirmation </literal> SMTP confirmation on => lines
58624 <literal> smtp_connection </literal> SMTP connections
58625 <literal> smtp_incomplete_transaction</literal> incomplete SMTP transactions
58626 <literal> smtp_no_mail </literal> session with no MAIL commands
58627 <literal> smtp_protocol_error </literal> SMTP protocol errors
58628 <literal> smtp_syntax_error </literal> SMTP syntax errors
58629 <literal> subject </literal> contents of <emphasis>Subject:</emphasis> on <= lines
58630 <literal> tls_certificate_verified </literal> certificate verification status
58631 <literal>*tls_cipher </literal> TLS cipher suite on <= and => lines
58632 <literal> tls_peerdn </literal> TLS peer DN on <= and => lines
58633 <literal> unknown_in_list </literal> DNS lookup failed in list match
58635 <literal> all </literal> all of the above
58638 More details on each of these items follows:
58643 <indexterm role="concept">
58644 <primary><option>warn</option> ACL verb</primary>
58645 <secondary>log when skipping</secondary>
58647 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
58648 its conditions cannot be evaluated, a log line to this effect is written if
58649 this log selector is set.
58654 <indexterm role="concept">
58655 <primary>log</primary>
58656 <secondary>rewriting</secondary>
58658 <indexterm role="concept">
58659 <primary>rewriting</primary>
58660 <secondary>logging</secondary>
58662 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
58663 rewrites, but not to rewrites in filters run as an unprivileged user (because
58664 such users cannot access the log).
58669 <indexterm role="concept">
58670 <primary>log</primary>
58671 <secondary>full parentage</secondary>
58673 <option>all_parents</option>: Normally only the original and final addresses are logged on
58674 delivery lines; with this selector, intermediate parents are given in
58675 parentheses between them.
58680 <indexterm role="concept">
58681 <primary>log</primary>
58682 <secondary>Exim arguments</secondary>
58684 <indexterm role="concept">
58685 <primary>Exim arguments, logging</primary>
58687 <option>arguments</option>: This causes Exim to write the arguments with which it was called
58688 to the main log, preceded by the current working directory. This is a debugging
58689 feature, added to make it easier to find out how certain MUAs call
58690 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
58691 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
58692 that are empty or that contain white space are quoted. Non-printing characters
58693 are shown as escape sequences. This facility cannot log unrecognized arguments,
58694 because the arguments are checked before the configuration file is read. The
58695 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
58696 between the caller and Exim.
58701 <indexterm role="concept">
58702 <primary>log</primary>
58703 <secondary>connection rejections</secondary>
58705 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
58706 connection is rejected, for whatever reason.
58711 <indexterm role="concept">
58712 <primary>log</primary>
58713 <secondary>delayed delivery</secondary>
58715 <indexterm role="concept">
58716 <primary>delayed delivery, logging</primary>
58718 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
58719 started for an incoming message because the load is too high or too many
58720 messages were received on one connection. Logging does not occur if no delivery
58721 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
58726 <indexterm role="concept">
58727 <primary>log</primary>
58728 <secondary>delivery duration</secondary>
58730 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
58731 perform the actual delivery is logged as DT=<<emphasis>time</emphasis>>, for example, <literal>DT=1s</literal>.
58736 <indexterm role="concept">
58737 <primary>log</primary>
58738 <secondary>message size on delivery</secondary>
58740 <indexterm role="concept">
58741 <primary>size</primary>
58742 <secondary>of message</secondary>
58744 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
58745 the <quote>=></quote> line, tagged with S=.
58750 <indexterm role="concept">
58751 <primary>log</primary>
58752 <secondary>dnslist defer</secondary>
58754 <indexterm role="concept">
58755 <primary>DNS list</primary>
58756 <secondary>logging defer</secondary>
58758 <indexterm role="concept">
58759 <primary>black list (DNS)</primary>
58761 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
58762 DNS black list suffers a temporary error.
58767 <indexterm role="concept">
58768 <primary>log</primary>
58769 <secondary>ETRN commands</secondary>
58771 <indexterm role="concept">
58772 <primary>ETRN</primary>
58773 <secondary>logging</secondary>
58775 <option>etrn</option>: Every valid ETRN command that is received is logged, before the ACL
58776 is run to determine whether or not it is actually accepted. An invalid ETRN
58777 command, or one received within a message transaction is not logged by this
58778 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
58783 <indexterm role="concept">
58784 <primary>log</primary>
58785 <secondary>host lookup failure</secondary>
58787 <option>host_lookup_failed</option>: When a lookup of a host’s IP addresses fails to find
58788 any addresses, or when a lookup of an IP address fails to find a host name, a
58789 log line is written. This logging does not apply to direct DNS lookups when
58790 routing email addresses, but it does apply to <quote>byname</quote> lookups.
58795 <indexterm role="concept">
58796 <primary>log</primary>
58797 <secondary>ident timeout</secondary>
58799 <indexterm role="concept">
58800 <primary>RFC 1413</primary>
58801 <secondary>logging timeout</secondary>
58803 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
58804 client’s ident port times out.
58809 <indexterm role="concept">
58810 <primary>log</primary>
58811 <secondary>incoming interface</secondary>
58813 <indexterm role="concept">
58814 <primary>interface</primary>
58815 <secondary>logging</secondary>
58817 <option>incoming_interface</option>: The interface on which a message was received is added
58818 to the <quote><=</quote> line as an IP address in square brackets, tagged by I= and
58819 followed by a colon and the port number. The local interface and port are also
58820 added to other SMTP log lines, for example <quote>SMTP connection from</quote>, and to
58826 <indexterm role="concept">
58827 <primary>log</primary>
58828 <secondary>incoming remote port</secondary>
58830 <indexterm role="concept">
58831 <primary>port</primary>
58832 <secondary>logging remote</secondary>
58834 <indexterm role="concept">
58835 <primary>TCP/IP</primary>
58836 <secondary>logging incoming remote port</secondary>
58838 <indexterm role="variable">
58839 <primary><varname>$sender_fullhost</varname></primary>
58841 <indexterm role="variable">
58842 <primary><varname>$sender_rcvhost</varname></primary>
58844 <option>incoming_port</option>: The remote port number from which a message was received is
58845 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
58846 in square brackets, and separated from it by a colon. This is implemented by
58847 changing the value that is put in the <varname>$sender_fullhost</varname> and
58848 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
58849 important with the widening use of NAT (see RFC 2505).
58854 <indexterm role="concept">
58855 <primary>log</primary>
58856 <secondary>dropped connection</secondary>
58858 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
58859 connection is unexpectedly dropped.
58864 <indexterm role="concept">
58865 <primary>log</primary>
58866 <secondary>outgoing remote port</secondary>
58868 <indexterm role="concept">
58869 <primary>port</primary>
58870 <secondary>logging outgoint remote</secondary>
58872 <indexterm role="concept">
58873 <primary>TCP/IP</primary>
58874 <secondary>logging ougtoing remote port</secondary>
58876 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
58877 containing => tags) following the IP address. This option is not included in
58878 the default setting, because for most ordinary configurations, the remote port
58879 number is always 25 (the SMTP port).
58884 <indexterm role="concept">
58885 <primary>log</primary>
58886 <secondary>process ids in</secondary>
58888 <indexterm role="concept">
58889 <primary>pid (process id)</primary>
58890 <secondary>in log lines</secondary>
58892 <option>pid</option>: The current process id is added to every log line, in square brackets,
58893 immediately after the time and date.
58898 <indexterm role="concept">
58899 <primary>log</primary>
58900 <secondary>queue run</secondary>
58902 <indexterm role="concept">
58903 <primary>queue runner</primary>
58904 <secondary>logging</secondary>
58906 <option>queue_run</option>: The start and end of every queue run are logged.
58911 <indexterm role="concept">
58912 <primary>log</primary>
58913 <secondary>queue time</secondary>
58915 <option>queue_time</option>: The amount of time the message has been in the queue on the
58916 local host is logged as QT=<<emphasis>time</emphasis>> on delivery (<literal>=></literal>) lines, for example,
58917 <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the message, so it
58918 includes reception time as well as the delivery time for the current address.
58919 This means that it may be longer than the difference between the arrival and
58920 delivery log line times, because the arrival log line is not written until the
58921 message has been successfully received.
58926 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
58927 the local host is logged as QT=<<emphasis>time</emphasis>> on <quote>Completed</quote> lines, for
58928 example, <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the
58929 message, so it includes reception time as well as the total delivery time.
58934 <indexterm role="concept">
58935 <primary>log</primary>
58936 <secondary>recipients</secondary>
58938 <option>received_recipients</option>: The recipients of a message are listed in the main log
58939 as soon as the message is received. The list appears at the end of the log line
58940 that is written when a message is received, preceded by the word <quote>for</quote>. The
58941 addresses are listed after they have been qualified, but before any rewriting
58943 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
58949 <indexterm role="concept">
58950 <primary>log</primary>
58951 <secondary>sender reception</secondary>
58953 <option>received_sender</option>: The unrewritten original sender of a message is added to
58954 the end of the log line that records the message’s arrival, after the word
58955 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
58960 <indexterm role="concept">
58961 <primary>log</primary>
58962 <secondary>header lines for rejection</secondary>
58964 <option>rejected_header</option>: If a message’s header has been received at the time a
58965 rejection is written to the reject log, the complete header is added to the
58966 log. Header logging can be turned off individually for messages that are
58967 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
58972 <indexterm role="concept">
58973 <primary>log</primary>
58974 <secondary>retry defer</secondary>
58976 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
58977 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
58978 message is always omitted from individual message logs after the first delivery
58984 <indexterm role="concept">
58985 <primary>log</primary>
58986 <secondary>return path</secondary>
58988 <option>return_path_on_delivery</option>: The return path that is being transmitted with
58989 the message is included in delivery and bounce lines, using the tag P=.
58990 This is omitted if no delivery actually happens, for example, if routing fails,
58991 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
58996 <indexterm role="concept">
58997 <primary>log</primary>
58998 <secondary>sender on delivery</secondary>
59000 <option>sender_on_delivery</option>: The message’s sender address is added to every delivery
59001 and bounce line, tagged by F= (for <quote>from</quote>).
59002 This is the original sender that was received with the message; it is not
59003 necessarily the same as the outgoing return path.
59008 <indexterm role="concept">
59009 <primary>log</primary>
59010 <secondary>sender verify failure</secondary>
59012 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
59013 gives details of a sender verification failure is not written. Log lines for
59014 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
59020 <indexterm role="concept">
59021 <primary>log</primary>
59022 <secondary>size rejection</secondary>
59024 <option>size_reject</option>: A log line is written whenever a message is rejected because
59030 <indexterm role="concept">
59031 <primary>log</primary>
59032 <secondary>frozen messages; skipped</secondary>
59034 <indexterm role="concept">
59035 <primary>frozen messages</primary>
59036 <secondary>logging skipping</secondary>
59038 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
59039 queue run because it is frozen or because another process is already delivering
59041 <indexterm role="concept">
59042 <primary><quote>spool file is locked</quote></primary>
59044 The message that is written is <quote>spool file is locked</quote>.
59049 <indexterm role="concept">
59050 <primary>log</primary>
59051 <secondary>smtp confirmation</secondary>
59053 <indexterm role="concept">
59054 <primary>SMTP</primary>
59055 <secondary>logging confirmation</secondary>
59057 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP dialogue for
59058 outgoing messages is added to delivery log lines in the form <literal>C=</literal><<emphasis>text</emphasis>>.
59059 A number of MTAs (including Exim) return an identifying string in this
59065 <indexterm role="concept">
59066 <primary>log</primary>
59067 <secondary>SMTP connections</secondary>
59069 <indexterm role="concept">
59070 <primary>SMTP</primary>
59071 <secondary>logging connections</secondary>
59073 <option>smtp_connection</option>: A log line is written whenever an SMTP connection is
59074 established or closed, unless the connection is from a host that matches
59075 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
59076 only when the closure is unexpected.) This applies to connections from local
59077 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
59078 dropped in the middle of a message, a log line is always written, whether or
59079 not this selector is set, but otherwise nothing is written at the start and end
59080 of connections unless this selector is enabled.
59083 For TCP/IP connections to an Exim daemon, the current number of connections is
59084 included in the log message for each new connection, but note that the count is
59085 reset if the daemon is restarted.
59086 Also, because connections are closed (and the closure is logged) in
59087 subprocesses, the count may not include connections that have been closed but
59088 whose termination the daemon has not yet noticed. Thus, while it is possible to
59089 match up the opening and closing of connections in the log, the value of the
59090 logged counts may not be entirely accurate.
59095 <indexterm role="concept">
59096 <primary>log</primary>
59097 <secondary>SMTP transaction; incomplete</secondary>
59099 <indexterm role="concept">
59100 <primary>SMTP</primary>
59101 <secondary>logging incomplete transactions</secondary>
59103 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
59104 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
59105 and the message sender plus any accepted recipients are included in the log
59106 line. This can provide evidence of dictionary attacks.
59111 <indexterm role="concept">
59112 <primary>log</primary>
59113 <secondary>non-MAIL SMTP sessions</secondary>
59115 <indexterm role="concept">
59116 <primary>MAIL</primary>
59117 <secondary>logging session without</secondary>
59119 <option>smtp_no_mail</option>: A line is written to the main log whenever an accepted SMTP
59120 connection terminates without having issued a MAIL command. This includes both
59121 the case when the connection is dropped, and the case when QUIT is used. It
59122 does not include cases where the connection is rejected right at the start (by
59123 an ACL, or because there are too many connections, or whatever). These cases
59124 already have their own log lines.
59127 The log line that is written contains the identity of the client in the usual
59128 way, followed by D= and a time, which records the duration of the connection.
59129 If the connection was authenticated, this fact is logged exactly as it is for
59130 an incoming message, with an A= item. If the connection was encrypted, CV=,
59131 DN=, and X= items may appear as they do for an incoming message, controlled by
59132 the same logging options.
59135 Finally, if any SMTP commands were issued during the connection, a C= item
59136 is added to the line, listing the commands that were used. For example,
59138 <literallayout class="monospaced">
59142 shows that the client issued QUIT straight after EHLO. If there were fewer
59143 than 20 commands, they are all listed. If there were more than 20 commands,
59144 the last 20 are listed, preceded by <quote>...</quote>. However, with the default
59145 setting of 10 for <option>smtp_accep_max_nonmail</option>, the connection will in any case
59146 have been aborted before 20 non-mail commands are processed.
59151 <indexterm role="concept">
59152 <primary>log</primary>
59153 <secondary>SMTP protocol error</secondary>
59155 <indexterm role="concept">
59156 <primary>SMTP</primary>
59157 <secondary>logging protocol error</secondary>
59159 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
59160 encountered. Exim does not have perfect detection of all protocol errors
59161 because of transmission delays and the use of pipelining. If PIPELINING has
59162 been advertised to a client, an Exim server assumes that the client will use
59163 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
59164 received after rejecting MAIL) as protocol errors.
59169 <indexterm role="concept">
59170 <primary>SMTP</primary>
59171 <secondary>logging syntax errors</secondary>
59173 <indexterm role="concept">
59174 <primary>SMTP</primary>
59175 <secondary>syntax errors; logging</secondary>
59177 <indexterm role="concept">
59178 <primary>SMTP</primary>
59179 <secondary>unknown command; logging</secondary>
59181 <indexterm role="concept">
59182 <primary>log</primary>
59183 <secondary>unknown SMTP command</secondary>
59185 <indexterm role="concept">
59186 <primary>log</primary>
59187 <secondary>SMTP syntax error</secondary>
59189 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
59190 encountered. An unrecognized command is treated as a syntax error. For an
59191 external connection, the host identity is given; for an internal connection
59192 using <option>-bs</option> the sender identification (normally the calling user) is given.
59197 <indexterm role="concept">
59198 <primary>log</primary>
59199 <secondary>subject</secondary>
59201 <indexterm role="concept">
59202 <primary>subject, logging</primary>
59204 <option>subject</option>: The subject of the message is added to the arrival log line,
59205 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
59206 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
59207 specifies whether characters with values greater than 127 should be logged
59208 unchanged, or whether they should be rendered as escape sequences.
59213 <indexterm role="concept">
59214 <primary>log</primary>
59215 <secondary>certificate verification</secondary>
59217 <option>tls_certificate_verified</option>: An extra item is added to <= and => log lines
59218 when TLS is in use. The item is <literal>CV=yes</literal> if the peer’s certificate was
59219 verified, and <literal>CV=no</literal> if not.
59224 <indexterm role="concept">
59225 <primary>log</primary>
59226 <secondary>TLS cipher</secondary>
59228 <indexterm role="concept">
59229 <primary>TLS</primary>
59230 <secondary>logging cipher</secondary>
59232 <option>tls_cipher</option>: When a message is sent or received over an encrypted
59233 connection, the cipher suite used is added to the log line, preceded by X=.
59238 <indexterm role="concept">
59239 <primary>log</primary>
59240 <secondary>TLS peer DN</secondary>
59242 <indexterm role="concept">
59243 <primary>TLS</primary>
59244 <secondary>logging peer DN</secondary>
59246 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
59247 connection, and a certificate is supplied by the remote host, the peer DN is
59248 added to the log line, preceded by DN=.
59253 <indexterm role="concept">
59254 <primary>log</primary>
59255 <secondary>DNS failure in list</secondary>
59257 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
59258 result of a list match is failure because a DNS lookup failed.
59263 <section id="SECID260">
59264 <title>Message log</title>
59266 <indexterm role="concept">
59267 <primary>message</primary>
59268 <secondary>log file for</secondary>
59270 <indexterm role="concept">
59271 <primary>log</primary>
59272 <secondary>message log; description of</secondary>
59274 <indexterm role="concept">
59275 <primary><filename>msglog</filename> directory</primary>
59277 <indexterm role="option">
59278 <primary><option>preserve_message_logs</option></primary>
59280 In addition to the general log files, Exim writes a log file for each message
59281 that it handles. The names of these per-message logs are the message ids, and
59282 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
59283 message log contains copies of the log lines that apply to the message. This
59284 makes it easier to inspect the status of an individual message without having
59285 to search the main log. A message log is deleted when processing of the message
59286 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
59287 only with great care because they can fill up your disk very quickly.
59290 On a heavily loaded system, it may be desirable to disable the use of
59291 per-message logs, in order to reduce disk I/O. This can be done by setting the
59292 <option>message_logs</option> option false.
59293 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
59298 <chapter id="CHAPutils">
59299 <title>Exim utilities</title>
59301 <indexterm role="concept" id="IIDutils" class="startofrange">
59302 <primary>utilities</primary>
59304 A number of utility scripts and programs are supplied with Exim and are
59305 described in this chapter. There is also the Exim Monitor, which is covered in
59306 the next chapter. The utilities described here are:
59308 <informaltable frame="none">
59309 <tgroup cols="3" colsep="0" rowsep="0">
59310 <colspec colwidth="7*" align="left"/>
59311 <colspec colwidth="15*" align="left"/>
59312 <colspec colwidth="40*" align="left"/>
59315 <entry> <xref linkend="SECTfinoutwha"/></entry>
59316 <entry><emphasis>exiwhat</emphasis></entry>
59317 <entry>list what Exim processes are doing</entry>
59320 <entry> <xref linkend="SECTgreptheque"/></entry>
59321 <entry><emphasis>exiqgrep</emphasis></entry>
59322 <entry>grep the queue</entry>
59325 <entry> <xref linkend="SECTsumtheque"/></entry>
59326 <entry><emphasis>exiqsumm</emphasis></entry>
59327 <entry>summarize the queue</entry>
59330 <entry> <xref linkend="SECTextspeinf"/></entry>
59331 <entry><emphasis>exigrep</emphasis></entry>
59332 <entry>search the main log</entry>
59335 <entry> <xref linkend="SECTexipick"/></entry>
59336 <entry><emphasis>exipick</emphasis></entry>
59337 <entry>select messages on various criteria</entry>
59340 <entry> <xref linkend="SECTcyclogfil"/></entry>
59341 <entry><emphasis>exicyclog</emphasis></entry>
59342 <entry>cycle (rotate) log files</entry>
59345 <entry> <xref linkend="SECTmailstat"/></entry>
59346 <entry><emphasis>eximstats</emphasis></entry>
59347 <entry>extract statistics from the log</entry>
59350 <entry> <xref linkend="SECTcheckaccess"/></entry>
59351 <entry><emphasis>exim_checkaccess</emphasis></entry>
59352 <entry>check address acceptance from given IP</entry>
59355 <entry> <xref linkend="SECTdbmbuild"/></entry>
59356 <entry><emphasis>exim_dbmbuild</emphasis></entry>
59357 <entry>build a DBM file</entry>
59360 <entry> <xref linkend="SECTfinindret"/></entry>
59361 <entry><emphasis>exinext</emphasis></entry>
59362 <entry>extract retry information</entry>
59365 <entry> <xref linkend="SECThindatmai"/></entry>
59366 <entry><emphasis>exim_dumpdb</emphasis></entry>
59367 <entry>dump a hints database</entry>
59370 <entry> <xref linkend="SECThindatmai"/></entry>
59371 <entry><emphasis>exim_tidydb</emphasis></entry>
59372 <entry>clean up a hints database</entry>
59375 <entry> <xref linkend="SECThindatmai"/></entry>
59376 <entry><emphasis>exim_fixdb</emphasis></entry>
59377 <entry>patch a hints database</entry>
59380 <entry> <xref linkend="SECTmailboxmaint"/></entry>
59381 <entry><emphasis>exim_lock</emphasis></entry>
59382 <entry>lock a mailbox file</entry>
59388 Another utility that might be of use to sites with many MTAs is Tom Kistner’s
59389 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
59390 <emphasis role="bold"><ulink url="http://duncanthrax.net/exilog/">http://duncanthrax.net/exilog/</ulink></emphasis> for details.
59392 <section id="SECTfinoutwha">
59393 <title>Finding out what Exim processes are doing (exiwhat)</title>
59395 <indexterm role="concept">
59396 <primary><emphasis>exiwhat</emphasis></primary>
59398 <indexterm role="concept">
59399 <primary>process, querying</primary>
59401 <indexterm role="concept">
59402 <primary>SIGUSR1</primary>
59404 On operating systems that can restart a system call after receiving a signal
59405 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
59406 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
59407 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
59408 processes it can find, having first emptied the file. It then waits for one
59409 second to allow the Exim processes to react before displaying the results. In
59410 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
59411 send the signal to the Exim processes, so it is normally run as root.
59414 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
59415 use by system administrators. It is not sensible, for example, to set up a
59416 script that sends SIGUSR1 signals to Exim processes at short intervals.
59419 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
59420 varies in different operating systems. Not only are different options used,
59421 but the format of the output is different. For this reason, there are some
59422 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
59423 it doesn’t seem to be working for you, check the following compile-time
59427 <literal>EXIWHAT_PS_CMD </literal> the command for running <emphasis>ps</emphasis>
59428 <literal>EXIWHAT_PS_ARG </literal> the argument for <emphasis>ps</emphasis>
59429 <literal>EXIWHAT_EGREP_ARG </literal> the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output
59430 <literal>EXIWHAT_KILL_ARG </literal> the argument for the <emphasis>kill</emphasis> command
59433 An example of typical output from <emphasis>exiwhat</emphasis> is
59435 <literallayout class="monospaced">
59436 164 daemon: -q1h, listening on port 25
59437 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
59438 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
59439 [10.19.42.42] (editor@ref.example)
59440 10592 handling incoming call from [192.168.243.242]
59441 10628 accepting a local non-SMTP message
59444 The first number in the output line is the process number. The third line has
59445 been split here, in order to fit it on the page.
59448 <section id="SECTgreptheque">
59449 <title>Selective queue listing (exiqgrep)</title>
59451 <indexterm role="concept">
59452 <primary><emphasis>exiqgrep</emphasis></primary>
59454 <indexterm role="concept">
59455 <primary>queue</primary>
59456 <secondary>grepping</secondary>
59458 This utility is a Perl script contributed by Matt Hubbard. It runs
59460 <literallayout class="monospaced">
59464 to obtain a queue listing with undelivered recipients only, and then greps the
59465 output to select messages that match given criteria. The following selection
59466 options are available:
59470 <term><emphasis role="bold">-f</emphasis> <<emphasis>regex</emphasis>></term>
59473 Match the sender address. The field that is tested is enclosed in angle
59474 brackets, so you can test for bounce messages with
59476 <literallayout class="monospaced">
59477 exiqgrep -f '^<>$'
59479 </listitem></varlistentry>
59481 <term><emphasis role="bold">-r</emphasis> <<emphasis>regex</emphasis>></term>
59484 Match a recipient address. The field that is tested is not enclosed in angle
59487 </listitem></varlistentry>
59489 <term><emphasis role="bold">-s</emphasis> <<emphasis>regex</emphasis>></term>
59492 Match against the size field.
59494 </listitem></varlistentry>
59496 <term><emphasis role="bold">-y</emphasis> <<emphasis>seconds</emphasis>></term>
59499 Match messages that are younger than the given time.
59501 </listitem></varlistentry>
59503 <term><emphasis role="bold">-o</emphasis> <<emphasis>seconds</emphasis>></term>
59506 Match messages that are older than the given time.
59508 </listitem></varlistentry>
59510 <term><emphasis role="bold">-z</emphasis></term>
59513 Match only frozen messages.
59515 </listitem></varlistentry>
59517 <term><emphasis role="bold">-x</emphasis></term>
59520 Match only non-frozen messages.
59522 </listitem></varlistentry>
59525 The following options control the format of the output:
59529 <term><emphasis role="bold">-c</emphasis></term>
59532 Display only the count of matching messages.
59534 </listitem></varlistentry>
59536 <term><emphasis role="bold">-l</emphasis></term>
59539 Long format – display the full message information as output by Exim. This is
59542 </listitem></varlistentry>
59544 <term><emphasis role="bold">-i</emphasis></term>
59547 Display message ids only.
59549 </listitem></varlistentry>
59551 <term><emphasis role="bold">-b</emphasis></term>
59554 Brief format – one line per message.
59556 </listitem></varlistentry>
59558 <term><emphasis role="bold">-R</emphasis></term>
59561 Display messages in reverse order.
59563 </listitem></varlistentry>
59566 There is one more option, <option>-h</option>, which outputs a list of options.
59569 <section id="SECTsumtheque">
59570 <title>Summarizing the queue (exiqsumm)</title>
59572 <indexterm role="concept">
59573 <primary><emphasis>exiqsumm</emphasis></primary>
59575 <indexterm role="concept">
59576 <primary>queue</primary>
59577 <secondary>summary</secondary>
59579 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
59580 -bp</literal> and produces a summary of the messages on the queue. Thus, you use it by
59581 running a command such as
59583 <literallayout class="monospaced">
59584 exim -bp | exiqsumm
59587 The output consists of one line for each domain that has messages waiting for
59588 it, as in the following example:
59590 <literallayout class="monospaced">
59591 3 2322 74m 66m msn.com.example
59594 Each line lists the number of pending deliveries for a domain, their total
59595 volume, and the length of time that the oldest and the newest messages have
59596 been waiting. Note that the number of pending deliveries is greater than the
59597 number of messages when messages have more than one recipient.
59600 A summary line is output at the end. By default the output is sorted on the
59601 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
59602 the output to be sorted by oldest message and by count of messages,
59603 respectively. There are also three options that split the messages for each
59604 domain into two or more subcounts: <option>-b</option> separates bounce messages, <option>-f</option>
59605 separates frozen messages, and <option>-s</option> separates messages according to their
59609 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
59610 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
59611 generated by aliasing or forwarding are included (unless the <option>one_time</option>
59612 option of the <command>redirect</command> router has been used to convert them into <quote>top
59613 level</quote> addresses).
59616 <section id="SECTextspeinf">
59617 <title>Extracting specific information from the log (exigrep)</title>
59619 <indexterm role="concept">
59620 <primary><emphasis>exigrep</emphasis></primary>
59622 <indexterm role="concept">
59623 <primary>log</primary>
59624 <secondary>extracts; grepping for</secondary>
59626 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
59627 files for entries that match a given pattern. When it finds a match, it
59628 extracts all the log entries for the relevant message, not just those that
59629 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
59630 given message, or all mail for a given user, or for a given host, for example.
59631 The input files can be in Exim log format or syslog format.
59632 If a matching log line is not associated with a specific message, it is
59633 included in <emphasis>exigrep</emphasis>’s output without any additional lines. The usage is:
59636 <literal>exigrep [-t<</literal><emphasis>n</emphasis><literal>>] [-I] [-l] [-v] <</literal><emphasis>pattern</emphasis><literal>> [<</literal><emphasis>log file</emphasis><literal>>] ...</literal>
59639 If no log file names are given on the command line, the standard input is read.
59642 The <option>-t</option> argument specifies a number of seconds. It adds an additional
59643 condition for message selection. Messages that are complete are shown only if
59644 they spent more than <<emphasis>n</emphasis>> seconds on the queue.
59647 By default, <emphasis>exigrep</emphasis> does case-insensitive matching. The <option>-I</option> option
59648 makes it case-sensitive. This may give a performance improvement when searching
59649 large log files. Without <option>-I</option>, the Perl pattern matches use Perl’s <literal>/i</literal>
59650 option; with <option>-I</option> they do not. In both cases it is possible to change the
59651 case sensitivity within the pattern by using <literal>(?i)</literal> or <literal>(?-i)</literal>.
59654 The <option>-l</option> option means <quote>literal</quote>, that is, treat all characters in the
59655 pattern as standing for themselves. Otherwise the pattern must be a Perl
59656 regular expression.
59659 The <option>-v</option> option inverts the matching condition. That is, a line is selected
59660 if it does <emphasis>not</emphasis> match the pattern.
59663 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
59664 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
59665 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
59668 <section id="SECTexipick">
59669 <title>Selecting messages by various criteria (exipick)</title>
59671 <indexterm role="concept">
59672 <primary><emphasis>exipick</emphasis></primary>
59674 John Jetmore’s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
59675 lists messages from the queue according to a variety of criteria. For details
59676 of <emphasis>exipick</emphasis>’s facilities, visit the web page at
59677 <emphasis role="bold"><ulink url="http://www.exim.org/eximwiki/ToolExipickManPage">http://www.exim.org/eximwiki/ToolExipickManPage</ulink></emphasis> or run <emphasis>exipick</emphasis> with
59678 the <option>--help</option> option.
59681 <section id="SECTcyclogfil">
59682 <title>Cycling log files (exicyclog)</title>
59684 <indexterm role="concept">
59685 <primary>log</primary>
59686 <secondary>cycling local files</secondary>
59688 <indexterm role="concept">
59689 <primary>cycling logs</primary>
59691 <indexterm role="concept">
59692 <primary><emphasis>exicyclog</emphasis></primary>
59694 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
59695 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
59696 you are using log files with datestamps in their names (see section
59697 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
59698 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
59699 There are two command line options for <emphasis>exicyclog</emphasis>:
59704 <option>-k</option> <<emphasis>count</emphasis>> specifies the number of log files to keep, overriding the
59705 default that is set when Exim is built. The default default is 10.
59710 <option>-l</option> <<emphasis>path</emphasis>> specifies the log file path, in the same format as Exim’s
59711 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
59712 overriding the script’s default, which is to find the setting from Exim’s
59718 Each time <emphasis>exicyclog</emphasis> is run the file names get <quote>shuffled down</quote> by one. If
59719 the main log file name is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
59720 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
59721 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
59722 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
59723 logs are handled similarly.
59726 If the limit is greater than 99, the script uses 3-digit numbers such as
59727 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
59728 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
59729 any existing log files.
59732 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
59733 the end are deleted. All files with numbers greater than 01 are compressed,
59734 using a compression command which is configured by the COMPRESS_COMMAND
59735 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
59736 root <option>crontab</option> entry of the form
59738 <literallayout class="monospaced">
59739 1 0 * * * su exim -c /usr/exim/bin/exicyclog
59742 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
59743 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
59746 <section id="SECTmailstat">
59747 <title>Mail statistics (eximstats)</title>
59749 <indexterm role="concept">
59750 <primary>statistics</primary>
59752 <indexterm role="concept">
59753 <primary><emphasis>eximstats</emphasis></primary>
59755 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
59756 information from log files. The output is either plain text, or HTML.
59757 Exim log files are also supported by the <emphasis>Lire</emphasis> system produced by the
59758 LogReport Foundation <emphasis role="bold"><ulink url="http://www.logreport.org">http://www.logreport.org</ulink></emphasis>.
59761 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
59762 latest version is the result of some extensive revision by Steve Campbell. A
59763 lot of information is given by default, but there are options for suppressing
59764 various parts of it. Following any options, the arguments to the script are a
59765 list of files, which should be main log files. For example:
59767 <literallayout class="monospaced">
59768 eximstats -nr /var/spool/exim/log/mainlog.01
59771 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
59772 messages received from or delivered to various hosts. The information is sorted
59773 both by message count and by volume, and the top fifty hosts in each category
59774 are listed on the standard output. Similar information, based on email
59775 addresses or domains instead of hosts can be requested by means of various
59776 options. For messages delivered and received locally, similar statistics are
59777 also produced per user.
59780 The output also includes total counts and statistics about delivery errors, and
59781 histograms showing the number of messages received and deliveries made in each
59782 hour of the day. A delivery with more than one address in its envelope (for
59783 example, an SMTP transaction with more than one RCPT command) is counted
59784 as a single delivery by <emphasis>eximstats</emphasis>.
59787 Though normally more deliveries than receipts are reported (as messages may
59788 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
59789 messages received than delivered, even though the queue is empty at the start
59790 and end of the period in question. If an incoming message contains no valid
59791 recipients, no deliveries are recorded for it. A bounce message is handled as
59792 an entirely separate message.
59795 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
59796 of messages received and deliveries made, and the number of hosts involved in
59797 each case. It also outputs the number of messages that were delayed (that is,
59798 not completely delivered at the first attempt), and the number that had at
59799 least one address that failed.
59802 The remainder of the output is in sections that can be independently disabled
59803 or modified by various options. It consists of a summary of deliveries by
59804 transport, histograms of messages received and delivered per time interval
59805 (default per hour), information about the time messages spent on the queue,
59806 a list of relayed messages, lists of the top fifty sending hosts, local
59807 senders, destination hosts, and destination local users by count and by volume,
59808 and a list of delivery errors that occurred.
59811 The relay information lists messages that were actually relayed, that is, they
59812 came from a remote host and were directly delivered to some other remote host,
59813 without being processed (for example, for aliasing or forwarding) locally.
59816 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
59817 outputs. These are documented in the Perl script itself, and can be extracted
59818 by running the command <command>perldoc</command> on the script. For example:
59820 <literallayout class="monospaced">
59821 perldoc /usr/exim/bin/eximstats
59824 <section id="SECTcheckaccess">
59825 <title>Checking access policy (exim_checkaccess)</title>
59827 <indexterm role="concept">
59828 <primary><emphasis>exim_checkaccess</emphasis></primary>
59830 <indexterm role="concept">
59831 <primary>policy control</primary>
59832 <secondary>checking access</secondary>
59834 <indexterm role="concept">
59835 <primary>checking access</primary>
59837 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
59838 debugging output, in order to check what Exim is doing when it is applying
59839 policy controls to incoming SMTP mail. However, not everybody is sufficiently
59840 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
59841 sometimes you just want to answer the question <quote>Does this address have
59842 access?</quote> without bothering with any further details.
59845 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
59846 two arguments, an IP address and an email address:
59848 <literallayout class="monospaced">
59849 exim_checkaccess 10.9.8.7 A.User@a.domain.example
59852 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
59853 given email address would be accepted in a RCPT command in a TCP/IP
59854 connection from the host with the given IP address. The output of the utility
59855 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
59857 <literallayout class="monospaced">
59859 550 Relay not permitted
59862 When running this test, the utility uses <literal><></literal> as the envelope sender address
59863 for the MAIL command, but you can change this by providing additional
59864 options. These are passed directly to the Exim command. For example, to specify
59865 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
59868 <literallayout class="monospaced">
59869 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
59870 -f himself@there.example
59873 Note that these additional Exim command line items must be given after the two
59874 mandatory arguments.
59877 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
59878 while running its checks. You can run checks that include callouts by using
59879 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
59882 <section id="SECTdbmbuild">
59883 <title>Making DBM files (exim_dbmbuild)</title>
59885 <indexterm role="concept">
59886 <primary>DBM</primary>
59887 <secondary>building dbm files</secondary>
59889 <indexterm role="concept">
59890 <primary>building DBM files</primary>
59892 <indexterm role="concept">
59893 <primary><emphasis>exim_dbmbuild</emphasis></primary>
59895 <indexterm role="concept">
59896 <primary>lower casing</primary>
59898 <indexterm role="concept">
59899 <primary>binary zero</primary>
59900 <secondary>in lookup key</secondary>
59902 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
59903 the format used by the <command>lsearch</command> lookup (see section
59904 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
59905 names as keys and the remainder of the information as data. The lower-casing
59906 can be prevented by calling the program with the <option>-nolc</option> option.
59909 A terminating zero is included as part of the key string. This is expected by
59910 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
59911 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
59912 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
59916 The program requires two arguments: the name of the input file (which can be a
59917 single hyphen to indicate the standard input), and the name of the output file.
59918 It creates the output under a temporary name, and then renames it if all went
59922 <indexterm role="concept">
59923 <primary>USE_DB</primary>
59925 If the native DB interface is in use (USE_DB is set in a compile-time
59926 configuration file – this is common in free versions of Unix) the two file
59927 names must be different, because in this mode the Berkeley DB functions create
59928 a single output file using exactly the name given. For example,
59930 <literallayout class="monospaced">
59931 exim_dbmbuild /etc/aliases /etc/aliases.db
59934 reads the system alias file and creates a DBM version of it in
59935 <filename>/etc/aliases.db</filename>.
59938 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
59939 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
59940 environment, the suffixes are added to the second argument of
59941 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
59942 when the Berkeley functions are used in compatibility mode (though this is not
59943 recommended), because in that case it adds a <filename>.db</filename> suffix to the file name.
59946 If a duplicate key is encountered, the program outputs a warning, and when it
59947 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
59948 option is used. By default, only the first of a set of duplicates is used –
59949 this makes it compatible with <command>lsearch</command> lookups. There is an option
59950 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
59951 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
59952 <option>stderr</option>. For other errors, where it doesn’t actually make a new file, the
59956 <section id="SECTfinindret">
59957 <title>Finding individual retry times (exinext)</title>
59959 <indexterm role="concept">
59960 <primary>retry</primary>
59961 <secondary>times</secondary>
59963 <indexterm role="concept">
59964 <primary><emphasis>exinext</emphasis></primary>
59966 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
59967 fish specific information out of the retry database. Given a mail domain (or a
59968 complete address), it looks up the hosts for that domain, and outputs any retry
59969 information for the hosts or for the domain. At present, the retry information
59970 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
59971 output. For example:
59973 <literallayout class="monospaced">
59974 $ exinext piglet@milne.fict.example
59975 kanga.milne.example:192.168.8.1 error 146: Connection refused
59976 first failed: 21-Feb-1996 14:57:34
59977 last tried: 21-Feb-1996 14:57:34
59978 next try at: 21-Feb-1996 15:02:34
59979 roo.milne.example:192.168.8.3 error 146: Connection refused
59980 first failed: 20-Jan-1996 13:12:08
59981 last tried: 21-Feb-1996 11:42:03
59982 next try at: 21-Feb-1996 19:42:03
59983 past final cutoff time
59986 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
59987 will give any retry information for that local part in your default domain.
59988 A message id can be used to obtain retry information pertaining to a specific
59989 message. This exists only when an attempt to deliver a message to a remote host
59990 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
59991 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
59995 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
59996 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
59997 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
59998 configuration file, and the second sets macros for use within the configuration
59999 file. These features are mainly to help in testing, but might also be useful in
60000 environments where more than one configuration file is in use.
60003 <section id="SECThindatmai">
60004 <title>Hints database maintenance</title>
60006 <indexterm role="concept">
60007 <primary>hints database</primary>
60008 <secondary>maintenance</secondary>
60010 <indexterm role="concept">
60011 <primary>maintaining Exim’s hints database</primary>
60013 Three utility programs are provided for maintaining the DBM files that Exim
60014 uses to contain its delivery hint information. Each program requires two
60015 arguments. The first specifies the name of Exim’s spool directory, and the
60016 second is the name of the database it is to operate on. These are as follows:
60021 <emphasis>retry</emphasis>: the database of retry information
60026 <emphasis>wait-</emphasis><<emphasis>transport name</emphasis>>: databases of information about messages waiting
60032 <emphasis>callout</emphasis>: the callout cache
60037 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
60042 <emphasis>misc</emphasis>: other hints data
60047 The <emphasis>misc</emphasis> database is used for
60052 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
60057 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
60058 <command>smtp</command> transport)
60063 <section id="SECID261">
60064 <title>exim_dumpdb</title>
60066 <indexterm role="concept">
60067 <primary><emphasis>exim_dumpdb</emphasis></primary>
60069 The entire contents of a database are written to the standard output by the
60070 <emphasis>exim_dumpdb</emphasis> program, which has no options or arguments other than the
60071 spool and database names. For example, to dump the retry database:
60073 <literallayout class="monospaced">
60074 exim_dumpdb /var/spool/exim retry
60077 Two lines of output are produced for each entry:
60079 <literallayout class="monospaced">
60080 T:mail.ref.example:192.168.242.242 146 77 Connection refused
60081 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
60084 The first item on the first line is the key of the record. It starts with one
60085 of the letters R, or T, depending on whether it refers to a routing or
60086 transport retry. For a local delivery, the next part is the local address; for
60087 a remote delivery it is the name of the remote host, followed by its failing IP
60088 address (unless <option>retry_include_ip_address</option> is set false on the <command>smtp</command>
60089 transport). If the remote port is not the standard one (port 25), it is added
60090 to the IP address. Then there follows an error code, an additional error code,
60091 and a textual description of the error.
60094 The three times on the second line are the time of first failure, the time of
60095 the last delivery attempt, and the computed time for the next attempt. The line
60096 ends with an asterisk if the cutoff time for the last retry rule has been
60100 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
60101 consists of a host name followed by a list of ids for messages that are or were
60102 waiting to be delivered to that host. If there are a very large number for any
60103 one host, continuation records, with a sequence number added to the host name,
60104 may be seen. The data in these records is often out of date, because a message
60105 may be routed to several alternative hosts, and Exim makes no effort to keep
60109 <section id="SECID262">
60110 <title>exim_tidydb</title>
60112 <indexterm role="concept">
60113 <primary><emphasis>exim_tidydb</emphasis></primary>
60115 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
60116 database. If run with no options, it removes all records that are more than 30
60117 days old. The age is calculated from the date and time that the record was last
60118 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
60119 since the first delivery failure. Information about a host that has been down
60120 for more than 30 days will remain in the database, provided that the record is
60121 updated sufficiently often.
60124 The cutoff date can be altered by means of the <option>-t</option> option, which must be
60125 followed by a time. For example, to remove all records older than a week from
60126 the retry database:
60128 <literallayout class="monospaced">
60129 exim_tidydb -t 7d /var/spool/exim retry
60132 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
60133 message ids. In the former these appear as data in records keyed by host –
60134 they were messages that were waiting for that host – and in the latter they
60135 are the keys for retry information for messages that have suffered certain
60136 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
60137 message ids in database records are those of messages that are still on the
60138 queue. Message ids for messages that no longer exist are removed from
60139 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
60140 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
60141 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
60142 whenever it removes information from the database.
60145 Certain records are automatically removed by Exim when they are no longer
60146 needed, but others are not. For example, if all the MX hosts for a domain are
60147 down, a retry record is created for each one. If the primary MX host comes back
60148 first, its record is removed when Exim successfully delivers to it, but the
60149 records for the others remain because Exim has not tried to use those hosts.
60152 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
60153 hints databases. You should do this at a quiet time of day, because it requires
60154 a database to be locked (and therefore inaccessible to Exim) while it does its
60155 work. Removing records from a DBM file does not normally make the file smaller,
60156 but all the common DBM libraries are able to re-use the space that is released.
60157 After an initial phase of increasing in size, the databases normally reach a
60158 point at which they no longer get any bigger, as long as they are regularly
60162 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
60163 databases is likely to keep on increasing.
60166 <section id="SECID263">
60167 <title>exim_fixdb</title>
60169 <indexterm role="concept">
60170 <primary><emphasis>exim_fixdb</emphasis></primary>
60172 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
60173 Its main use is for testing Exim, but it might also be occasionally useful for
60174 getting round problems in a live system. It has no options, and its interface
60175 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
60176 key of a database record can then be entered, and the data for that record is
60180 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
60181 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
60182 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
60183 data for individual fields can be changed by typing the field number followed
60184 by new data, for example:
60186 <literallayout class="monospaced">
60190 resets the time of the next delivery attempt. Time values are given as a
60191 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
60192 used as optional separators.
60195 <section id="SECTmailboxmaint">
60196 <title>Mailbox maintenance (exim_lock)</title>
60198 <indexterm role="concept">
60199 <primary>mailbox</primary>
60200 <secondary>maintenance</secondary>
60202 <indexterm role="concept">
60203 <primary><emphasis>exim_lock</emphasis></primary>
60205 <indexterm role="concept">
60206 <primary>locking mailboxes</primary>
60208 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
60209 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
60210 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
60211 a user agent while investigating a problem. The utility requires the name of
60212 the file as its first argument. If the locking is successful, the second
60213 argument is run as a command (using C’s <function>system()</function> function); if there is no
60214 second argument, the value of the SHELL environment variable is used; if this
60215 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
60216 is unlocked and the utility ends. The following options are available:
60220 <term><option>-fcntl</option></term>
60223 Use <function>fcntl()</function> locking on the open mailbox.
60225 </listitem></varlistentry>
60227 <term><option>-flock</option></term>
60230 Use <function>flock()</function> locking on the open mailbox, provided the operating system
60233 </listitem></varlistentry>
60235 <term><option>-interval</option></term>
60238 This must be followed by a number, which is a number of seconds; it sets the
60239 interval to sleep between retries (default 3).
60241 </listitem></varlistentry>
60243 <term><option>-lockfile</option></term>
60246 Create a lock file before opening the mailbox.
60248 </listitem></varlistentry>
60250 <term><option>-mbx</option></term>
60253 Lock the mailbox using MBX rules.
60255 </listitem></varlistentry>
60257 <term><option>-q</option></term>
60260 Suppress verification output.
60262 </listitem></varlistentry>
60264 <term><option>-retries</option></term>
60267 This must be followed by a number; it sets the number of times to try to get
60268 the lock (default 10).
60270 </listitem></varlistentry>
60272 <term><option>-restore_time</option></term>
60275 This option causes <option>exim_lock</option> to restore the modified and read times to the
60276 locked file before exiting. This allows you to access a locked mailbox (for
60277 example, to take a backup copy) without disturbing the times that the user
60280 </listitem></varlistentry>
60282 <term><option>-timeout</option></term>
60285 This must be followed by a number, which is a number of seconds; it sets a
60286 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
60287 default), a non-blocking call is used.
60289 </listitem></varlistentry>
60291 <term><option>-v</option></term>
60294 Generate verbose output.
60296 </listitem></varlistentry>
60299 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
60300 default is to create a lock file and also to use <function>fcntl()</function> locking on the
60301 mailbox, which is the same as Exim’s default. The use of <option>-flock</option> or
60302 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
60303 requires that the directory containing the file be writeable. Locking by lock
60304 file does not last for ever; Exim assumes that a lock file is expired if it is
60305 more than 30 minutes old.
60308 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
60309 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
60310 to be taken out on the open mailbox, and an exclusive lock on the file
60311 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
60312 number of the mailbox file. When the locking is released, if an exclusive lock
60313 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
60316 The default output contains verification of the locking that takes place. The
60317 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
60318 suppresses all output except error messages.
60323 <literallayout class="monospaced">
60324 exim_lock /var/spool/mail/spqr
60327 runs an interactive shell while the file is locked, whereas
60330 <literal>exim_lock -q /var/spool/mail/spqr <<End</literal>
60331 <<emphasis>some commands</emphasis>>
60332 <literal>End</literal>
60335 runs a specific non-interactive sequence of commands while the file is locked,
60336 suppressing all verification output. A single command can be run by a command
60339 <literallayout class="monospaced">
60340 exim_lock -q /var/spool/mail/spqr \
60341 "cp /var/spool/mail/spqr /some/where"
60344 Note that if a command is supplied, it must be entirely contained within the
60345 second argument – hence the quotes.
60346 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
60351 <chapter id="CHAPeximon">
60352 <title>The Exim monitor</title>
60354 <indexterm role="concept" id="IIDeximon" class="startofrange">
60355 <primary>Exim monitor</primary>
60356 <secondary>description</secondary>
60358 <indexterm role="concept">
60359 <primary>X-windows</primary>
60361 <indexterm role="concept">
60362 <primary><emphasis>eximon</emphasis></primary>
60364 <indexterm role="concept">
60365 <primary>Local/eximon.conf</primary>
60367 <indexterm role="concept">
60368 <primary><filename>exim_monitor/EDITME</filename></primary>
60370 The Exim monitor is an application which displays in an X window information
60371 about the state of Exim’s queue and what Exim is doing. An admin user can
60372 perform certain operations on messages from this GUI interface; however all
60373 such facilities are also available from the command line, and indeed, the
60374 monitor itself makes use of the command line to perform any actions requested.
60376 <section id="SECID264">
60377 <title>Running the monitor</title>
60379 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
60380 script that sets up a number of environment variables, and then runs the
60381 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
60382 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
60383 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
60384 parameters are for.
60387 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
60388 a particular invocation by setting up environment variables of the same names,
60389 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
60391 <literallayout class="monospaced">
60392 EXIMON_LOG_DEPTH=400 eximon
60395 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
60396 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
60397 overrides the Exim log file configuration. This makes it possible to have
60398 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
60399 syslog messages are routed to a file on the local host.
60402 X resources can be used to change the appearance of the window in the normal
60403 way. For example, a resource setting of the form
60405 <literallayout class="monospaced">
60406 Eximon*background: gray94
60409 changes the colour of the background to light grey rather than white. The
60410 stripcharts are drawn with both the data lines and the reference lines in
60411 black. This means that the reference lines are not visible when on top of the
60412 data. However, their colour can be changed by setting a resource called
60413 <quote>highlight</quote> (an odd name, but that’s what the Athena stripchart widget uses).
60414 For example, if your X server is running Unix, you could set up lighter
60415 reference lines in the stripcharts by obeying
60417 <literallayout class="monospaced">
60418 xrdb -merge <<End
60419 Eximon*highlight: gray
60423 <indexterm role="concept">
60424 <primary>admin user</primary>
60426 In order to see the contents of messages on the queue, and to operate on them,
60427 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
60430 The monitor’s window is divided into three parts. The first contains one or
60431 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
60432 main log file, and the third is a display of the queue of messages awaiting
60433 delivery, with two more action buttons. The following sections describe these
60434 different parts of the display.
60437 <section id="SECID265">
60438 <title>The stripcharts</title>
60440 <indexterm role="concept">
60441 <primary>stripchart</primary>
60443 The first stripchart is always a count of messages on the queue. Its name can
60444 be configured by setting QUEUE_STRIPCHART_NAME in the
60445 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
60446 configuration script by regular expression matches on log file entries, making
60447 it possible to display, for example, counts of messages delivered to certain
60448 hosts or using certain transports. The supplied defaults display counts of
60449 received and delivered messages, and of local and SMTP deliveries. The default
60450 period between stripchart updates is one minute; this can be adjusted by a
60451 parameter in the <filename>Local/eximon.conf</filename> file.
60454 The stripchart displays rescale themselves automatically as the value they are
60455 displaying changes. There are always 10 horizontal lines in each chart; the
60456 title string indicates the value of each division when it is greater than one.
60457 For example, <quote>x2</quote> means that each division represents a value of 2.
60460 It is also possible to have a stripchart which shows the percentage fullness of
60461 a particular disk partition, which is useful when local deliveries are confined
60462 to a single partition.
60465 <indexterm role="concept">
60466 <primary><option>statvfs</option> function</primary>
60468 This relies on the availability of the <function>statvfs()</function> function or equivalent in
60469 the operating system. Most, but not all versions of Unix that support Exim have
60470 this. For this particular stripchart, the top of the chart always represents
60471 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
60472 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
60473 <filename>Local/eximon.conf</filename> file.
60476 <section id="SECID266">
60477 <title>Main action buttons</title>
60479 <indexterm role="concept">
60480 <primary>size</primary>
60481 <secondary>of monitor window</secondary>
60483 <indexterm role="concept">
60484 <primary>Exim monitor</primary>
60485 <secondary>window size</secondary>
60487 <indexterm role="concept">
60488 <primary>window size</primary>
60490 Below the stripcharts there is an action button for quitting the monitor. Next
60491 to this is another button marked <quote>Size</quote>. They are placed here so that
60492 shrinking the window to its default minimum size leaves just the queue count
60493 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
60494 the window to expand to its maximum size, unless it is already at the maximum,
60495 in which case it is reduced to its minimum.
60498 When expanding to the maximum, if the window cannot be fully seen where it
60499 currently is, it is moved back to where it was the last time it was at full
60500 size. When it is expanding from its minimum size, the old position is
60501 remembered, and next time it is reduced to the minimum it is moved back there.
60504 The idea is that you can keep a reduced window just showing one or two
60505 stripcharts at a convenient place on your screen, easily expand it to show
60506 the full window when required, and just as easily put it back to what it was.
60507 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
60508 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
60509 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
60512 Normally, the monitor starts up with the window at its full size, but it can be
60513 built so that it starts up with the window at its smallest size, by setting
60514 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
60517 <section id="SECID267">
60518 <title>The log display</title>
60520 <indexterm role="concept">
60521 <primary>log</primary>
60522 <secondary>tail of; in monitor</secondary>
60524 The second section of the window is an area in which a display of the tail of
60525 the main log is maintained.
60526 To save space on the screen, the timestamp on each log line is shortened by
60527 removing the date and, if <option>log_timezone</option> is set, the timezone.
60528 The log tail is not available when the only destination for logging data is
60529 syslog, unless the syslog lines are routed to a local file whose name is passed
60530 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
60533 The log sub-window has a scroll bar at its lefthand side which can be used to
60534 move back to look at earlier text, and the up and down arrow keys also have a
60535 scrolling effect. The amount of log that is kept depends on the setting of
60536 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
60537 to use. When this is full, the earlier 50% of data is discarded – this is
60538 much more efficient than throwing it away line by line. The sub-window also has
60539 a horizontal scroll bar for accessing the ends of long log lines. This is the
60540 only means of horizontal scrolling; the right and left arrow keys are not
60541 available. Text can be cut from this part of the window using the mouse in the
60542 normal way. The size of this subwindow is controlled by parameters in the
60543 configuration file <filename>Local/eximon.conf</filename>.
60546 Searches of the text in the log window can be carried out by means of the ^R
60547 and ^S keystrokes, which default to a reverse and a forward search,
60548 respectively. The search covers only the text that is displayed in the window.
60549 It cannot go further back up the log.
60552 The point from which the search starts is indicated by a caret marker. This is
60553 normally at the end of the text in the window, but can be positioned explicitly
60554 by pointing and clicking with the left mouse button, and is moved automatically
60555 by a successful search. If new text arrives in the window when it is scrolled
60556 back, the caret remains where it is, but if the window is not scrolled back,
60557 the caret is moved to the end of the new text.
60560 Pressing ^R or ^S pops up a window into which the search text can be typed.
60561 There are buttons for selecting forward or reverse searching, for carrying out
60562 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
60563 happens and the window remains so that further searches can be done. If the
60564 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
60565 ^C is typed the search is cancelled.
60568 The searching facility is implemented using the facilities of the Athena text
60569 widget. By default this pops up a window containing both <quote>search</quote> and
60570 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
60571 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
60572 However, the linkers in BSDI and HP-UX seem unable to handle an externally
60573 provided version of <option>TextPop</option> when the remaining parts of the text widget
60574 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
60575 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
60576 on these systems, at the expense of having unwanted items in the search popup
60580 <section id="SECID268">
60581 <title>The queue display</title>
60583 <indexterm role="concept">
60584 <primary>queue</primary>
60585 <secondary>display in monitor</secondary>
60587 The bottom section of the monitor window contains a list of all messages that
60588 are on the queue, which includes those currently being received or delivered,
60589 as well as those awaiting delivery. The size of this subwindow is controlled by
60590 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
60591 at which it is updated is controlled by another parameter in the same file –
60592 the default is 5 minutes, since queue scans can be quite expensive. However,
60593 there is an <quote>Update</quote> action button just above the display which can be used
60594 to force an update of the queue display at any time.
60597 When a host is down for some time, a lot of pending mail can build up for it,
60598 and this can make it hard to deal with other messages on the queue. To help
60599 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
60600 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
60601 type anything in here and press <quote>Return</quote>, the text is added to a chain of
60602 such texts, and if every undelivered address in a message matches at least one
60603 of the texts, the message is not displayed.
60606 If there is an address that does not match any of the texts, all the addresses
60607 are displayed as normal. The matching happens on the ends of addresses so, for
60608 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
60609 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
60610 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
60611 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
60612 a hide request is automatically cancelled after one hour.
60615 While the dialogue box is displayed, you can’t press any buttons or do anything
60616 else to the monitor window. For this reason, if you want to cut text from the
60617 queue display to use in the dialogue box, you have to do the cutting before
60618 pressing the <quote>Hide</quote> button.
60621 The queue display contains, for each unhidden queued message, the length of
60622 time it has been on the queue, the size of the message, the message id, the
60623 message sender, and the first undelivered recipient, all on one line. If it is
60624 a bounce message, the sender is shown as <quote><></quote>. If there is more than one
60625 recipient to which the message has not yet been delivered, subsequent ones are
60626 listed on additional lines, up to a maximum configured number, following which
60627 an ellipsis is displayed. Recipients that have already received the message are
60631 <indexterm role="concept">
60632 <primary>frozen messages</primary>
60633 <secondary>display</secondary>
60635 If a message is frozen, an asterisk is displayed at the left-hand side.
60638 The queue display has a vertical scroll bar, and can also be scrolled by means
60639 of the arrow keys. Text can be cut from it using the mouse in the normal way.
60640 The text searching facilities, as described above for the log window, are also
60641 available, but the caret is always moved to the end of the text when the queue
60642 display is updated.
60645 <section id="SECID269">
60646 <title>The queue menu</title>
60648 <indexterm role="concept">
60649 <primary>queue</primary>
60650 <secondary>menu in monitor</secondary>
60652 If the <option>shift</option> key is held down and the left button is clicked when the mouse
60653 pointer is over the text for any message, an action menu pops up, and the first
60654 line of the queue display for the message is highlighted. This does not affect
60658 If you want to use some other event for popping up the menu, you can set the
60659 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
60660 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
60661 value set in this parameter is a standard X event description. For example, to
60662 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
60664 <literallayout class="monospaced">
60665 EXIMON_MENU_EVENT='Ctrl<Btn1Down>' eximon
60668 The title of the menu is the message id, and it contains entries which act as
60674 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
60675 in a new text window.
60680 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
60681 information and headers is displayed in a new text window. See chapter
60682 <xref linkend="CHAPspool"/> for a description of the format of spool files.
60687 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
60688 displayed in a new text window. There is a default limit of 20,000 bytes to the
60689 amount of data displayed. This can be changed by setting the BODY_MAX
60690 option at compile time, or the EXIMON_BODY_MAX option at run time.
60695 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
60696 delivery of the message. This causes an automatic thaw if the message is
60697 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
60698 a new text window. The delivery is run in a separate process, to avoid holding
60699 up the monitor while the delivery proceeds.
60704 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
60705 that the message be frozen.
60710 <indexterm role="concept">
60711 <primary>thawing messages</primary>
60713 <indexterm role="concept">
60714 <primary>unfreezing messages</primary>
60716 <indexterm role="concept">
60717 <primary>frozen messages</primary>
60718 <secondary>thawing</secondary>
60720 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
60721 that the message be thawed.
60726 <indexterm role="concept">
60727 <primary>delivery</primary>
60728 <secondary>forcing failure</secondary>
60730 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
60731 that Exim gives up trying to deliver the message. A bounce message is generated
60732 for any remaining undelivered addresses.
60737 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
60738 that the message be deleted from the system without generating a bounce
60744 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
60745 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
60746 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
60747 Otherwise it must be entered as a fully qualified address. Pressing RETURN
60748 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
60749 additional recipient be added to the message, unless the entry box is empty, in
60750 which case no action is taken.
60755 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
60756 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
60757 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
60758 Otherwise it must be entered as a fully qualified address. Pressing RETURN
60759 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
60760 recipient address as already delivered, unless the entry box is empty, in which
60761 case no action is taken.
60766 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
60767 mark all recipient addresses as already delivered.
60772 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
60773 sender’s address. Pressing RETURN causes a call to Exim to be made using the
60774 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
60775 in which case no action is taken. If you want to set an empty sender (as in
60776 bounce messages), you must specify it as <quote><></quote>. Otherwise, if the address is
60777 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
60778 the address is qualified with that domain.
60783 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
60784 other cases when a call to Exim is made, if there is any output from Exim (in
60785 particular, if the command fails) a window containing the command and the
60786 output is displayed. Otherwise, the results of the action are normally apparent
60787 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
60788 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
60789 if no output is generated.
60792 The queue display is automatically updated for actions such as freezing and
60793 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
60794 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
60795 force an update of the display after one of these actions.
60798 In any text window that is displayed as result of a menu action, the normal
60799 cut-and-paste facility is available, and searching can be carried out using ^R
60800 and ^S, as described above for the log tail window.
60801 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
60806 <chapter id="CHAPsecurity">
60807 <title>Security considerations</title>
60809 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
60810 <primary>security</primary>
60811 <secondary>discussion of</secondary>
60813 This chapter discusses a number of issues concerned with security, some of
60814 which are also covered in other parts of this manual.
60817 For reasons that this author does not understand, some people have promoted
60818 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
60819 existence of this chapter in the documentation. However, the intent of the
60820 chapter is simply to describe the way Exim works in relation to certain
60821 security concerns, not to make any specific claims about the effectiveness of
60822 its security as compared with other MTAs.
60825 What follows is a description of the way Exim is supposed to be. Best efforts
60826 have been made to try to ensure that the code agrees with the theory, but an
60827 absence of bugs can never be guaranteed. Any that are reported will get fixed
60828 as soon as possible.
60830 <section id="SECID286">
60831 <title>Building a more <quote>hardened</quote> Exim</title>
60833 <indexterm role="concept">
60834 <primary>security</primary>
60835 <secondary>build-time features</secondary>
60837 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
60838 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
60839 Exim administrator who does not have the root password, or by someone who has
60840 penetrated the Exim (but not the root) account. These options are as follows:
60845 ALT_CONFIG_PREFIX can be set to a string that is required to match the
60846 start of any file names used with the <option>-C</option> option. When it is set, these file
60847 names are also not allowed to contain the sequence <quote>/../</quote>. (However, if the
60848 value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
60849 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
60850 default setting for <option>ALT_CONFIG_PREFIX</option>.
60853 If the permitted configuration files are confined to a directory to
60854 which only root has access, this guards against someone who has broken
60855 into the Exim account from running a privileged Exim with an arbitrary
60856 configuration file, and using it to break into other accounts.
60861 If ALT_CONFIG_ROOT_ONLY is defined, root privilege is retained for <option>-C</option>
60862 and <option>-D</option> only if the caller of Exim is root. Without it, the Exim user may
60863 also use <option>-C</option> and <option>-D</option> and retain privilege. Setting this option locks out
60864 the possibility of testing a configuration using <option>-C</option> right through message
60865 reception and delivery, even if the caller is root. The reception works, but by
60866 that time, Exim is running as the Exim user, so when it re-execs to regain
60867 privilege for the delivery, the use of <option>-C</option> causes privilege to be lost.
60868 However, root can test reception and delivery using two separate commands.
60869 ALT_CONFIG_ROOT_ONLY is not set by default.
60874 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
60880 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
60881 never to be used for any deliveries. This is like the <option>never_users</option> runtime
60882 option, but it cannot be overridden; the runtime option adds additional users
60883 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
60884 is permitted to modify the runtime file from using Exim as a way to get root.
60889 <section id="SECID270">
60890 <title>Root privilege</title>
60892 <indexterm role="concept">
60893 <primary>setuid</primary>
60895 <indexterm role="concept">
60896 <primary>root privilege</primary>
60898 The Exim binary is normally setuid to root, which means that it gains root
60899 privilege (runs as root) when it starts execution. In some special cases (for
60900 example, when the daemon is not in use and there are no local deliveries), it
60901 may be possible to run Exim setuid to some user other than root. This is
60902 discussed in the next section. However, in most installations, root privilege
60903 is required for two things:
60908 To set up a socket connected to the standard SMTP port (25) when initialising
60909 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
60915 To be able to change uid and gid in order to read users’ <filename>.forward</filename> files and
60916 perform local deliveries as the receiving user or as specified in the
60922 It is not necessary to be root to do any of the other things Exim does, such as
60923 receiving messages and delivering them externally over SMTP, and it is
60924 obviously more secure if Exim does not run as root except when necessary.
60925 For this reason, a user and group for Exim to use must be defined in
60926 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
60927 group</quote>. Their values can be changed by the run time configuration, though this
60928 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
60929 <emphasis>mail</emphasis> or another user name altogether.
60932 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
60933 abdication; the process cannot regain root afterwards. Prior to release 4.00,
60934 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
60937 After a new Exim process has interpreted its command line options, it changes
60938 uid and gid in the following cases:
60943 <indexterm role="option">
60944 <primary><option>-C</option></primary>
60946 <indexterm role="option">
60947 <primary><option>-D</option></primary>
60949 If the <option>-C</option> option is used to specify an alternate configuration file, or if
60950 the <option>-D</option> option is used to define macro values for the configuration, and the
60951 calling process is not running as root or the Exim user, the uid and gid are
60952 changed to those of the calling process.
60953 However, if ALT_CONFIG_ROOT_ONLY is defined in <filename>Local/Makefile</filename>, only
60954 root callers may use <option>-C</option> and <option>-D</option> without losing privilege, and if
60955 DISABLE_D_OPTION is set, the <option>-D</option> option may not be used at all.
60960 <indexterm role="option">
60961 <primary><option>-be</option></primary>
60963 <indexterm role="option">
60964 <primary><option>-bf</option></primary>
60966 <indexterm role="option">
60967 <primary><option>-bF</option></primary>
60969 If the expansion test option (<option>-be</option>) or one of the filter testing options
60970 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
60976 If the process is not a daemon process or a queue runner process or a delivery
60977 process or a process for testing address routing (started with <option>-bt</option>), the
60978 uid and gid are changed to the Exim user and group. This means that Exim always
60979 runs under its own uid and gid when receiving messages. This also applies when
60980 testing address verification
60981 <indexterm role="option">
60982 <primary><option>-bv</option></primary>
60984 <indexterm role="option">
60985 <primary><option>-bh</option></primary>
60987 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
60993 For a daemon, queue runner, delivery, or address testing process, the uid
60994 remains as root at this stage, but the gid is changed to the Exim group.
60999 The processes that initially retain root privilege behave as follows:
61004 A daemon process changes the gid to the Exim group and the uid to the Exim
61005 user after setting up one or more listening sockets. The <function>initgroups()</function>
61006 function is called, so that if the Exim user is in any additional groups, they
61007 will be used during message reception.
61012 A queue runner process retains root privilege throughout its execution. Its
61013 job is to fork a controlled sequence of delivery processes.
61018 A delivery process retains root privilege throughout most of its execution,
61019 but any actual deliveries (that is, the transports themselves) are run in
61020 subprocesses which always change to a non-root uid and gid. For local
61021 deliveries this is typically the uid and gid of the owner of the mailbox; for
61022 remote deliveries, the Exim uid and gid are used. Once all the delivery
61023 subprocesses have been run, a delivery process changes to the Exim uid and gid
61024 while doing post-delivery tidying up such as updating the retry database and
61025 generating bounce and warning messages.
61028 While the recipient addresses in a message are being routed, the delivery
61029 process runs as root. However, if a user’s filter file has to be processed,
61030 this is done in a subprocess that runs under the individual user’s uid and
61031 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
61036 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
61037 the routing is done in the same environment as a message delivery.
61042 <section id="SECTrunexiwitpri">
61043 <title>Running Exim without privilege</title>
61045 <indexterm role="concept">
61046 <primary>privilege, running without</primary>
61048 <indexterm role="concept">
61049 <primary>unprivileged running</primary>
61051 <indexterm role="concept">
61052 <primary>root privilege</primary>
61053 <secondary>running without</secondary>
61055 Some installations like to run Exim in an unprivileged state for more of its
61056 operation, for added security. Support for this mode of operation is provided
61057 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
61058 gid are changed to the Exim user and group at the start of a delivery process
61059 (and also queue runner and address testing processes). This means that address
61060 routing is no longer run as root, and the deliveries themselves cannot change
61064 <indexterm role="concept">
61065 <primary>SIGHUP</primary>
61067 <indexterm role="concept">
61068 <primary>daemon</primary>
61069 <secondary>restarting</secondary>
61071 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
61072 that the daemon can still be started in the usual way, and it can respond
61073 correctly to SIGHUP because the re-invocation regains root privilege.
61076 An alternative approach is to make Exim setuid to the Exim user and also setgid
61077 to the Exim group. If you do this, the daemon must be started from a root
61078 process. (Calling Exim from a root process makes it behave in the way it does
61079 when it is setuid root.) However, the daemon cannot restart itself after a
61080 SIGHUP signal because it cannot regain privilege.
61083 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
61084 stops Exim from trying to re-invoke itself to do a delivery after a message has
61085 been received. Such a re-invocation is a waste of resources because it has no
61089 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
61090 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
61091 to the Exim user seems a clean approach, but there is one complication:
61094 In this style of operation, Exim is running with the real uid and gid set to
61095 those of the calling process, and the effective uid/gid set to Exim’s values.
61096 Ideally, any association with the calling process’ uid/gid should be dropped,
61097 that is, the real uid/gid should be reset to the effective values so as to
61098 discard any privileges that the caller may have. While some operating systems
61099 have a function that permits this action for a non-root effective uid, quite a
61100 number of them do not. Because of this lack of standardization, Exim does not
61101 address this problem at this time.
61104 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
61105 is to keep the Exim binary setuid to root, and to set
61106 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
61107 be used in the most straightforward way.
61110 If you configure Exim not to run delivery processes as root, there are a
61111 number of restrictions on what you can do:
61116 You can deliver only as the Exim user/group. You should explicitly use the
61117 <option>user</option> and <option>group</option> options to override routers or local transports that
61118 normally deliver as the recipient. This makes sure that configurations that
61119 work in this mode function the same way in normal mode. Any implicit or
61120 explicit specification of another user causes an error.
61125 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
61126 not worthwhile to include them in the configuration.
61131 Users who wish to use <filename>.forward</filename> would have to make their home directory and
61132 the file itself accessible to the Exim user. Pipe and append-to-file entries,
61133 and their equivalents in Exim filters, cannot be used. While they could be
61134 enabled in the Exim user’s name, that would be insecure and not very useful.
61139 Unless the local user mailboxes are all owned by the Exim user (possible in
61140 some POP3 or IMAP-only environments):
61142 <orderedlist numeration="arabic">
61145 They must be owned by the Exim group and be writeable by that group. This
61146 implies you must set <option>mode</option> in the appendfile configuration, as well as the
61147 mode of the mailbox files themselves.
61152 You must set <option>no_check_owner</option>, since most or all of the files will not be
61153 owned by the Exim user.
61158 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
61159 on a newly created mailbox when unprivileged. This also implies that new
61160 mailboxes need to be created manually.
61167 These restrictions severely restrict what can be done in local deliveries.
61168 However, there are no restrictions on remote deliveries. If you are running a
61169 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
61170 gives more security at essentially no cost.
61173 If you are using the <option>mua_wrapper</option> facility (see chapter
61174 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
61177 <section id="SECID271">
61178 <title>Delivering to local files</title>
61180 Full details of the checks applied by <command>appendfile</command> before it writes to a file
61181 are given in chapter <xref linkend="CHAPappendfile"/>.
61184 <section id="SECID272">
61185 <title>IPv4 source routing</title>
61187 <indexterm role="concept">
61188 <primary>source routing</primary>
61189 <secondary>in IP packets</secondary>
61191 <indexterm role="concept">
61192 <primary>IP source routing</primary>
61194 Many operating systems suppress IP source-routed packets in the kernel, but
61195 some cannot be made to do this, so Exim does its own check. It logs incoming
61196 IPv4 source-routed TCP calls, and then drops them. Things are all different in
61197 IPv6. No special checking is currently done.
61200 <section id="SECID273">
61201 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
61203 Support for these SMTP commands is disabled by default. If required, they can
61204 be enabled by defining suitable ACLs.
61207 <section id="SECID274">
61208 <title>Privileged users</title>
61210 <indexterm role="concept">
61211 <primary>trusted users</primary>
61213 <indexterm role="concept">
61214 <primary>admin user</primary>
61216 <indexterm role="concept">
61217 <primary>privileged user</primary>
61219 <indexterm role="concept">
61220 <primary>user</primary>
61221 <secondary>trusted</secondary>
61223 <indexterm role="concept">
61224 <primary>user</primary>
61225 <secondary>admin</secondary>
61227 Exim recognizes two sets of users with special privileges. Trusted users are
61228 able to submit new messages to Exim locally, but supply their own sender
61229 addresses and information about a sending host. For other users submitting
61230 local messages, Exim sets up the sender address from the uid, and doesn’t
61231 permit a remote host to be specified.
61234 <indexterm role="option">
61235 <primary><option>-f</option></primary>
61237 However, an untrusted user is permitted to use the <option>-f</option> command line option
61238 in the special form <option>-f <></option> to indicate that a delivery failure for the
61239 message should not cause an error report. This affects the message’s envelope,
61240 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
61241 permitted to use specific forms of address with the <option>-f</option> option by setting
61242 the <option>untrusted_set_sender</option> option.
61245 Trusted users are used to run processes that receive mail messages from some
61246 other mail domain and pass them on to Exim for delivery either locally, or over
61247 the Internet. Exim trusts a caller that is running as root, as the Exim user,
61248 as any user listed in the <option>trusted_users</option> configuration option, or under any
61249 group listed in the <option>trusted_groups</option> option.
61252 Admin users are permitted to do things to the messages on Exim’s queue. They
61253 can freeze or thaw messages, cause them to be returned to their senders, remove
61254 them entirely, or modify them in various ways. In addition, admin users can run
61255 the Exim monitor and see all the information it is capable of providing, which
61256 includes the contents of files on the spool.
61259 <indexterm role="option">
61260 <primary><option>-M</option></primary>
61262 <indexterm role="option">
61263 <primary><option>-q</option></primary>
61265 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
61266 delivery of messages on its queue is restricted to admin users. This
61267 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
61268 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
61269 queue is also restricted to admin users. This restriction can be relaxed by
61270 setting <option>no_queue_list_requires_admin</option>.
61273 Exim recognizes an admin user if the calling process is running as root or as
61274 the Exim user or if any of the groups associated with the calling process is
61275 the Exim group. It is not necessary actually to be running under the Exim
61276 group. However, if admin users who are not root or the Exim user are to access
61277 the contents of files on the spool via the Exim monitor (which runs
61278 unprivileged), Exim must be built to allow group read access to its spool
61282 <section id="SECID275">
61283 <title>Spool files</title>
61285 <indexterm role="concept">
61286 <primary>spool directory</primary>
61287 <secondary>files</secondary>
61289 Exim’s spool directory and everything it contains is owned by the Exim user and
61290 set to the Exim group. The mode for spool files is defined in the
61291 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
61292 any user who is a member of the Exim group can access these files.
61295 <section id="SECID276">
61296 <title>Use of argv[0]</title>
61298 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
61299 of specific strings, Exim assumes certain options. For example, calling Exim
61300 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
61301 to calling it with the option <option>-bS</option>. There are no security implications in
61305 <section id="SECID277">
61306 <title>Use of %f formatting</title>
61308 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
61309 are actually stored in integer variables as 1000 times the load average.
61310 Consequently, their range is limited and so therefore is the length of the
61314 <section id="SECID278">
61315 <title>Embedded Exim path</title>
61317 Exim uses its own path name, which is embedded in the code, only when it needs
61318 to re-exec in order to regain root privilege. Therefore, it is not root when it
61319 does so. If some bug allowed the path to get overwritten, it would lead to an
61320 arbitrary program’s being run as exim, not as root.
61323 <section id="SECID279">
61324 <title>Use of sprintf()</title>
61326 <indexterm role="concept">
61327 <primary><function>sprintf()</function></primary>
61329 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
61330 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc’d store.
61331 The intermediate formatting is done into a large fixed buffer by a function
61332 that runs through the format string itself, and checks the length of each
61333 conversion before performing it, thus preventing buffer overruns.
61336 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
61337 the output buffer is known to be sufficiently long to contain the converted
61341 <section id="SECID280">
61342 <title>Use of debug_printf() and log_write()</title>
61344 Arbitrary strings are passed to both these functions, but they do their
61345 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
61346 the format string itself, and checks the length of each conversion.
61349 <section id="SECID281">
61350 <title>Use of strcat() and strcpy()</title>
61352 These are used only in cases where the output buffer is known to be large
61353 enough to hold the result.
61354 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
61359 <chapter id="CHAPspool">
61360 <title>Format of spool files</title>
61362 <indexterm role="concept" id="IIDforspo1" class="startofrange">
61363 <primary>format</primary>
61364 <secondary>spool files</secondary>
61366 <indexterm role="concept" id="IIDforspo2" class="startofrange">
61367 <primary>spool directory</primary>
61368 <secondary>format of files</secondary>
61370 <indexterm role="concept" id="IIDforspo3" class="startofrange">
61371 <primary>spool files</primary>
61372 <secondary>format of</secondary>
61374 <indexterm role="concept">
61375 <primary>spool files</primary>
61376 <secondary>editing</secondary>
61378 A message on Exim’s queue consists of two files, whose names are the message id
61379 followed by -D and -H, respectively. The data portion of the message is kept in
61380 the -D file on its own. The message’s envelope, status, and headers are all
61381 kept in the -H file, whose format is described in this chapter. Each of these
61382 two files contains the final component of its own name as its first line. This
61383 is insurance against disk crashes where the directory is lost but the files
61384 themselves are recoverable.
61387 Some people are tempted into editing -D files in order to modify messages. You
61388 need to be extremely careful if you do this; it is not recommended and you are
61389 on your own if you do it. Here are some of the pitfalls:
61394 You must ensure that Exim does not try to deliver the message while you are
61395 fiddling with it. The safest way is to take out a write lock on the -D file,
61396 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
61397 place, the lock will be retained. If you write a new file and rename it, the
61398 lock will be lost at the instant of rename.
61403 <indexterm role="variable">
61404 <primary><varname>$body_linecount</varname></primary>
61406 If you change the number of lines in the file, the value of
61407 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect. At
61408 present, this value is not used by Exim, but there is no guarantee that this
61409 will always be the case.
61414 If the message is in MIME format, you must take care not to break it.
61419 If the message is cryptographically signed, any change will invalidate the
61425 All in all, modifying -D files is fraught with danger.
61428 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
61429 its subdirectories when <option>split_spool_directory</option> is set). These are journal
61430 files, used to record addresses to which the message has been delivered during
61431 the course of a delivery attempt. If there are still undelivered recipients at
61432 the end, the -H file is updated, and the -J file is deleted. If, however, there
61433 is some kind of crash (for example, a power outage) before this happens, the -J
61434 file remains in existence. When Exim next processes the message, it notices the
61435 -J file and uses it to update the -H file before starting the next delivery
61438 <section id="SECID282">
61439 <title>Format of the -H file</title>
61441 <indexterm role="concept">
61442 <primary>uid (user id)</primary>
61443 <secondary>in spool file</secondary>
61445 <indexterm role="concept">
61446 <primary>gid (group id)</primary>
61447 <secondary>in spool file</secondary>
61449 The second line of the -H file contains the login name for the uid of the
61450 process that called Exim to read the message, followed by the numerical uid and
61451 gid. For a locally generated message, this is normally the user who sent the
61452 message. For a message received over TCP/IP via the daemon, it is
61453 normally the Exim user.
61456 The third line of the file contains the address of the message’s sender as
61457 transmitted in the envelope, contained in angle brackets. The sender address is
61458 empty for bounce messages. For incoming SMTP mail, the sender address is given
61459 in the MAIL command. For locally generated mail, the sender address is
61460 created by Exim from the login name of the current user and the configured
61461 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
61462 leading <quote>From </quote> line if the caller is trusted, or if the supplied address is
61463 <quote><></quote> or an address that matches <option>untrusted_set_senders</option>.
61466 The fourth line contains two numbers. The first is the time that the message
61467 was received, in the conventional Unix form – the number of seconds since the
61468 start of the epoch. The second number is a count of the number of messages
61469 warning of delayed delivery that have been sent to the sender.
61472 There follow a number of lines starting with a hyphen. These can appear in any
61473 order, and are omitted when not relevant:
61477 <term><option>-acl</option> <<emphasis>number</emphasis>> <<emphasis>length</emphasis>></term>
61480 This item is obsolete, and is not generated from Exim release 4.61 onwards;
61481 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
61482 recognized, to provide backward compatibility. In the old format, a line of
61483 this form is present for every ACL variable that is not empty. The number
61484 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0–9 and
61485 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10–19. The length is the length of
61486 the data string for the variable. The string itself starts at the beginning of
61487 the next line, and is followed by a newline character. It may contain internal
61490 </listitem></varlistentry>
61492 <term><option>-aclc</option> <<emphasis>rest-of-name</emphasis>> <<emphasis>length</emphasis>></term>
61495 A line of this form is present for every ACL connection variable that is
61496 defined. Note that there is a space between <option>-aclc</option> and the rest of the name.
61497 The length is the length of the data string for the variable. The string itself
61498 starts at the beginning of the next line, and is followed by a newline
61499 character. It may contain internal newlines.
61501 </listitem></varlistentry>
61503 <term><option>-aclm</option> <<emphasis>rest-of-name</emphasis>> <<emphasis>length</emphasis>></term>
61506 A line of this form is present for every ACL message variable that is defined.
61507 Note that there is a space between <option>-aclm</option> and the rest of the name. The
61508 length is the length of the data string for the variable. The string itself
61509 starts at the beginning of the next line, and is followed by a newline
61510 character. It may contain internal newlines.
61512 </listitem></varlistentry>
61514 <term><option>-active_hostname</option> <<emphasis>hostname</emphasis>></term>
61517 This is present if, when the message was received over SMTP, the value of
61518 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
61520 </listitem></varlistentry>
61522 <term><option>-allow_unqualified_recipient</option></term>
61525 This is present if unqualified recipient addresses are permitted in header
61526 lines (to stop such addresses from being qualified if rewriting occurs at
61527 transport time). Local messages that were input using <option>-bnq</option> and remote
61528 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
61530 </listitem></varlistentry>
61532 <term><option>-allow_unqualified_sender</option></term>
61535 This is present if unqualified sender addresses are permitted in header lines
61536 (to stop such addresses from being qualified if rewriting occurs at transport
61537 time). Local messages that were input using <option>-bnq</option> and remote messages from
61538 hosts that match <option>sender_unqualified_hosts</option> set this flag.
61540 </listitem></varlistentry>
61542 <term><option>-auth_id</option> <<emphasis>text</emphasis>></term>
61545 The id information for a message received on an authenticated SMTP connection
61546 – the value of the <varname>$authenticated_id</varname> variable.
61548 </listitem></varlistentry>
61550 <term><option>-auth_sender</option> <<emphasis>address</emphasis>></term>
61553 The address of an authenticated sender – the value of the
61554 <varname>$authenticated_sender</varname> variable.
61556 </listitem></varlistentry>
61558 <term><option>-body_linecount</option> <<emphasis>number</emphasis>></term>
61561 This records the number of lines in the body of the message, and is always
61564 </listitem></varlistentry>
61566 <term><option>-body_zerocount</option> <<emphasis>number</emphasis>></term>
61569 This records the number of binary zero bytes in the body of the message, and is
61570 present if the number is greater than zero.
61572 </listitem></varlistentry>
61574 <term><option>-deliver_firsttime</option></term>
61577 This is written when a new message is first added to the spool. When the spool
61578 file is updated after a deferral, it is omitted.
61580 </listitem></varlistentry>
61582 <term><option>-frozen</option> <<emphasis>time</emphasis>></term>
61585 <indexterm role="concept">
61586 <primary>frozen messages</primary>
61587 <secondary>spool data</secondary>
61589 The message is frozen, and the freezing happened at <<emphasis>time</emphasis>>.
61591 </listitem></varlistentry>
61593 <term><option>-helo_name</option> <<emphasis>text</emphasis>></term>
61596 This records the host name as specified by a remote host in a HELO or EHLO
61599 </listitem></varlistentry>
61601 <term><option>-host_address</option> <<emphasis>address</emphasis>>.<<emphasis>port</emphasis>></term>
61604 This records the IP address of the host from which the message was received and
61605 the remote port number that was used. It is omitted for locally generated
61608 </listitem></varlistentry>
61610 <term><option>-host_auth</option> <<emphasis>text</emphasis>></term>
61613 If the message was received on an authenticated SMTP connection, this records
61614 the name of the authenticator – the value of the
61615 <varname>$sender_host_authenticated</varname> variable.
61617 </listitem></varlistentry>
61619 <term><option>-host_lookup_failed</option></term>
61622 This is present if an attempt to look up the sending host’s name from its IP
61623 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
61625 </listitem></varlistentry>
61627 <term><option>-host_name</option> <<emphasis>text</emphasis>></term>
61630 <indexterm role="concept">
61631 <primary>reverse DNS lookup</primary>
61633 <indexterm role="concept">
61634 <primary>DNS</primary>
61635 <secondary>reverse lookup</secondary>
61637 This records the name of the remote host from which the message was received,
61638 if the host name was looked up from the IP address when the message was being
61639 received. It is not present if no reverse lookup was done.
61641 </listitem></varlistentry>
61643 <term><option>-ident</option> <<emphasis>text</emphasis>></term>
61646 For locally submitted messages, this records the login of the originating user,
61647 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
61648 ident value. For messages received over TCP/IP, this records the ident string
61649 supplied by the remote host, if any.
61651 </listitem></varlistentry>
61653 <term><option>-interface_address</option> <<emphasis>address</emphasis>>.<<emphasis>port</emphasis>></term>
61656 This records the IP address of the local interface and the port number through
61657 which a message was received from a remote host. It is omitted for locally
61658 generated messages.
61660 </listitem></varlistentry>
61662 <term><option>-local</option></term>
61665 The message is from a local sender.
61667 </listitem></varlistentry>
61669 <term><option>-localerror</option></term>
61672 The message is a locally-generated bounce message.
61674 </listitem></varlistentry>
61676 <term><option>-local_scan</option> <<emphasis>string</emphasis>></term>
61679 This records the data string that was returned by the <function>local_scan()</function> function
61680 when the message was received – the value of the <varname>$local_scan_data</varname>
61681 variable. It is omitted if no data was returned.
61683 </listitem></varlistentry>
61685 <term><option>-manual_thaw</option></term>
61688 The message was frozen but has been thawed manually, that is, by an explicit
61689 Exim command rather than via the auto-thaw process.
61691 </listitem></varlistentry>
61693 <term><option>-N</option></term>
61696 A testing delivery process was started using the <option>-N</option> option to suppress any
61697 actual deliveries, but delivery was deferred. At any further delivery attempts,
61698 <option>-N</option> is assumed.
61700 </listitem></varlistentry>
61702 <term><option>-received_protocol</option></term>
61705 This records the value of the <varname>$received_protocol</varname> variable, which contains
61706 the name of the protocol by which the message was received.
61708 </listitem></varlistentry>
61710 <term><option>-sender_set_untrusted</option></term>
61713 The envelope sender of this message was set by an untrusted local caller (used
61714 to ensure that the caller is displayed in queue listings).
61716 </listitem></varlistentry>
61718 <term><option>-spam_score_int</option> <<emphasis>number</emphasis>></term>
61721 If a message was scanned by SpamAssassin, this is present. It records the value
61722 of <varname>$spam_score_int</varname>.
61724 </listitem></varlistentry>
61726 <term><option>-tls_certificate_verified</option></term>
61729 A TLS certificate was received from the client that sent this message, and the
61730 certificate was verified by the server.
61732 </listitem></varlistentry>
61734 <term><option>-tls_cipher</option> <<emphasis>cipher name</emphasis>></term>
61737 When the message was received over an encrypted connection, this records the
61738 name of the cipher suite that was used.
61740 </listitem></varlistentry>
61742 <term><option>-tls_peerdn</option> <<emphasis>peer DN</emphasis>></term>
61745 When the message was received over an encrypted connection, and a certificate
61746 was received from the client, this records the Distinguished Name from that
61749 </listitem></varlistentry>
61752 Following the options there is a list of those addresses to which the message
61753 is not to be delivered. This set of addresses is initialized from the command
61754 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
61755 is set; otherwise it starts out empty. Whenever a successful delivery is made,
61756 the address is added to this set. The addresses are kept internally as a
61757 balanced binary tree, and it is a representation of that tree which is written
61758 to the spool file. If an address is expanded via an alias or forward file, the
61759 original address is added to the tree when deliveries to all its child
61760 addresses are complete.
61763 If the tree is empty, there is a single line in the spool file containing just
61764 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
61765 Y or N, followed by an address. The address is the value for the node of the
61766 tree, and the letters indicate whether the node has a left branch and/or a
61767 right branch attached to it, respectively. If branches exist, they immediately
61768 follow. Here is an example of a three-node tree:
61770 <literallayout class="monospaced">
61771 YY darcy@austen.fict.example
61772 NN alice@wonderland.fict.example
61773 NN editor@thesaurus.ref.example
61776 After the non-recipients tree, there is a list of the message’s recipients.
61777 This is a simple list, preceded by a count. It includes all the original
61778 recipients of the message, including those to whom the message has already been
61779 delivered. In the simplest case, the list contains one address per line. For
61782 <literallayout class="monospaced">
61784 editor@thesaurus.ref.example
61785 darcy@austen.fict.example
61787 alice@wonderland.fict.example
61790 However, when a child address has been added to the top-level addresses as a
61791 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
61792 line is of the following form:
61795 <<emphasis>top-level address</emphasis>> <<emphasis>errors_to address</emphasis>> <<emphasis>length</emphasis>>,<<emphasis>parent number</emphasis>>#<<emphasis>flag bits</emphasis>>
61798 The 01 flag bit indicates the presence of the three other fields that follow
61799 the top-level address. Other bits may be used in future to support additional
61800 fields. The <<emphasis>parent number</emphasis>> is the offset in the recipients list of the
61801 original parent of the <quote>one time</quote> address. The first two fields are the
61802 envelope sender that is associated with this address and its length. If the
61803 length is zero, there is no special envelope sender (there are then two space
61804 characters in the line). A non-empty field can arise from a <command>redirect</command> router
61805 that has an <option>errors_to</option> setting.
61808 A blank line separates the envelope and status information from the headers
61809 which follow. A header may occupy several lines of the file, and to save effort
61810 when reading it in, each header is preceded by a number and an identifying
61811 character. The number is the number of characters in the header, including any
61812 embedded newlines and the terminating newline. The character is one of the
61815 <informaltable frame="none">
61816 <tgroup cols="2" colsep="0" rowsep="0">
61817 <colspec colwidth="50pt" align="left"/>
61818 <colspec colwidth="254pt" align="left"/>
61821 <entry><<emphasis>blank</emphasis>></entry>
61822 <entry>header in which Exim has no special interest</entry>
61825 <entry><literal>B</literal></entry>
61826 <entry><emphasis>Bcc:</emphasis> header</entry>
61829 <entry><literal>C</literal></entry>
61830 <entry><emphasis>Cc:</emphasis> header</entry>
61833 <entry><literal>F</literal></entry>
61834 <entry><emphasis>From:</emphasis> header</entry>
61837 <entry><literal>I</literal></entry>
61838 <entry><emphasis>Message-id:</emphasis> header</entry>
61841 <entry><literal>P</literal></entry>
61842 <entry><emphasis>Received:</emphasis> header – P for <quote>postmark</quote></entry>
61845 <entry><literal>R</literal></entry>
61846 <entry><emphasis>Reply-To:</emphasis> header</entry>
61849 <entry><literal>S</literal></entry>
61850 <entry><emphasis>Sender:</emphasis> header</entry>
61853 <entry><literal>T</literal></entry>
61854 <entry><emphasis>To:</emphasis> header</entry>
61857 <entry><literal>*</literal></entry>
61858 <entry>replaced or deleted header</entry>
61864 Deleted or replaced (rewritten) headers remain in the spool file for debugging
61865 purposes. They are not transmitted when the message is delivered. Here is a
61866 typical set of headers:
61868 <literallayout class="monospaced">
61869 111P Received: by hobbit.fict.example with local (Exim 4.00)
61870 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
61871 049 Message-Id: <E14y9EI-00026G-00@hobbit.fict.example>
61872 038* X-rewrote-sender: bb@hobbit.fict.example
61873 042* From: Bilbo Baggins <bb@hobbit.fict.example>
61874 049F From: Bilbo Baggins <B.Baggins@hobbit.fict.example>
61875 099* To: alice@wonderland.fict.example, rdo@foundation,
61876 darcy@austen.fict.example, editor@thesaurus.ref.example
61877 104T To: alice@wonderland.fict.example, rdo@foundation.example,
61878 darcy@austen.fict.example, editor@thesaurus.ref.example
61879 038 Date: Fri, 11 May 2001 10:28:59 +0100
61882 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
61883 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
61884 unqualified domain <emphasis>foundation</emphasis>.
61885 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
61886 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
61887 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
61892 <chapter id="CHID12">
61893 <title>Support for DKIM (DomainKeys Identified Mail) - RFC4871</title>
61894 <titleabbrev>DKIM Support</titleabbrev>
61896 <indexterm role="concept">
61897 <primary>DKIM</primary>
61901 Since version 4.70, DKIM support is compiled into Exim by default. It can be
61902 disabled by setting DISABLE_DKIM=yes in Local/Makefile.
61905 Exim’s DKIM implementation allows to
61907 <orderedlist numeration="arabic">
61910 Sign outgoing messages: This function is implemented in the SMTP transport.
61911 It can co-exist with all other Exim features, including transport filters.
61916 Verify signatures in incoming messages: This is implemented by an additional
61917 ACL (acl_smtp_dkim), which can be called several times per message, with
61918 different signature contexts.
61923 In typical Exim style, the verification implementation does not include any
61924 default "policy". Instead it enables you to build your own policy using
61925 Exim’s standard controls.
61928 Please note that verification of DKIM signatures in incoming mail is turned
61929 on by default for logging purposes. For each signature in incoming email,
61930 exim will log a line displaying the most important signature details, and the
61931 signature status. Here is an example:
61933 <literallayout class="monospaced">
61934 2009-09-09 10:22:28 1MlIRf-0003LU-U3 DKIM: d=facebookmail.com s=q1-2009b c=relaxed/relaxed a=rsa-sha1 i=@facebookmail.com t=1252484542 [verification succeeded]
61937 You might want to turn off DKIM verification processing entirely for internal
61938 or relay mail sources. To do that, set the <option>dkim_disable_verify</option> ACL
61939 control modifier. This should typically be done in the RCPT ACL, at points
61940 where you accept mail from relay sources (internal hosts or authenticated
61943 <section id="SECID513">
61944 <title>Signing outgoing messages</title>
61946 <indexterm role="concept">
61947 <primary>DKIM</primary>
61948 <secondary>signing</secondary>
61952 Signing is implemented by setting private options on the SMTP transport.
61953 These options take (expandable) strings as arguments.
61956 <indexterm role="option">
61957 <primary><option>dkim_domain</option></primary>
61960 <informaltable frame="all">
61961 <tgroup cols="4" colsep="0" rowsep="0">
61962 <colspec colwidth="8*" align="left"/>
61963 <colspec colwidth="6*" align="center"/>
61964 <colspec colwidth="6*" align="center"/>
61965 <colspec colwidth="6*" align="right"/>
61968 <entry><option>dkim_domain</option></entry>
61969 <entry>Use: <emphasis>smtp</emphasis></entry>
61970 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
61971 <entry>Default: <emphasis>unset</emphasis></entry>
61978 The domain you want to sign with. The result of this expanded
61979 option is put into the <option>$dkim_domain</option> expansion variable.
61982 <indexterm role="option">
61983 <primary><option>dkim_selector</option></primary>
61986 <informaltable frame="all">
61987 <tgroup cols="4" colsep="0" rowsep="0">
61988 <colspec colwidth="8*" align="left"/>
61989 <colspec colwidth="6*" align="center"/>
61990 <colspec colwidth="6*" align="center"/>
61991 <colspec colwidth="6*" align="right"/>
61994 <entry><option>dkim_selector</option></entry>
61995 <entry>Use: <emphasis>smtp</emphasis></entry>
61996 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
61997 <entry>Default: <emphasis>unset</emphasis></entry>
62004 This sets the key selector string. You can use the <option>$dkim_domain</option> expansion
62005 variable to look up a matching selector. The result is put in the expansion
62006 variable <option>$dkim_selector</option> which should be used in the <option>dkim_private_key</option>
62007 option along with <option>$dkim_domain</option>.
62010 <indexterm role="option">
62011 <primary><option>dkim_private_key</option></primary>
62014 <informaltable frame="all">
62015 <tgroup cols="4" colsep="0" rowsep="0">
62016 <colspec colwidth="8*" align="left"/>
62017 <colspec colwidth="6*" align="center"/>
62018 <colspec colwidth="6*" align="center"/>
62019 <colspec colwidth="6*" align="right"/>
62022 <entry><option>dkim_private_key</option></entry>
62023 <entry>Use: <emphasis>smtp</emphasis></entry>
62024 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
62025 <entry>Default: <emphasis>unset</emphasis></entry>
62032 This sets the private key to use. You can use the <option>$dkim_domain</option> and
62033 <option>$dkim_selector</option> expansion variables to determine the private key to use.
62034 The result can either
62039 be a valid RSA private key in ASCII armor, including line breaks.
62044 start with a slash, in which case it is treated as a file that contains
62050 be "0", "false" or the empty string, in which case the message will not
62051 be signed. This case will not result in an error, even if <option>dkim_strict</option>
62057 <indexterm role="option">
62058 <primary><option>dkim_canon</option></primary>
62061 <informaltable frame="all">
62062 <tgroup cols="4" colsep="0" rowsep="0">
62063 <colspec colwidth="8*" align="left"/>
62064 <colspec colwidth="6*" align="center"/>
62065 <colspec colwidth="6*" align="center"/>
62066 <colspec colwidth="6*" align="right"/>
62069 <entry><option>dkim_canon</option></entry>
62070 <entry>Use: <emphasis>smtp</emphasis></entry>
62071 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
62072 <entry>Default: <emphasis>unset</emphasis></entry>
62079 This option sets the canonicalization method used when signing a message.
62080 The DKIM RFC currently supports two methods: "simple" and "relaxed".
62081 The option defaults to "relaxed" when unset. Note: the current implementation
62082 only supports using the same canonicalization method for both headers and body.
62085 <indexterm role="option">
62086 <primary><option>dkim_strict</option></primary>
62089 <informaltable frame="all">
62090 <tgroup cols="4" colsep="0" rowsep="0">
62091 <colspec colwidth="8*" align="left"/>
62092 <colspec colwidth="6*" align="center"/>
62093 <colspec colwidth="6*" align="center"/>
62094 <colspec colwidth="6*" align="right"/>
62097 <entry><option>dkim_strict</option></entry>
62098 <entry>Use: <emphasis>smtp</emphasis></entry>
62099 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
62100 <entry>Default: <emphasis>unset</emphasis></entry>
62107 This option defines how Exim behaves when signing a message that
62108 should be signed fails for some reason. When the expansion evaluates to
62109 either "1" or "true", Exim will defer. Otherwise Exim will send the message
62110 unsigned. You can use the <option>$dkim_domain</option> and <option>$dkim_selector</option> expansion
62114 <indexterm role="option">
62115 <primary><option>dkim_sign_headers</option></primary>
62118 <informaltable frame="all">
62119 <tgroup cols="4" colsep="0" rowsep="0">
62120 <colspec colwidth="8*" align="left"/>
62121 <colspec colwidth="6*" align="center"/>
62122 <colspec colwidth="6*" align="center"/>
62123 <colspec colwidth="6*" align="right"/>
62126 <entry><option>dkim_sign_headers</option></entry>
62127 <entry>Use: <emphasis>smtp</emphasis></entry>
62128 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
62129 <entry>Default: <emphasis>unset</emphasis></entry>
62136 When set, this option must expand to (or be specified as) a colon-separated
62137 list of header names. Headers with these names will be included in the message
62138 signature. When unspecified, the header names recommended in RFC4871 will be
62142 <section id="SECID514">
62143 <title>Verifying DKIM signatures in incoming mail</title>
62145 <indexterm role="concept">
62146 <primary>DKIM</primary>
62147 <secondary>verification</secondary>
62151 Verification of DKIM signatures in incoming email is implemented via the
62152 <option>acl_smtp_dkim</option> ACL. By default, this ACL is called once for each
62153 syntactically(!) correct signature in the incoming message.
62156 To evaluate the signature in the ACL a large number of expansion variables
62157 containing the signature status and its details are set up during the
62158 runtime of the ACL.
62161 Calling the ACL only for existing signatures is not sufficient to build
62162 more advanced policies. For that reason, the global option
62163 <option>dkim_verify_signers</option>, and a global expansion variable
62164 <option>$dkim_signers</option> exist.
62167 The global option <option>dkim_verify_signers</option> can be set to a colon-separated
62168 list of DKIM domains or identities for which the ACL <option>acl_smtp_dkim</option> is
62169 called. It is expanded when the message has been received. At this point,
62170 the expansion variable <option>$dkim_signers</option> already contains a colon-separated
62171 list of signer domains and identities for the message. When
62172 <option>dkim_verify_signers</option> is not specified in the main configuration,
62175 <literallayout class="monospaced">
62176 dkim_verify_signers = $dkim_signers
62179 This leads to the default behaviour of calling <option>acl_smtp_dkim</option> for each
62180 DKIM signature in the message. Current DKIM verifiers may want to explicitly
62181 call the ACL for known domains or identities. This would be achieved as follows:
62183 <literallayout class="monospaced">
62184 dkim_verify_signers = paypal.com:ebay.com:$dkim_signers
62187 This would result in <option>acl_smtp_dkim</option> always being called for "paypal.com"
62188 and "ebay.com", plus all domains and identities that have signatures in the message.
62189 You can also be more creative in constructing your policy. For example:
62191 <literallayout class="monospaced">
62192 dkim_verify_signers = $sender_address_domain:$dkim_signers
62195 If a domain or identity is listed several times in the (expanded) value of
62196 <option>dkim_verify_signers</option>, the ACL is only called once for that domain or identity.
62199 Inside the <option>acl_smtp_dkim</option>, the following expansion variables are
62200 available (from most to least important):
62204 <term><option>$dkim_cur_signer</option></term>
62207 The signer that is being evaluated in this ACL run. This can be a domain or
62208 an identity. This is one of the list items from the expanded main option
62209 <option>dkim_verify_signers</option> (see above).
62211 </listitem></varlistentry>
62213 <term><option>$dkim_verify_status</option></term>
62216 A string describing the general status of the signature. One of
62221 <option>none</option>: There is no signature in the message for the current domain or
62222 identity (as reflected by <option>$dkim_cur_signer</option>).
62227 <option>invalid</option>: The signature could not be verified due to a processing error.
62228 More detail is available in <option>$dkim_verify_reason</option>.
62233 <option>fail</option>: Verification of the signature failed. More detail is
62234 available in <option>$dkim_verify_reason</option>.
62239 <option>pass</option>: The signature passed verification. It is valid.
62243 </listitem></varlistentry>
62245 <term><option>$dkim_verify_reason</option></term>
62248 A string giving a litte bit more detail when <option>$dkim_verify_status</option> is either
62249 "fail" or "invalid". One of
62254 <option>pubkey_unavailable</option> (when <option>$dkim_verify_status</option>="invalid"): The public
62255 key for the domain could not be retrieved. This may be a temporary problem.
62260 <option>pubkey_syntax</option> (when <option>$dkim_verify_status</option>="invalid"): The public key
62261 record for the domain is syntactically invalid.
62266 <option>bodyhash_mismatch</option> (when <option>$dkim_verify_status</option>="fail"): The calculated
62267 body hash does not match the one specified in the signature header. This
62268 means that the message body was modified in transit.
62273 <option>signature_incorrect</option> (when <option>$dkim_verify_status</option>="fail"): The signature
62274 could not be verified. This may mean that headers were modified,
62275 re-written or otherwise changed in a way which is incompatible with
62276 DKIM verification. It may of course also mean that the signature is forged.
62280 </listitem></varlistentry>
62282 <term><option>$dkim_domain</option></term>
62285 The signing domain. IMPORTANT: This variable is only populated if there is
62286 an actual signature in the message for the current domain or identity (as
62287 reflected by <option>$dkim_cur_signer</option>).
62289 </listitem></varlistentry>
62291 <term><option>$dkim_identity</option></term>
62294 The signing identity, if present. IMPORTANT: This variable is only populated
62295 if there is an actual signature in the message for the current domain or
62296 identity (as reflected by <option>$dkim_cur_signer</option>).
62298 </listitem></varlistentry>
62300 <term><option>$dkim_selector</option></term>
62303 The key record selector string.
62305 </listitem></varlistentry>
62307 <term><option>$dkim_algo</option></term>
62310 The algorithm used. One of ’rsa-sha1’ or ’rsa-sha256’.
62312 </listitem></varlistentry>
62314 <term><option>$dkim_canon_body</option></term>
62317 The body canonicalization method. One of ’relaxed’ or ’simple’.
62319 </listitem></varlistentry>
62321 <term><option>dkim_canon_headers</option></term>
62324 The header canonicalization method. One of ’relaxed’ or ’simple’.
62326 </listitem></varlistentry>
62328 <term><option>$dkim_copiedheaders</option></term>
62331 A transcript of headers and their values which are included in the signature
62332 (copied from the ’z=’ tag of the signature).
62334 </listitem></varlistentry>
62336 <term><option>$dkim_bodylength</option></term>
62339 The number of signed body bytes. If zero ("0"), the body is unsigned. If no
62340 limit was set by the signer, "9999999999999" is returned. This makes sure
62341 that this variable always expands to an integer value.
62343 </listitem></varlistentry>
62345 <term><option>$dkim_created</option></term>
62348 UNIX timestamp reflecting the date and time when the signature was created.
62349 When this was not specified by the signer, "0" is returned.
62351 </listitem></varlistentry>
62353 <term><option>$dkim_expires</option></term>
62356 UNIX timestamp reflecting the date and time when the signer wants the
62357 signature to be treated as "expired". When this was not specified by the
62358 signer, "9999999999999" is returned. This makes it possible to do useful
62359 integer size comparisons against this value.
62361 </listitem></varlistentry>
62363 <term><option>$dkim_headernames</option></term>
62366 A colon-separated list of names of headers included in the signature.
62368 </listitem></varlistentry>
62370 <term><option>$dkim_key_testing</option></term>
62373 "1" if the key record has the "testing" flag set, "0" if not.
62375 </listitem></varlistentry>
62377 <term><option>$dkim_key_nosubdomaining</option></term>
62380 "1" if the key record forbids subdomaining, "0" otherwise.
62382 </listitem></varlistentry>
62384 <term><option>$dkim_key_srvtype</option></term>
62387 Service type (tag s=) from the key record. Defaults to "*" if not specified
62390 </listitem></varlistentry>
62392 <term><option>$dkim_key_granularity</option></term>
62395 Key granularity (tag g=) from the key record. Defaults to "*" if not specified
62398 </listitem></varlistentry>
62400 <term><option>$dkim_key_notes</option></term>
62403 Notes from the key record (tag n=).
62405 </listitem></varlistentry>
62408 In addition, two ACL conditions are provided:
62412 <term><option>dkim_signers</option></term>
62415 ACL condition that checks a colon-separated list of domains or identities
62416 for a match against the domain or identity that the ACL is currently verifying
62417 (reflected by <option>$dkim_cur_signer</option>). This is typically used to restrict an ACL
62418 verb to a group of domains or identities. For example:
62420 <literallayout class="monospaced">
62421 # Warn when message apparently from GMail has no signature at all
62422 warn log_message = GMail sender without DKIM signature
62423 sender_domains = gmail.com
62424 dkim_signers = gmail.com
62427 </listitem></varlistentry>
62429 <term><option>dkim_status</option></term>
62432 ACL condition that checks a colon-separated list of possible DKIM verification
62433 results agains the actual result of verification. This is typically used
62434 to restrict an ACL verb to a list of verification outcomes, like:
62436 <literallayout class="monospaced">
62437 deny message = Message from Paypal with invalid or missing signature
62438 sender_domains = paypal.com:paypal.de
62439 dkim_signers = paypal.com:paypal.de
62440 dkim_status = none:invalid:fail
62443 The possible status keywords are: ’none’,’invalid’,’fail’ and ’pass’. Please
62444 see the documentation of the <option>$dkim_verify_status</option> expansion variable above
62445 for more information of what they mean.
62447 </listitem></varlistentry>
62452 <chapter id="CHID13">
62453 <title>Adding new drivers or lookup types</title>
62454 <titleabbrev>Adding drivers or lookups</titleabbrev>
62456 <indexterm role="concept">
62457 <primary>adding drivers</primary>
62459 <indexterm role="concept">
62460 <primary>new drivers, adding</primary>
62462 <indexterm role="concept">
62463 <primary>drivers</primary>
62464 <secondary>adding new</secondary>
62466 The following actions have to be taken in order to add a new router, transport,
62467 authenticator, or lookup type to Exim:
62469 <orderedlist numeration="arabic">
62472 Choose a name for the driver or lookup type that does not conflict with any
62473 existing name; I will use <quote>newdriver</quote> in what follows.
62478 Add to <filename>src/EDITME</filename> the line:
62481 <<emphasis>type</emphasis>><literal>_NEWDRIVER=yes</literal>
62484 where <<emphasis>type</emphasis>> is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
62485 code is not to be included in the binary by default, comment this line out. You
62486 should also add any relevant comments about the driver or lookup type.
62491 Add to <filename>src/config.h.defaults</filename> the line:
62493 <literallayout class="monospaced">
62494 #define <type>_NEWDRIVER
62499 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
62500 and create a table entry as is done for all the other drivers and lookup types.
62505 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
62506 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
62507 driver or lookup type and add it to the definition of OBJ.
62512 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
62513 <filename>src</filename>.
62518 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
62519 as for other drivers and lookups.
62524 Then all you need to do is write the code! A good way to start is to make a
62525 proforma by copying an existing module of the same type, globally changing all
62526 occurrences of the name, and cutting out most of the code. Note that any
62527 options you create must be listed in alphabetical order, because the tables are
62528 searched using a binary chop procedure.
62531 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
62532 the interface that is expected.
62536 foot_right_recto="&chaptertitle;"
62537 foot_right_verso="&chaptertitle;"
62541 <index role="option">
62542 <title>Options index</title>
62545 <index role="variable">
62546 <title>Variables index</title>
62549 <index role="concept">
62550 <title>Concept index</title>