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>5 November 2009</date>
16 <author><firstname>Exim</firstname><surname>Maintainers</surname></author>
17 <authorinitials>EM</authorinitials>
18 <revhistory><revision>
19 <revnumber>4.71</revnumber>
20 <date>5 November 2009</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.71 of Exim.
202 Substantive changes from the 4.69 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.
787 <para revisionflag="changed">
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.71</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 Exim can be linked with the <emphasis>tcpwrappers</emphasis> library in order to check incoming
2569 SMTP calls using the <emphasis>tcpwrappers</emphasis> control files. This may be a convenient
2570 alternative to Exim’s own checking facilities for installations that are
2571 already making use of <emphasis>tcpwrappers</emphasis> for other purposes. To do this, you
2572 should set USE_TCP_WRAPPERS in <filename>Local/Makefile</filename>, arrange for the file
2573 <filename>tcpd.h</filename> to be available at compile time, and also ensure that the library
2574 <filename>libwrap.a</filename> is available at link time, typically by including <option>-lwrap</option> in
2575 EXTRALIBS_EXIM. For example, if <emphasis>tcpwrappers</emphasis> is installed in <filename>/usr/local</filename>,
2578 <literallayout class="monospaced">
2579 USE_TCP_WRAPPERS=yes
2580 CFLAGS=-O -I/usr/local/include
2581 EXTRALIBS_EXIM=-L/usr/local/lib -lwrap
2584 in <filename>Local/Makefile</filename>. The name to use in the <emphasis>tcpwrappers</emphasis> control files is
2585 <quote>exim</quote>. For example, the line
2587 <literallayout class="monospaced">
2588 exim : LOCAL 192.168.1. .friendly.domain.example
2591 in your <filename>/etc/hosts.allow</filename> file allows connections from the local host, from
2592 the subnet 192.168.1.0/24, and from all hosts in <emphasis>friendly.domain.example</emphasis>.
2593 All other connections are denied. Consult the <emphasis>tcpwrappers</emphasis> documentation for
2597 <section id="SECID28">
2598 <title>Including support for IPv6</title>
2600 <indexterm role="concept">
2601 <primary>IPv6</primary>
2602 <secondary>including support for</secondary>
2604 Exim contains code for use on systems that have IPv6 support. Setting
2605 <literal>HAVE_IPV6=YES</literal> in <filename>Local/Makefile</filename> causes the IPv6 code to be included;
2606 it may also be necessary to set IPV6_INCLUDE and IPV6_LIBS on systems
2607 where the IPv6 support is not fully integrated into the normal include and
2611 Two different types of DNS record for handling IPv6 addresses have been
2612 defined. AAAA records (analogous to A records for IPv4) are in use, and are
2613 currently seen as the mainstream. Another record type called A6 was proposed
2614 as better than AAAA because it had more flexibility. However, it was felt to be
2615 over-complex, and its status was reduced to <quote>experimental</quote>. It is not known
2616 if anyone is actually using A6 records. Exim has support for A6 records, but
2617 this is included only if you set <literal>SUPPORT_A6=YES</literal> in <filename>Local/Makefile</filename>. The
2618 support has not been tested for some time.
2621 <section id="SECID29">
2622 <title>The building process</title>
2624 <indexterm role="concept">
2625 <primary>build directory</primary>
2627 Once <filename>Local/Makefile</filename> (and <filename>Local/eximon.conf</filename>, if required) have been
2628 created, run <emphasis>make</emphasis> at the top level. It determines the architecture and
2629 operating system types, and creates a build directory if one does not exist.
2630 For example, on a Sun system running Solaris 8, the directory
2631 <filename>build-SunOS5-5.8-sparc</filename> is created.
2632 <indexterm role="concept">
2633 <primary>symbolic link</primary>
2634 <secondary>to source files</secondary>
2636 Symbolic links to relevant source files are installed in the build directory.
2639 <emphasis role="bold">Warning</emphasis>: The <option>-j</option> (parallel) flag must not be used with <emphasis>make</emphasis>; the
2640 building process fails if it is set.
2643 If this is the first time <emphasis>make</emphasis> has been run, it calls a script that builds
2644 a make file inside the build directory, using the configuration files from the
2645 <filename>Local</filename> directory. The new make file is then passed to another instance of
2646 <emphasis>make</emphasis>. This does the real work, building a number of utility scripts, and
2647 then compiling and linking the binaries for the Exim monitor (if configured), a
2648 number of utility programs, and finally Exim itself. The command <literal>make
2649 makefile</literal> can be used to force a rebuild of the make file in the build
2650 directory, should this ever be necessary.
2653 If you have problems building Exim, check for any comments there may be in the
2654 <filename>README</filename> file concerning your operating system, and also take a look at the
2655 FAQ, where some common problems are covered.
2658 <section id="SECID283">
2659 <title>Output from <quote>make</quote></title>
2661 The output produced by the <emphasis>make</emphasis> process for compile lines is often very
2662 unreadable, because these lines can be very long. For this reason, the normal
2663 output is suppressed by default, and instead output similar to that which
2664 appears when compiling the 2.6 Linux kernel is generated: just a short line for
2665 each module that is being compiled or linked. However, it is still possible to
2666 get the full output, by calling <emphasis>make</emphasis> like this:
2668 <literallayout class="monospaced">
2672 The value of FULLECHO defaults to <quote>@</quote>, the flag character that suppresses
2673 command reflection in <emphasis>make</emphasis>. When you ask for the full output, it is
2674 given in addition to the short output.
2677 <section id="SECToverride">
2678 <title>Overriding build-time options for Exim</title>
2680 <indexterm role="concept">
2681 <primary>build-time options, overriding</primary>
2683 The main make file that is created at the beginning of the building process
2684 consists of the concatenation of a number of files which set configuration
2685 values, followed by a fixed set of <emphasis>make</emphasis> instructions. If a value is set
2686 more than once, the last setting overrides any previous ones. This provides a
2687 convenient way of overriding defaults. The files that are concatenated are, in
2691 <filename>OS/Makefile-Default</filename>
2692 <filename>OS/Makefile-</filename><<emphasis>ostype</emphasis>>
2693 <filename>Local/Makefile</filename>
2694 <filename>Local/Makefile-</filename><<emphasis>ostype</emphasis>>
2695 <filename>Local/Makefile-</filename><<emphasis>archtype</emphasis>>
2696 <filename>Local/Makefile-</filename><<emphasis>ostype</emphasis>>-<<emphasis>archtype</emphasis>>
2697 <filename>OS/Makefile-Base</filename>
2700 <indexterm role="concept">
2701 <primary><filename>Local/Makefile</filename></primary>
2703 <indexterm role="concept">
2704 <primary>building Exim</primary>
2705 <secondary>operating system type</secondary>
2707 <indexterm role="concept">
2708 <primary>building Exim</primary>
2709 <secondary>architecture type</secondary>
2711 where <<emphasis>ostype</emphasis>> is the operating system type and <<emphasis>archtype</emphasis>> is the
2712 architecture type. <filename>Local/Makefile</filename> is required to exist, and the building
2713 process fails if it is absent. The other three <filename>Local</filename> files are optional,
2714 and are often not needed.
2717 The values used for <<emphasis>ostype</emphasis>> and <<emphasis>archtype</emphasis>> are obtained from scripts
2718 called <filename>scripts/os-type</filename> and <filename>scripts/arch-type</filename> respectively. If either of
2719 the environment variables EXIM_OSTYPE or EXIM_ARCHTYPE is set, their
2720 values are used, thereby providing a means of forcing particular settings.
2721 Otherwise, the scripts try to get values from the <option>uname</option> command. If this
2722 fails, the shell variables OSTYPE and ARCHTYPE are inspected. A number
2723 of <emphasis>ad hoc</emphasis> transformations are then applied, to produce the standard names
2724 that Exim expects. You can run these scripts directly from the shell in order
2725 to find out what values are being used on your system.
2728 <filename>OS/Makefile-Default</filename> contains comments about the variables that are set
2729 therein. Some (but not all) are mentioned below. If there is something that
2730 needs changing, review the contents of this file and the contents of the make
2731 file for your operating system (<filename>OS/Makefile-<ostype></filename>) to see what the
2735 <indexterm role="concept">
2736 <primary>building Exim</primary>
2737 <secondary>overriding default settings</secondary>
2739 If you need to change any of the values that are set in <filename>OS/Makefile-Default</filename>
2740 or in <filename>OS/Makefile-<ostype></filename>, or to add any new definitions, you do not
2741 need to change the original files. Instead, you should make the changes by
2742 putting the new values in an appropriate <filename>Local</filename> file. For example,
2743 <indexterm role="concept">
2744 <primary>Tru64-Unix build-time settings</primary>
2746 when building Exim in many releases of the Tru64-Unix (formerly Digital UNIX,
2747 formerly DEC-OSF1) operating system, it is necessary to specify that the C
2748 compiler is called <emphasis>cc</emphasis> rather than <emphasis>gcc</emphasis>. Also, the compiler must be
2749 called with the option <option>-std1</option>, to make it recognize some of the features of
2750 Standard C that Exim uses. (Most other compilers recognize Standard C by
2751 default.) To do this, you should create a file called <filename>Local/Makefile-OSF1</filename>
2752 containing the lines
2754 <literallayout class="monospaced">
2759 If you are compiling for just one operating system, it may be easier to put
2760 these lines directly into <filename>Local/Makefile</filename>.
2763 Keeping all your local configuration settings separate from the distributed
2764 files makes it easy to transfer them to new versions of Exim simply by copying
2765 the contents of the <filename>Local</filename> directory.
2768 <indexterm role="concept">
2769 <primary>NIS lookup type</primary>
2770 <secondary>including support for</secondary>
2772 <indexterm role="concept">
2773 <primary>NIS+ lookup type</primary>
2774 <secondary>including support for</secondary>
2776 <indexterm role="concept">
2777 <primary>LDAP</primary>
2778 <secondary>including support for</secondary>
2780 <indexterm role="concept">
2781 <primary>lookup</primary>
2782 <secondary>inclusion in binary</secondary>
2784 Exim contains support for doing LDAP, NIS, NIS+, and other kinds of file
2785 lookup, but not all systems have these components installed, so the default is
2786 not to include the relevant code in the binary. All the different kinds of file
2787 and database lookup that Exim supports are implemented as separate code modules
2788 which are included only if the relevant compile-time options are set. In the
2789 case of LDAP, NIS, and NIS+, the settings for <filename>Local/Makefile</filename> are:
2791 <literallayout class="monospaced">
2797 and similar settings apply to the other lookup types. They are all listed in
2798 <filename>src/EDITME</filename>. In many cases the relevant include files and interface
2799 libraries need to be installed before compiling Exim.
2800 <indexterm role="concept">
2801 <primary>cdb</primary>
2802 <secondary>including support for</secondary>
2804 However, there are some optional lookup types (such as cdb) for which
2805 the code is entirely contained within Exim, and no external include
2806 files or libraries are required. When a lookup type is not included in the
2807 binary, attempts to configure Exim to use it cause run time configuration
2811 <indexterm role="concept">
2812 <primary>Perl</primary>
2813 <secondary>including support for</secondary>
2815 Exim can be linked with an embedded Perl interpreter, allowing Perl
2816 subroutines to be called during string expansion. To enable this facility,
2818 <literallayout class="monospaced">
2822 must be defined in <filename>Local/Makefile</filename>. Details of this facility are given in
2823 chapter <xref linkend="CHAPperl"/>.
2826 <indexterm role="concept">
2827 <primary>X11 libraries, location of</primary>
2829 The location of the X11 libraries is something that varies a lot between
2830 operating systems, and there may be different versions of X11 to cope
2831 with. Exim itself makes no use of X11, but if you are compiling the Exim
2832 monitor, the X11 libraries must be available.
2833 The following three variables are set in <filename>OS/Makefile-Default</filename>:
2835 <literallayout class="monospaced">
2837 XINCLUDE=-I$(X11)/include
2838 XLFLAGS=-L$(X11)/lib
2841 These are overridden in some of the operating-system configuration files. For
2842 example, in <filename>OS/Makefile-SunOS5</filename> there is
2844 <literallayout class="monospaced">
2846 XINCLUDE=-I$(X11)/include
2847 XLFLAGS=-L$(X11)/lib -R$(X11)/lib
2850 If you need to override the default setting for your operating system, place a
2851 definition of all three of these variables into your
2852 <filename>Local/Makefile-<ostype></filename> file.
2855 <indexterm role="concept">
2856 <primary>EXTRALIBS</primary>
2858 If you need to add any extra libraries to the link steps, these can be put in a
2859 variable called EXTRALIBS, which appears in all the link commands, but by
2860 default is not defined. In contrast, EXTRALIBS_EXIM is used only on the
2861 command for linking the main Exim binary, and not for any associated utilities.
2864 <indexterm role="concept">
2865 <primary>DBM libraries</primary>
2866 <secondary>configuration for building</secondary>
2868 There is also DBMLIB, which appears in the link commands for binaries that
2869 use DBM functions (see also section <xref linkend="SECTdb"/>). Finally, there is
2870 EXTRALIBS_EXIMON, which appears only in the link step for the Exim monitor
2871 binary, and which can be used, for example, to include additional X11
2875 <indexterm role="concept">
2876 <primary>configuration file</primary>
2877 <secondary>editing</secondary>
2879 The make file copes with rebuilding Exim correctly if any of the configuration
2880 files are edited. However, if an optional configuration file is deleted, it is
2881 necessary to touch the associated non-optional file (that is,
2882 <filename>Local/Makefile</filename> or <filename>Local/eximon.conf</filename>) before rebuilding.
2885 <section id="SECID30">
2886 <title>OS-specific header files</title>
2888 <indexterm role="concept">
2889 <primary><filename>os.h</filename></primary>
2891 <indexterm role="concept">
2892 <primary>building Exim</primary>
2893 <secondary>OS-specific C header files</secondary>
2895 The <filename>OS</filename> directory contains a number of files with names of the form
2896 <filename>os.h-<ostype></filename>. These are system-specific C header files that should not
2897 normally need to be changed. There is a list of macro settings that are
2898 recognized in the file <filename>OS/os.configuring</filename>, which should be consulted if you
2899 are porting Exim to a new operating system.
2902 <section id="SECID31">
2903 <title>Overriding build-time options for the monitor</title>
2905 <indexterm role="concept">
2906 <primary>building Eximon</primary>
2908 A similar process is used for overriding things when building the Exim monitor,
2909 where the files that are involved are
2912 <filename>OS/eximon.conf-Default</filename>
2913 <filename>OS/eximon.conf-</filename><<emphasis>ostype</emphasis>>
2914 <filename>Local/eximon.conf</filename>
2915 <filename>Local/eximon.conf-</filename><<emphasis>ostype</emphasis>>
2916 <filename>Local/eximon.conf-</filename><<emphasis>archtype</emphasis>>
2917 <filename>Local/eximon.conf-</filename><<emphasis>ostype</emphasis>>-<<emphasis>archtype</emphasis>>
2920 <indexterm role="concept">
2921 <primary><filename>Local/eximon.conf</filename></primary>
2923 As with Exim itself, the final three files need not exist, and in this case the
2924 <filename>OS/eximon.conf-<ostype></filename> file is also optional. The default values in
2925 <filename>OS/eximon.conf-Default</filename> can be overridden dynamically by setting environment
2926 variables of the same name, preceded by EXIMON_. For example, setting
2927 EXIMON_LOG_DEPTH in the environment overrides the value of
2928 LOG_DEPTH at run time.
2929 <indexterm role="concept" startref="IIDbuex" class="endofrange"/>
2932 <section id="SECID32">
2933 <title>Installing Exim binaries and scripts</title>
2935 <indexterm role="concept">
2936 <primary>installing Exim</primary>
2938 <indexterm role="concept">
2939 <primary>BIN_DIRECTORY</primary>
2941 The command <literal>make install</literal> runs the <command>exim_install</command> script with no
2942 arguments. The script copies binaries and utility scripts into the directory
2943 whose name is specified by the BIN_DIRECTORY setting in <filename>Local/Makefile</filename>.
2944 <indexterm role="concept">
2945 <primary>setuid</primary>
2946 <secondary>installing Exim with</secondary>
2948 The install script copies files only if they are newer than the files they are
2949 going to replace. The Exim binary is required to be owned by root and have the
2950 <emphasis>setuid</emphasis> bit set, for normal configurations. Therefore, you must run <literal>make
2951 install</literal> as root so that it can set up the Exim binary in this way. However, in
2952 some special situations (for example, if a host is doing no local deliveries)
2953 it may be possible to run Exim without making the binary setuid root (see
2954 chapter <xref linkend="CHAPsecurity"/> for details).
2957 <indexterm role="concept">
2958 <primary>CONFIGURE_FILE</primary>
2960 Exim’s run time configuration file is named by the CONFIGURE_FILE setting
2961 in <filename>Local/Makefile</filename>. If this names a single file, and the file does not
2962 exist, the default configuration file <filename>src/configure.default</filename> is copied there
2963 by the installation script. If a run time configuration file already exists, it
2964 is left alone. If CONFIGURE_FILE is a colon-separated list, naming several
2965 alternative files, no default is installed.
2968 <indexterm role="concept">
2969 <primary>system aliases file</primary>
2971 <indexterm role="concept">
2972 <primary><filename>/etc/aliases</filename></primary>
2974 One change is made to the default configuration file when it is installed: the
2975 default configuration contains a router that references a system aliases file.
2976 The path to this file is set to the value specified by
2977 SYSTEM_ALIASES_FILE in <filename>Local/Makefile</filename> (<filename>/etc/aliases</filename> by default).
2978 If the system aliases file does not exist, the installation script creates it,
2979 and outputs a comment to the user.
2982 The created file contains no aliases, but it does contain comments about the
2983 aliases a site should normally have. Mail aliases have traditionally been
2984 kept in <filename>/etc/aliases</filename>. However, some operating systems are now using
2985 <filename>/etc/mail/aliases</filename>. You should check if yours is one of these, and change
2986 Exim’s configuration if necessary.
2989 The default configuration uses the local host’s name as the only local domain,
2990 and is set up to do local deliveries into the shared directory <filename>/var/mail</filename>,
2991 running as the local user. System aliases and <filename>.forward</filename> files in users’ home
2992 directories are supported, but no NIS or NIS+ support is configured. Domains
2993 other than the name of the local host are routed using the DNS, with delivery
2997 It is possible to install Exim for special purposes (such as building a binary
2998 distribution) in a private part of the file system. You can do this by a
3001 <literallayout class="monospaced">
3002 make DESTDIR=/some/directory/ install
3005 This has the effect of pre-pending the specified directory to all the file
3006 paths, except the name of the system aliases file that appears in the default
3007 configuration. (If a default alias file is created, its name <emphasis>is</emphasis> modified.)
3008 For backwards compatibility, ROOT is used if DESTDIR is not set,
3009 but this usage is deprecated.
3011 <para revisionflag="changed">
3012 <indexterm role="concept">
3013 <primary>installing Exim</primary>
3014 <secondary>what is not installed</secondary>
3016 Running <emphasis>make install</emphasis> does not copy the Exim 4 conversion script
3017 <emphasis>convert4r4</emphasis>. You will probably run this only once if you are
3018 upgrading from Exim 3. None of the documentation files in the <filename>doc</filename>
3019 directory are copied, except for the info files when you have set
3020 INFO_DIRECTORY, as described in section <xref linkend="SECTinsinfdoc"/> below.
3023 For the utility programs, old versions are renamed by adding the suffix <filename>.O</filename>
3024 to their names. The Exim binary itself, however, is handled differently. It is
3025 installed under a name that includes the version number and the compile number,
3026 for example <filename>exim-4.71-1</filename>. The script then arranges for a symbolic link
3027 called <filename>exim</filename> to point to the binary. If you are updating a previous version
3028 of Exim, the script takes care to ensure that the name <filename>exim</filename> is never absent
3029 from the directory (as seen by other processes).
3032 <indexterm role="concept">
3033 <primary>installing Exim</primary>
3034 <secondary>testing the script</secondary>
3036 If you want to see what the <emphasis>make install</emphasis> will do before running it for
3037 real, you can pass the <option>-n</option> option to the installation script by this
3040 <literallayout class="monospaced">
3041 make INSTALL_ARG=-n install
3044 The contents of the variable INSTALL_ARG are passed to the installation
3045 script. You do not need to be root to run this test. Alternatively, you can run
3046 the installation script directly, but this must be from within the build
3047 directory. For example, from the top-level Exim directory you could use this
3050 <literallayout class="monospaced">
3051 (cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n)
3054 <indexterm role="concept">
3055 <primary>installing Exim</primary>
3056 <secondary>install script options</secondary>
3058 There are two other options that can be supplied to the installation script.
3063 <option>-no_chown</option> bypasses the call to change the owner of the installed binary
3064 to root, and the call to make it a setuid binary.
3069 <option>-no_symlink</option> bypasses the setting up of the symbolic link <filename>exim</filename> to the
3075 INSTALL_ARG can be used to pass these options to the script. For example:
3077 <literallayout class="monospaced">
3078 make INSTALL_ARG=-no_symlink install
3081 The installation script can also be given arguments specifying which files are
3082 to be copied. For example, to install just the Exim binary, and nothing else,
3083 without creating the symbolic link, you could use:
3085 <literallayout class="monospaced">
3086 make INSTALL_ARG='-no_symlink exim' install
3089 <section id="SECTinsinfdoc">
3090 <title>Installing info documentation</title>
3092 <indexterm role="concept">
3093 <primary>installing Exim</primary>
3094 <secondary><emphasis>info</emphasis> documentation</secondary>
3096 Not all systems use the GNU <emphasis>info</emphasis> system for documentation, and for this
3097 reason, the Texinfo source of Exim’s documentation is not included in the main
3098 distribution. Instead it is available separately from the ftp site (see section
3099 <xref linkend="SECTavail"/>).
3102 If you have defined INFO_DIRECTORY in <filename>Local/Makefile</filename> and the Texinfo
3103 source of the documentation is found in the source tree, running <literal>make
3104 install</literal> automatically builds the info files and installs them.
3107 <section id="SECID33">
3108 <title>Setting up the spool directory</title>
3110 <indexterm role="concept">
3111 <primary>spool directory</primary>
3112 <secondary>creating</secondary>
3114 When it starts up, Exim tries to create its spool directory if it does not
3115 exist. The Exim uid and gid are used for the owner and group of the spool
3116 directory. Sub-directories are automatically created in the spool directory as
3120 <section id="SECID34">
3121 <title>Testing</title>
3123 <indexterm role="concept">
3124 <primary>testing</primary>
3125 <secondary>installation</secondary>
3127 Having installed Exim, you can check that the run time configuration file is
3128 syntactically valid by running the following command, which assumes that the
3129 Exim binary directory is within your PATH environment variable:
3131 <literallayout class="monospaced">
3135 If there are any errors in the configuration file, Exim outputs error messages.
3136 Otherwise it outputs the version number and build date,
3137 the DBM library that is being used, and information about which drivers and
3138 other optional code modules are included in the binary.
3139 Some simple routing tests can be done by using the address testing option. For
3143 <literal>exim -bt</literal> <<emphasis>local username</emphasis>>
3146 should verify that it recognizes a local mailbox, and
3149 <literal>exim -bt</literal> <<emphasis>remote address</emphasis>>
3152 a remote one. Then try getting it to deliver mail, both locally and remotely.
3153 This can be done by passing messages directly to Exim, without going through a
3154 user agent. For example:
3156 <literallayout class="monospaced">
3157 exim -v postmaster@your.domain.example
3158 From: user@your.domain.example
3159 To: postmaster@your.domain.example
3160 Subject: Testing Exim
3162 This is a test message.
3166 The <option>-v</option> option causes Exim to output some verification of what it is doing.
3167 In this case you should see copies of three log lines, one for the message’s
3168 arrival, one for its delivery, and one containing <quote>Completed</quote>.
3171 <indexterm role="concept">
3172 <primary>delivery</primary>
3173 <secondary>problems with</secondary>
3175 If you encounter problems, look at Exim’s log files (<emphasis>mainlog</emphasis> and
3176 <emphasis>paniclog</emphasis>) to see if there is any relevant information there. Another source
3177 of information is running Exim with debugging turned on, by specifying the
3178 <option>-d</option> option. If a message is stuck on Exim’s spool, you can force a delivery
3179 with debugging turned on by a command of the form
3182 <literal>exim -d -M</literal> <<emphasis>exim-message-id</emphasis>>
3185 You must be root or an <quote>admin user</quote> in order to do this. The <option>-d</option> option
3186 produces rather a lot of output, but you can cut this down to specific areas.
3187 For example, if you use <option>-d-all+route</option> only the debugging information
3188 relevant to routing is included. (See the <option>-d</option> option in chapter
3189 <xref linkend="CHAPcommandline"/> for more details.)
3192 <indexterm role="concept">
3193 <primary><quote>sticky</quote> bit</primary>
3195 <indexterm role="concept">
3196 <primary>lock files</primary>
3198 One specific problem that has shown up on some sites is the inability to do
3199 local deliveries into a shared mailbox directory, because it does not have the
3200 <quote>sticky bit</quote> set on it. By default, Exim tries to create a lock file before
3201 writing to a mailbox file, and if it cannot create the lock file, the delivery
3202 is deferred. You can get round this either by setting the <quote>sticky bit</quote> on the
3203 directory, or by setting a specific group for local deliveries and allowing
3204 that group to create files in the directory (see the comments above the
3205 <command>local_delivery</command> transport in the default configuration file). Another
3206 approach is to configure Exim not to use lock files, but just to rely on
3207 <function>fcntl()</function> locking instead. However, you should do this only if all user
3208 agents also use <function>fcntl()</function> locking. For further discussion of locking issues,
3209 see chapter <xref linkend="CHAPappendfile"/>.
3212 One thing that cannot be tested on a system that is already running an MTA is
3213 the receipt of incoming SMTP mail on the standard SMTP port. However, the
3214 <option>-oX</option> option can be used to run an Exim daemon that listens on some other
3215 port, or <emphasis>inetd</emphasis> can be used to do this. The <option>-bh</option> option and the
3216 <emphasis>exim_checkaccess</emphasis> utility can be used to check out policy controls on
3220 Testing a new version on a system that is already running Exim can most easily
3221 be done by building a binary with a different CONFIGURE_FILE setting. From
3222 within the run time configuration, all other file and directory names
3223 that Exim uses can be altered, in order to keep it entirely clear of the
3227 <section id="SECID35">
3228 <title>Replacing another MTA with Exim</title>
3230 <indexterm role="concept">
3231 <primary>replacing another MTA</primary>
3233 Building and installing Exim for the first time does not of itself put it in
3234 general use. The name by which the system’s MTA is called by mail user agents
3235 is either <filename>/usr/sbin/sendmail</filename>, or <filename>/usr/lib/sendmail</filename> (depending on the
3236 operating system), and it is necessary to make this name point to the <emphasis>exim</emphasis>
3237 binary in order to get the user agents to pass messages to Exim. This is
3238 normally done by renaming any existing file and making <filename>/usr/sbin/sendmail</filename>
3239 or <filename>/usr/lib/sendmail</filename>
3240 <indexterm role="concept">
3241 <primary>symbolic link</primary>
3242 <secondary>to <emphasis>exim</emphasis> binary</secondary>
3244 a symbolic link to the <emphasis>exim</emphasis> binary. It is a good idea to remove any setuid
3245 privilege and executable status from the old MTA. It is then necessary to stop
3246 and restart the mailer daemon, if one is running.
3249 <indexterm role="concept">
3250 <primary>FreeBSD, MTA indirection</primary>
3252 <indexterm role="concept">
3253 <primary><filename>/etc/mail/mailer.conf</filename></primary>
3255 Some operating systems have introduced alternative ways of switching MTAs. For
3256 example, if you are running FreeBSD, you need to edit the file
3257 <filename>/etc/mail/mailer.conf</filename> instead of setting up a symbolic link as just
3258 described. A typical example of the contents of this file for running Exim is
3261 <literallayout class="monospaced">
3262 sendmail /usr/exim/bin/exim
3263 send-mail /usr/exim/bin/exim
3264 mailq /usr/exim/bin/exim -bp
3265 newaliases /usr/bin/true
3268 Once you have set up the symbolic link, or edited <filename>/etc/mail/mailer.conf</filename>,
3269 your Exim installation is <quote>live</quote>. Check it by sending a message from your
3270 favourite user agent.
3273 You should consider what to tell your users about the change of MTA. Exim may
3274 have different capabilities to what was previously running, and there are
3275 various operational differences such as the text of messages produced by
3276 command line options and in bounce messages. If you allow your users to make
3277 use of Exim’s filtering capabilities, you should make the document entitled
3278 <emphasis>Exim’s interface to mail filtering</emphasis> available to them.
3281 <section id="SECID36">
3282 <title>Upgrading Exim</title>
3284 <indexterm role="concept">
3285 <primary>upgrading Exim</primary>
3287 If you are already running Exim on your host, building and installing a new
3288 version automatically makes it available to MUAs, or any other programs that
3289 call the MTA directly. However, if you are running an Exim daemon, you do need
3290 to send it a HUP signal, to make it re-execute itself, and thereby pick up the
3291 new binary. You do not need to stop processing mail in order to install a new
3292 version of Exim. The install script does not modify an existing runtime
3296 <section id="SECID37">
3297 <title>Stopping the Exim daemon on Solaris</title>
3299 <indexterm role="concept">
3300 <primary>Solaris</primary>
3301 <secondary>stopping Exim on</secondary>
3303 The standard command for stopping the mailer daemon on Solaris is
3305 <literallayout class="monospaced">
3306 /etc/init.d/sendmail stop
3309 If <filename>/usr/lib/sendmail</filename> has been turned into a symbolic link, this script
3310 fails to stop Exim because it uses the command <emphasis>ps -e</emphasis> and greps the output
3311 for the text <quote>sendmail</quote>; this is not present because the actual program name
3312 (that is, <quote>exim</quote>) is given by the <emphasis>ps</emphasis> command with these options. A
3313 solution is to replace the line that finds the process id with something like
3315 <literallayout class="monospaced">
3316 pid=`cat /var/spool/exim/exim-daemon.pid`
3319 to obtain the daemon’s pid directly from the file that Exim saves it in.
3322 Note, however, that stopping the daemon does not <quote>stop Exim</quote>. Messages can
3323 still be received from local processes, and if automatic delivery is configured
3324 (the normal case), deliveries will still occur.
3329 <chapter id="CHAPcommandline">
3330 <title>The Exim command line</title>
3332 <indexterm role="concept" id="IIDclo1" class="startofrange">
3333 <primary>command line</primary>
3334 <secondary>options</secondary>
3336 <indexterm role="concept" id="IIDclo2" class="startofrange">
3337 <primary>options</primary>
3338 <secondary>command line</secondary>
3340 Exim’s command line takes the standard Unix form of a sequence of options,
3341 each starting with a hyphen character, followed by a number of arguments. The
3342 options are compatible with the main options of Sendmail, and there are also
3343 some additional options, some of which are compatible with Smail 3. Certain
3344 combinations of options do not make sense, and provoke an error if used.
3345 The form of the arguments depends on which options are set.
3347 <section id="SECID38">
3348 <title>Setting options by program name</title>
3350 <indexterm role="concept">
3351 <primary><emphasis>mailq</emphasis></primary>
3353 If Exim is called under the name <emphasis>mailq</emphasis>, it behaves as if the option <option>-bp</option>
3354 were present before any other options.
3355 The <option>-bp</option> option requests a listing of the contents of the mail queue on the
3357 This feature is for compatibility with some systems that contain a command of
3358 that name in one of the standard libraries, symbolically linked to
3359 <filename>/usr/sbin/sendmail</filename> or <filename>/usr/lib/sendmail</filename>.
3362 <indexterm role="concept">
3363 <primary><emphasis>rsmtp</emphasis></primary>
3365 If Exim is called under the name <emphasis>rsmtp</emphasis> it behaves as if the option <option>-bS</option>
3366 were present before any other options, for compatibility with Smail. The
3367 <option>-bS</option> option is used for reading in a number of messages in batched SMTP
3371 <indexterm role="concept">
3372 <primary><emphasis>rmail</emphasis></primary>
3374 If Exim is called under the name <emphasis>rmail</emphasis> it behaves as if the <option>-i</option> and
3375 <option>-oee</option> options were present before any other options, for compatibility with
3376 Smail. The name <emphasis>rmail</emphasis> is used as an interface by some UUCP systems.
3379 <indexterm role="concept">
3380 <primary><emphasis>runq</emphasis></primary>
3382 <indexterm role="concept">
3383 <primary>queue runner</primary>
3385 If Exim is called under the name <emphasis>runq</emphasis> it behaves as if the option <option>-q</option>
3386 were present before any other options, for compatibility with Smail. The <option>-q</option>
3387 option causes a single queue runner process to be started.
3390 <indexterm role="concept">
3391 <primary><emphasis>newaliases</emphasis></primary>
3393 <indexterm role="concept">
3394 <primary>alias file</primary>
3395 <secondary>building</secondary>
3397 <indexterm role="concept">
3398 <primary>Sendmail compatibility</primary>
3399 <secondary>calling Exim as <emphasis>newaliases</emphasis></secondary>
3401 If Exim is called under the name <emphasis>newaliases</emphasis> it behaves as if the option
3402 <option>-bi</option> were present before any other options, for compatibility with Sendmail.
3403 This option is used for rebuilding Sendmail’s alias file. Exim does not have
3404 the concept of a single alias file, but can be configured to run a given
3405 command if called with the <option>-bi</option> option.
3408 <section id="SECTtrustedadmin">
3409 <title>Trusted and admin users</title>
3411 Some Exim options are available only to <emphasis>trusted users</emphasis> and others are
3412 available only to <emphasis>admin users</emphasis>. In the description below, the phrases <quote>Exim
3413 user</quote> and <quote>Exim group</quote> mean the user and group defined by EXIM_USER and
3414 EXIM_GROUP in <filename>Local/Makefile</filename> or set by the <option>exim_user</option> and
3415 <option>exim_group</option> options. These do not necessarily have to use the name <quote>exim</quote>.
3420 <indexterm role="concept">
3421 <primary>trusted users</primary>
3422 <secondary>definition of</secondary>
3424 <indexterm role="concept">
3425 <primary>user</primary>
3426 <secondary>trusted definition of</secondary>
3428 The trusted users are root, the Exim user, any user listed in the
3429 <option>trusted_users</option> configuration option, and any user whose current group or any
3430 supplementary group is one of those listed in the <option>trusted_groups</option>
3431 configuration option. Note that the Exim group is not automatically trusted.
3434 <indexterm role="concept">
3435 <primary><quote>From</quote> line</primary>
3437 <indexterm role="concept">
3438 <primary>envelope sender</primary>
3440 Trusted users are always permitted to use the <option>-f</option> option or a leading
3441 <quote>From </quote> line to specify the envelope sender of a message that is passed to
3442 Exim through the local interface (see the <option>-bm</option> and <option>-f</option> options below).
3443 See the <option>untrusted_set_sender</option> option for a way of permitting non-trusted
3444 users to set envelope senders.
3447 <indexterm role="concept">
3448 <primary><emphasis>From:</emphasis> header line</primary>
3450 <indexterm role="concept">
3451 <primary><emphasis>Sender:</emphasis> header line</primary>
3453 For a trusted user, there is never any check on the contents of the <emphasis>From:</emphasis>
3454 header line, and a <emphasis>Sender:</emphasis> line is never added. Furthermore, any existing
3455 <emphasis>Sender:</emphasis> line in incoming local (non-TCP/IP) messages is not removed.
3458 Trusted users may also specify a host name, host address, interface address,
3459 protocol name, ident value, and authentication data when submitting a message
3460 locally. Thus, they are able to insert messages into Exim’s queue locally that
3461 have the characteristics of messages received from a remote host. Untrusted
3462 users may in some circumstances use <option>-f</option>, but can never set the other values
3463 that are available to trusted users.
3468 <indexterm role="concept">
3469 <primary>user</primary>
3470 <secondary>admin definition of</secondary>
3472 <indexterm role="concept">
3473 <primary>admin user</primary>
3474 <secondary>definition of</secondary>
3476 The admin users are root, the Exim user, and any user that is a member of the
3477 Exim group or of any group listed in the <option>admin_groups</option> configuration option.
3478 The current group does not have to be one of these groups.
3481 Admin users are permitted to list the queue, and to carry out certain
3482 operations on messages, for example, to force delivery failures. It is also
3483 necessary to be an admin user in order to see the full information provided by
3484 the Exim monitor, and full debugging output.
3487 By default, the use of the <option>-M</option>, <option>-q</option>, <option>-R</option>, and <option>-S</option> options to cause
3488 Exim to attempt delivery of messages on its queue is restricted to admin users.
3489 However, this restriction can be relaxed by setting the <option>prod_requires_admin</option>
3490 option false (that is, specifying <option>no_prod_requires_admin</option>).
3493 Similarly, the use of the <option>-bp</option> option to list all the messages in the queue
3494 is restricted to admin users unless <option>queue_list_requires_admin</option> is set
3500 <emphasis role="bold">Warning</emphasis>: If you configure your system so that admin users are able to
3501 edit Exim’s configuration file, you are giving those users an easy way of
3502 getting root. There is further discussion of this issue at the start of chapter
3503 <xref linkend="CHAPconf"/>.
3506 <section id="SECID39">
3507 <title>Command line options</title>
3509 Exim’s command line options are described in alphabetical order below. If none
3510 of the options that specifies a specific action (such as starting the daemon or
3511 a queue runner, or testing an address, or receiving a message in a specific
3512 format, or listing the queue) are present, and there is at least one argument
3513 on the command line, <option>-bm</option> (accept a local message on the standard input,
3514 with the arguments specifying the recipients) is assumed. Otherwise, Exim
3515 outputs a brief message about itself and exits.
3517 <!-- === Start of command line options === -->
3520 <term><option>--</option></term>
3523 <indexterm role="option">
3524 <primary>--</primary>
3526 <indexterm role="concept">
3527 <primary>options</primary>
3528 <secondary>command line; terminating</secondary>
3530 This is a pseudo-option whose only purpose is to terminate the options and
3531 therefore to cause subsequent command line items to be treated as arguments
3532 rather than options, even if they begin with hyphens.
3534 </listitem></varlistentry>
3536 <term><option>--help</option></term>
3539 <indexterm role="option">
3540 <primary><option>--help</option></primary>
3542 This option causes Exim to output a few sentences stating what it is.
3543 The same output is generated if the Exim binary is called with no options and
3546 </listitem></varlistentry>
3548 <term><option>-B</option><<emphasis>type</emphasis>></term>
3551 <indexterm role="option">
3552 <primary><option>-B</option></primary>
3554 <indexterm role="concept">
3555 <primary>8-bit characters</primary>
3557 <indexterm role="concept">
3558 <primary>Sendmail compatibility</primary>
3559 <secondary>8-bit characters</secondary>
3561 This is a Sendmail option for selecting 7 or 8 bit processing. Exim is 8-bit
3562 clean; it ignores this option.
3564 </listitem></varlistentry>
3566 <term><option>-bd</option></term>
3569 <indexterm role="option">
3570 <primary><option>-bd</option></primary>
3572 <indexterm role="concept">
3573 <primary>daemon</primary>
3575 <indexterm role="concept">
3576 <primary>SMTP</primary>
3577 <secondary>listener</secondary>
3579 <indexterm role="concept">
3580 <primary>queue runner</primary>
3582 This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually
3583 the <option>-bd</option> option is combined with the <option>-q</option><<emphasis>time</emphasis>> option, to specify
3584 that the daemon should also initiate periodic queue runs.
3587 The <option>-bd</option> option can be used only by an admin user. If either of the <option>-d</option>
3588 (debugging) or <option>-v</option> (verifying) options are set, the daemon does not
3589 disconnect from the controlling terminal. When running this way, it can be
3590 stopped by pressing ctrl-C.
3593 By default, Exim listens for incoming connections to the standard SMTP port on
3594 all the host’s running interfaces. However, it is possible to listen on other
3595 ports, on multiple ports, and only on specific interfaces. Chapter
3596 <xref linkend="CHAPinterfaces"/> contains a description of the options that control this.
3599 When a listening daemon
3600 <indexterm role="concept">
3601 <primary>daemon</primary>
3602 <secondary>process id (pid)</secondary>
3604 <indexterm role="concept">
3605 <primary>pid (process id)</primary>
3606 <secondary>of daemon</secondary>
3608 is started without the use of <option>-oX</option> (that is, without overriding the normal
3609 configuration), it writes its process id to a file called <filename>exim-daemon.pid</filename>
3610 in Exim’s spool directory. This location can be overridden by setting
3611 PID_FILE_PATH in <filename>Local/Makefile</filename>. The file is written while Exim is still
3615 When <option>-oX</option> is used on the command line to start a listening daemon, the
3616 process id is not written to the normal pid file path. However, <option>-oP</option> can be
3617 used to specify a path on the command line if a pid file is required.
3621 <indexterm role="concept">
3622 <primary>SIGHUP</primary>
3624 <indexterm role="concept">
3625 <primary>daemon</primary>
3626 <secondary>restarting</secondary>
3628 can be used to cause the daemon to re-execute itself. This should be done
3629 whenever Exim’s configuration file, or any file that is incorporated into it by
3630 means of the <option>.include</option> facility, is changed, and also whenever a new version
3631 of Exim is installed. It is not necessary to do this when other files that are
3632 referenced from the configuration (for example, alias files) are changed,
3633 because these are reread each time they are used.
3635 </listitem></varlistentry>
3637 <term><option>-bdf</option></term>
3640 <indexterm role="option">
3641 <primary><option>-bdf</option></primary>
3643 This option has the same effect as <option>-bd</option> except that it never disconnects
3644 from the controlling terminal, even when no debugging is specified.
3646 </listitem></varlistentry>
3648 <term><option>-be</option></term>
3651 <indexterm role="option">
3652 <primary><option>-be</option></primary>
3654 <indexterm role="concept">
3655 <primary>testing</primary>
3656 <secondary>string expansion</secondary>
3658 <indexterm role="concept">
3659 <primary>expansion</primary>
3660 <secondary>testing</secondary>
3662 Run Exim in expansion testing mode. Exim discards its root privilege, to
3663 prevent ordinary users from using this mode to read otherwise inaccessible
3664 files. If no arguments are given, Exim runs interactively, prompting for lines
3665 of data. Otherwise, it processes each argument in turn.
3668 If Exim was built with USE_READLINE=yes in <filename>Local/Makefile</filename>, it tries
3669 to load the <option>libreadline</option> library dynamically whenever the <option>-be</option> option is
3670 used without command line arguments. If successful, it uses the <function>readline()</function>
3671 function, which provides extensive line-editing facilities, for reading the
3672 test data. A line history is supported.
3675 Long expansion expressions can be split over several lines by using backslash
3676 continuations. As in Exim’s run time configuration, white space at the start of
3677 continuation lines is ignored. Each argument or data line is passed through the
3678 string expansion mechanism, and the result is output. Variable values from the
3679 configuration file (for example, <varname>$qualify_domain</varname>) are available, but no
3680 message-specific values (such as <varname>$sender_domain</varname>) are set, because no message
3681 is being processed (but see <option>-bem</option> and <option>-Mset</option>).
3684 <emphasis role="bold">Note</emphasis>: If you use this mechanism to test lookups, and you change the data
3685 files or databases you are using, you must exit and restart Exim before trying
3686 the same lookup again. Otherwise, because each Exim process caches the results
3687 of lookups, you will just get the same result as before.
3689 </listitem></varlistentry>
3691 <term><option>-bem</option> <<emphasis>filename</emphasis>></term>
3694 <indexterm role="option">
3695 <primary><option>-bem</option></primary>
3697 <indexterm role="concept">
3698 <primary>testing</primary>
3699 <secondary>string expansion</secondary>
3701 <indexterm role="concept">
3702 <primary>expansion</primary>
3703 <secondary>testing</secondary>
3705 This option operates like <option>-be</option> except that it must be followed by the name
3706 of a file. For example:
3708 <literallayout class="monospaced">
3709 exim -bem /tmp/testmessage
3712 The file is read as a message (as if receiving a locally-submitted non-SMTP
3713 message) before any of the test expansions are done. Thus, message-specific
3714 variables such as <varname>$message_size</varname> and <varname>$header_from:</varname> are available. However,
3715 no <emphasis>Received:</emphasis> header is added to the message. If the <option>-t</option> option is set,
3716 recipients are read from the headers in the normal way, and are shown in the
3717 <varname>$recipients</varname> variable. Note that recipients cannot be given on the command
3718 line, because further arguments are taken as strings to expand (just like
3719 <option>-be</option>).
3721 </listitem></varlistentry>
3723 <term><option>-bF</option> <<emphasis>filename</emphasis>></term>
3726 <indexterm role="option">
3727 <primary><option>-bF</option></primary>
3729 <indexterm role="concept">
3730 <primary>system filter</primary>
3731 <secondary>testing</secondary>
3733 <indexterm role="concept">
3734 <primary>testing</primary>
3735 <secondary>system filter</secondary>
3737 This option is the same as <option>-bf</option> except that it assumes that the filter being
3738 tested is a system filter. The additional commands that are available only in
3739 system filters are recognized.
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>filter</primary>
3751 <secondary>testing</secondary>
3753 <indexterm role="concept">
3754 <primary>testing</primary>
3755 <secondary>filter file</secondary>
3757 <indexterm role="concept">
3758 <primary>forward file</primary>
3759 <secondary>testing</secondary>
3761 <indexterm role="concept">
3762 <primary>testing</primary>
3763 <secondary>forward file</secondary>
3765 <indexterm role="concept">
3766 <primary>Sieve filter</primary>
3767 <secondary>testing</secondary>
3769 This option runs Exim in user filter testing mode; the file is the filter file
3770 to be tested, and a test message must be supplied on the standard input. If
3771 there are no message-dependent tests in the filter, an empty file can be
3775 If you want to test a system filter file, use <option>-bF</option> instead of <option>-bf</option>. You
3776 can use both <option>-bF</option> and <option>-bf</option> on the same command, in order to test a system
3777 filter and a user filter in the same run. For example:
3779 <literallayout class="monospaced">
3780 exim -bF /system/filter -bf /user/filter </test/message
3783 This is helpful when the system filter adds header lines or sets filter
3784 variables that are used by the user filter.
3787 If the test filter file does not begin with one of the special lines
3789 <literallayout class="monospaced">
3794 it is taken to be a normal <filename>.forward</filename> file, and is tested for validity under
3795 that interpretation. See sections <xref linkend="SECTitenonfilred"/> to
3796 <xref linkend="SECTspecitredli"/> for a description of the possible contents of non-filter
3800 The result of an Exim command that uses <option>-bf</option>, provided no errors are
3801 detected, is a list of the actions that Exim would try to take if presented
3802 with the message for real. More details of filter testing are given in the
3803 separate document entitled <emphasis>Exim’s interfaces to mail filtering</emphasis>.
3806 When testing a filter file,
3807 <indexterm role="concept">
3808 <primary><quote>From</quote> line</primary>
3810 <indexterm role="concept">
3811 <primary>envelope sender</primary>
3813 <indexterm role="option">
3814 <primary><option>-f</option></primary>
3815 <secondary>for filter testing</secondary>
3817 the envelope sender can be set by the <option>-f</option> option,
3818 or by a <quote>From </quote> line at the start of the test message. Various parameters
3819 that would normally be taken from the envelope recipient address of the message
3820 can be set by means of additional command line options (see the next four
3823 </listitem></varlistentry>
3825 <term><option>-bfd</option> <<emphasis>domain</emphasis>></term>
3828 <indexterm role="option">
3829 <primary><option>-bfd</option></primary>
3831 <indexterm role="variable">
3832 <primary><varname>$qualify_domain</varname></primary>
3834 This sets the domain of the recipient address when a filter file is being
3835 tested by means of the <option>-bf</option> option. The default is the value of
3836 <varname>$qualify_domain</varname>.
3838 </listitem></varlistentry>
3840 <term><option>-bfl</option> <<emphasis>local part</emphasis>></term>
3843 <indexterm role="option">
3844 <primary><option>-bfl</option></primary>
3846 This sets the local part of the recipient address when a filter file is being
3847 tested by means of the <option>-bf</option> option. The default is the username of the
3848 process that calls Exim. A local part should be specified with any prefix or
3849 suffix stripped, because that is how it appears to the filter when a message is
3850 actually being delivered.
3852 </listitem></varlistentry>
3854 <term><option>-bfp</option> <<emphasis>prefix</emphasis>></term>
3857 <indexterm role="option">
3858 <primary><option>-bfp</option></primary>
3860 This sets the prefix of the local part of the recipient address when a filter
3861 file is being tested by means of the <option>-bf</option> option. The default is an empty
3864 </listitem></varlistentry>
3866 <term><option>-bfs</option> <<emphasis>suffix</emphasis>></term>
3869 <indexterm role="option">
3870 <primary><option>-bfs</option></primary>
3872 This sets the suffix of the local part of the recipient address when a filter
3873 file is being tested by means of the <option>-bf</option> option. The default is an empty
3876 </listitem></varlistentry>
3878 <term><option>-bh</option> <<emphasis>IP address</emphasis>></term>
3881 <indexterm role="option">
3882 <primary><option>-bh</option></primary>
3884 <indexterm role="concept">
3885 <primary>testing</primary>
3886 <secondary>incoming SMTP</secondary>
3888 <indexterm role="concept">
3889 <primary>SMTP</primary>
3890 <secondary>testing incoming</secondary>
3892 <indexterm role="concept">
3893 <primary>testing</primary>
3894 <secondary>relay control</secondary>
3896 <indexterm role="concept">
3897 <primary>relaying</primary>
3898 <secondary>testing configuration</secondary>
3900 <indexterm role="concept">
3901 <primary>policy control</primary>
3902 <secondary>testing</secondary>
3904 <indexterm role="concept">
3905 <primary>debugging</primary>
3906 <secondary><option>-bh</option> option</secondary>
3908 This option runs a fake SMTP session as if from the given IP address, using the
3909 standard input and output. The IP address may include a port number at the end,
3910 after a full stop. For example:
3912 <literallayout class="monospaced">
3913 exim -bh 10.9.8.7.1234
3914 exim -bh fe80::a00:20ff:fe86:a061.5678
3917 When an IPv6 address is given, it is converted into canonical form. In the case
3918 of the second example above, the value of <varname>$sender_host_address</varname> after
3919 conversion to the canonical form is
3920 <literal>fe80:0000:0000:0a00:20ff:fe86:a061.5678</literal>.
3923 Comments as to what is going on are written to the standard error file. These
3924 include lines beginning with <quote>LOG</quote> for anything that would have been logged.
3925 This facility is provided for testing configuration options for incoming
3926 messages, to make sure they implement the required policy. For example, you can
3927 test your relay controls using <option>-bh</option>.
3930 <emphasis role="bold">Warning 1</emphasis>:
3931 <indexterm role="concept">
3932 <primary>RFC 1413</primary>
3934 You can test features of the configuration that rely on ident (RFC 1413)
3935 information by using the <option>-oMt</option> option. However, Exim cannot actually perform
3936 an ident callout when testing using <option>-bh</option> because there is no incoming SMTP
3940 <emphasis role="bold">Warning 2</emphasis>: Address verification callouts (see section <xref linkend="SECTcallver"/>)
3941 are also skipped when testing using <option>-bh</option>. If you want these callouts to
3942 occur, use <option>-bhc</option> instead.
3945 Messages supplied during the testing session are discarded, and nothing is
3946 written to any of the real log files. There may be pauses when DNS (and other)
3947 lookups are taking place, and of course these may time out. The <option>-oMi</option> option
3948 can be used to specify a specific IP interface and port if this is important,
3949 and <option>-oMaa</option> and <option>-oMai</option> can be used to set parameters as if the SMTP
3950 session were authenticated.
3953 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option> whose
3954 output just states whether a given recipient address from a given host is
3955 acceptable or not. See section <xref linkend="SECTcheckaccess"/>.
3958 Features such as authentication and encryption, where the client input is not
3959 plain text, cannot easily be tested with <option>-bh</option>. Instead, you should use a
3960 specialized SMTP test program such as
3961 <emphasis role="bold"><ulink url="http://jetmore.org/john/code/#swaks">swaks</ulink></emphasis>.
3963 </listitem></varlistentry>
3965 <term><option>-bhc</option> <<emphasis>IP address</emphasis>></term>
3968 <indexterm role="option">
3969 <primary><option>-bhc</option></primary>
3971 This option operates in the same way as <option>-bh</option>, except that address
3972 verification callouts are performed if required. This includes consulting and
3973 updating the callout cache database.
3975 </listitem></varlistentry>
3977 <term><option>-bi</option></term>
3980 <indexterm role="option">
3981 <primary><option>-bi</option></primary>
3983 <indexterm role="concept">
3984 <primary>alias file</primary>
3985 <secondary>building</secondary>
3987 <indexterm role="concept">
3988 <primary>building alias file</primary>
3990 <indexterm role="concept">
3991 <primary>Sendmail compatibility</primary>
3992 <secondary><option>-bi</option> option</secondary>
3994 Sendmail interprets the <option>-bi</option> option as a request to rebuild its alias file.
3995 Exim does not have the concept of a single alias file, and so it cannot mimic
3996 this behaviour. However, calls to <filename>/usr/lib/sendmail</filename> with the <option>-bi</option> option
3997 tend to appear in various scripts such as NIS make files, so the option must be
4001 If <option>-bi</option> is encountered, the command specified by the <option>bi_command</option>
4002 configuration option is run, under the uid and gid of the caller of Exim. If
4003 the <option>-oA</option> option is used, its value is passed to the command as an argument.
4004 The command set by <option>bi_command</option> may not contain arguments. The command can
4005 use the <emphasis>exim_dbmbuild</emphasis> utility, or some other means, to rebuild alias files
4006 if this is required. If the <option>bi_command</option> option is not set, calling Exim with
4007 <option>-bi</option> is a no-op.
4009 </listitem></varlistentry>
4011 <term><option>-bm</option></term>
4014 <indexterm role="option">
4015 <primary><option>-bm</option></primary>
4017 <indexterm role="concept">
4018 <primary>local message reception</primary>
4020 This option runs an Exim receiving process that accepts an incoming,
4021 locally-generated message on the current input. The recipients are given as the
4022 command arguments (except when <option>-t</option> is also present – see below). Each
4023 argument can be a comma-separated list of RFC 2822 addresses. This is the
4024 default option for selecting the overall action of an Exim call; it is assumed
4025 if no other conflicting option is present.
4028 If any addresses in the message are unqualified (have no domain), they are
4029 qualified by the values of the <option>qualify_domain</option> or <option>qualify_recipient</option>
4030 options, as appropriate. The <option>-bnq</option> option (see below) provides a way of
4031 suppressing this for special cases.
4034 Policy checks on the contents of local messages can be enforced by means of
4035 the non-SMTP ACL. See chapter <xref linkend="CHAPACL"/> for details.
4038 <indexterm role="concept">
4039 <primary>return code</primary>
4040 <secondary>for <option>-bm</option></secondary>
4042 The return code is zero if the message is successfully accepted. Otherwise, the
4043 action is controlled by the <option>-oe</option><emphasis>x</emphasis> option setting – see below.
4047 <indexterm role="concept">
4048 <primary>message</primary>
4049 <secondary>format</secondary>
4051 <indexterm role="concept">
4052 <primary>format</primary>
4053 <secondary>message</secondary>
4055 <indexterm role="concept">
4056 <primary><quote>From</quote> line</primary>
4058 <indexterm role="concept">
4059 <primary>UUCP</primary>
4060 <secondary><quote>From</quote> line</secondary>
4062 <indexterm role="concept">
4063 <primary>Sendmail compatibility</primary>
4064 <secondary><quote>From</quote> line</secondary>
4066 of the message must be as defined in RFC 2822, except that, for
4067 compatibility with Sendmail and Smail, a line in one of the forms
4069 <literallayout class="monospaced">
4070 From sender Fri Jan 5 12:55 GMT 1997
4071 From sender Fri, 5 Jan 97 12:55:01
4074 (with the weekday optional, and possibly with additional text after the date)
4075 is permitted to appear at the start of the message. There appears to be no
4076 authoritative specification of the format of this line. Exim recognizes it by
4077 matching against the regular expression defined by the <option>uucp_from_pattern</option>
4078 option, which can be changed if necessary.
4081 <indexterm role="option">
4082 <primary><option>-f</option></primary>
4083 <secondary>overriding <quote>From</quote> line</secondary>
4085 The specified sender is treated as if it were given as the argument to the
4086 <option>-f</option> option, but if a <option>-f</option> option is also present, its argument is used in
4087 preference to the address taken from the message. The caller of Exim must be a
4088 trusted user for the sender of a message to be set in this way.
4090 </listitem></varlistentry>
4092 <term><option>-bnq</option></term>
4095 <indexterm role="option">
4096 <primary><option>-bnq</option></primary>
4098 <indexterm role="concept">
4099 <primary>address qualification, suppressing</primary>
4101 By default, Exim automatically qualifies unqualified addresses (those
4102 without domains) that appear in messages that are submitted locally (that
4103 is, not over TCP/IP). This qualification applies both to addresses in
4104 envelopes, and addresses in header lines. Sender addresses are qualified using
4105 <option>qualify_domain</option>, and recipient addresses using <option>qualify_recipient</option> (which
4106 defaults to the value of <option>qualify_domain</option>).
4109 Sometimes, qualification is not wanted. For example, if <option>-bS</option> (batch SMTP) is
4110 being used to re-submit messages that originally came from remote hosts after
4111 content scanning, you probably do not want to qualify unqualified addresses in
4112 header lines. (Such lines will be present only if you have not enabled a header
4113 syntax check in the appropriate ACL.)
4116 The <option>-bnq</option> option suppresses all qualification of unqualified addresses in
4117 messages that originate on the local host. When this is used, unqualified
4118 addresses in the envelope provoke errors (causing message rejection) and
4119 unqualified addresses in header lines are left alone.
4121 </listitem></varlistentry>
4123 <term><option>-bP</option></term>
4126 <indexterm role="option">
4127 <primary><option>-bP</option></primary>
4129 <indexterm role="concept">
4130 <primary>configuration options</primary>
4131 <secondary>extracting</secondary>
4133 <indexterm role="concept">
4134 <primary>options</primary>
4135 <secondary>configuration – extracting</secondary>
4137 If this option is given with no arguments, it causes the values of all Exim’s
4138 main configuration options to be written to the standard output. The values
4139 of one or more specific options can be requested by giving their names as
4140 arguments, for example:
4142 <literallayout class="monospaced">
4143 exim -bP qualify_domain hold_domains
4146 <indexterm role="concept">
4147 <primary>hiding configuration option values</primary>
4149 <indexterm role="concept">
4150 <primary>configuration options</primary>
4151 <secondary>hiding value of</secondary>
4153 <indexterm role="concept">
4154 <primary>options</primary>
4155 <secondary>hiding value of</secondary>
4157 However, any option setting that is preceded by the word <quote>hide</quote> in the
4158 configuration file is not shown in full, except to an admin user. For other
4159 users, the output is as in this example:
4161 <literallayout class="monospaced">
4162 mysql_servers = <value not displayable>
4165 If <option>configure_file</option> is given as an argument, the name of the run time
4166 configuration file is output.
4167 If a list of configuration files was supplied, the value that is output here
4168 is the name of the file that was actually used.
4171 <indexterm role="concept">
4172 <primary>daemon</primary>
4173 <secondary>process id (pid)</secondary>
4175 <indexterm role="concept">
4176 <primary>pid (process id)</primary>
4177 <secondary>of daemon</secondary>
4179 If <option>log_file_path</option> or <option>pid_file_path</option> are given, the names of the
4180 directories where log files and daemon pid files are written are output,
4181 respectively. If these values are unset, log files are written in a
4182 sub-directory of the spool directory called <option>log</option>, and the pid file is
4183 written directly into the spool directory.
4186 If <option>-bP</option> is followed by a name preceded by <literal>+</literal>, for example,
4188 <literallayout class="monospaced">
4189 exim -bP +local_domains
4192 it searches for a matching named list of any type (domain, host, address, or
4193 local part) and outputs what it finds.
4196 <indexterm role="concept">
4197 <primary>options</primary>
4198 <secondary>router – extracting</secondary>
4200 <indexterm role="concept">
4201 <primary>options</primary>
4202 <secondary>transport – extracting</secondary>
4204 <indexterm role="concept">
4205 <primary>options</primary>
4206 <secondary>authenticator – extracting</secondary>
4208 If one of the words <option>router</option>, <option>transport</option>, or <option>authenticator</option> is given,
4209 followed by the name of an appropriate driver instance, the option settings for
4210 that driver are output. For example:
4212 <literallayout class="monospaced">
4213 exim -bP transport local_delivery
4216 The generic driver options are output first, followed by the driver’s private
4217 options. A list of the names of drivers of a particular type can be obtained by
4218 using one of the words <option>router_list</option>, <option>transport_list</option>, or
4219 <option>authenticator_list</option>, and a complete list of all drivers with their option
4220 settings can be obtained by using <option>routers</option>, <option>transports</option>, or
4221 <option>authenticators</option>.
4223 <para revisionflag="changed">
4224 <indexterm role="concept">
4225 <primary>options</primary>
4226 <secondary>macro – extracting</secondary>
4228 If invoked by an admin user, then <option>macro</option>, <option>macro_list</option> and <option>macros</option>
4229 are available, similarly to the drivers. Because macros are sometimes used
4230 for storing passwords, this option is restricted.
4231 The output format is one item per line.
4233 </listitem></varlistentry>
4235 <term><option>-bp</option></term>
4238 <indexterm role="option">
4239 <primary><option>-bp</option></primary>
4241 <indexterm role="concept">
4242 <primary>queue</primary>
4243 <secondary>listing messages on</secondary>
4245 <indexterm role="concept">
4246 <primary>listing</primary>
4247 <secondary>messages on the queue</secondary>
4249 This option requests a listing of the contents of the mail queue on the
4250 standard output. If the <option>-bp</option> option is followed by a list of message ids,
4251 just those messages are listed. By default, this option can be used only by an
4252 admin user. However, the <option>queue_list_requires_admin</option> option can be set false
4253 to allow any user to see the queue.
4256 Each message on the queue is displayed as in the following example:
4258 <literallayout class="monospaced">
4259 25m 2.9K 0t5C6f-0000c8-00 <alice@wonderland.fict.example>
4260 red.king@looking-glass.fict.example
4261 <other addresses>
4264 <indexterm role="concept">
4265 <primary>message</primary>
4266 <secondary>size in queue listing</secondary>
4268 <indexterm role="concept">
4269 <primary>size</primary>
4270 <secondary>of message</secondary>
4272 The first line contains the length of time the message has been on the queue
4273 (in this case 25 minutes), the size of the message (2.9K), the unique local
4274 identifier for the message, and the message sender, as contained in the
4275 envelope. For bounce messages, the sender address is empty, and appears as
4276 <quote><></quote>. If the message was submitted locally by an untrusted user who overrode
4277 the default sender address, the user’s login name is shown in parentheses
4278 before the sender address.
4281 <indexterm role="concept">
4282 <primary>frozen messages</primary>
4283 <secondary>in queue listing</secondary>
4285 If the message is frozen (attempts to deliver it are suspended) then the text
4286 <quote>*** frozen ***</quote> is displayed at the end of this line.
4289 The recipients of the message (taken from the envelope, not the headers) are
4290 displayed on subsequent lines. Those addresses to which the message has already
4291 been delivered are marked with the letter D. If an original address gets
4292 expanded into several addresses via an alias or forward file, the original is
4293 displayed with a D only when deliveries for all of its child addresses are
4296 </listitem></varlistentry>
4298 <term><option>-bpa</option></term>
4301 <indexterm role="option">
4302 <primary><option>-bpa</option></primary>
4304 This option operates like <option>-bp</option>, but in addition it shows delivered addresses
4305 that were generated from the original top level address(es) in each message by
4306 alias or forwarding operations. These addresses are flagged with <quote>+D</quote> instead
4307 of just <quote>D</quote>.
4309 </listitem></varlistentry>
4311 <term><option>-bpc</option></term>
4314 <indexterm role="option">
4315 <primary><option>-bpc</option></primary>
4317 <indexterm role="concept">
4318 <primary>queue</primary>
4319 <secondary>count of messages on</secondary>
4321 This option counts the number of messages on the queue, and writes the total
4322 to the standard output. It is restricted to admin users, unless
4323 <option>queue_list_requires_admin</option> is set false.
4325 </listitem></varlistentry>
4327 <term><option>-bpr</option></term>
4330 <indexterm role="option">
4331 <primary><option>-bpr</option></primary>
4333 This option operates like <option>-bp</option>, but the output is not sorted into
4334 chronological order of message arrival. This can speed it up when there are
4335 lots of messages on the queue, and is particularly useful if the output is
4336 going to be post-processed in a way that doesn’t need the sorting.
4338 </listitem></varlistentry>
4340 <term><option>-bpra</option></term>
4343 <indexterm role="option">
4344 <primary><option>-bpra</option></primary>
4346 This option is a combination of <option>-bpr</option> and <option>-bpa</option>.
4348 </listitem></varlistentry>
4350 <term><option>-bpru</option></term>
4353 <indexterm role="option">
4354 <primary><option>-bpru</option></primary>
4356 This option is a combination of <option>-bpr</option> and <option>-bpu</option>.
4358 </listitem></varlistentry>
4360 <term><option>-bpu</option></term>
4363 <indexterm role="option">
4364 <primary><option>-bpu</option></primary>
4366 This option operates like <option>-bp</option> but shows only undelivered top-level
4367 addresses for each message displayed. Addresses generated by aliasing or
4368 forwarding are not shown, unless the message was deferred after processing by a
4369 router with the <option>one_time</option> option set.
4371 </listitem></varlistentry>
4373 <term><option>-brt</option></term>
4376 <indexterm role="option">
4377 <primary><option>-brt</option></primary>
4379 <indexterm role="concept">
4380 <primary>testing</primary>
4381 <secondary>retry configuration</secondary>
4383 <indexterm role="concept">
4384 <primary>retry</primary>
4385 <secondary>configuration testing</secondary>
4387 This option is for testing retry rules, and it must be followed by up to three
4388 arguments. It causes Exim to look for a retry rule that matches the values
4389 and to write it to the standard output. For example:
4391 <literallayout class="monospaced">
4392 exim -brt bach.comp.mus.example
4393 Retry rule: *.comp.mus.example F,2h,15m; F,4d,30m;
4396 See chapter <xref linkend="CHAPretry"/> for a description of Exim’s retry rules. The first
4397 argument, which is required, can be a complete address in the form
4398 <emphasis>local_part@domain</emphasis>, or it can be just a domain name. If the second argument
4399 contains a dot, it is interpreted as an optional second domain name; if no
4400 retry rule is found for the first argument, the second is tried. This ties in
4401 with Exim’s behaviour when looking for retry rules for remote hosts – if no
4402 rule is found that matches the host, one that matches the mail domain is
4403 sought. Finally, an argument that is the name of a specific delivery error, as
4404 used in setting up retry rules, can be given. For example:
4406 <literallayout class="monospaced">
4407 exim -brt haydn.comp.mus.example quota_3d
4408 Retry rule: *@haydn.comp.mus.example quota_3d F,1h,15m
4410 </listitem></varlistentry>
4412 <term><option>-brw</option></term>
4415 <indexterm role="option">
4416 <primary><option>-brw</option></primary>
4418 <indexterm role="concept">
4419 <primary>testing</primary>
4420 <secondary>rewriting</secondary>
4422 <indexterm role="concept">
4423 <primary>rewriting</primary>
4424 <secondary>testing</secondary>
4426 This option is for testing address rewriting rules, and it must be followed by
4427 a single argument, consisting of either a local part without a domain, or a
4428 complete address with a fully qualified domain. Exim outputs how this address
4429 would be rewritten for each possible place it might appear. See chapter
4430 <xref linkend="CHAPrewrite"/> for further details.
4432 </listitem></varlistentry>
4434 <term><option>-bS</option></term>
4437 <indexterm role="option">
4438 <primary><option>-bS</option></primary>
4440 <indexterm role="concept">
4441 <primary>SMTP</primary>
4442 <secondary>batched incoming</secondary>
4444 <indexterm role="concept">
4445 <primary>batched SMTP input</primary>
4447 This option is used for batched SMTP input, which is an alternative interface
4448 for non-interactive local message submission. A number of messages can be
4449 submitted in a single run. However, despite its name, this is not really SMTP
4450 input. Exim reads each message’s envelope from SMTP commands on the standard
4451 input, but generates no responses. If the caller is trusted, or
4452 <option>untrusted_set_sender</option> is set, the senders in the SMTP MAIL commands are
4453 believed; otherwise the sender is always the caller of Exim.
4456 The message itself is read from the standard input, in SMTP format (leading
4457 dots doubled), terminated by a line containing just a single dot. An error is
4458 provoked if the terminating dot is missing. A further message may then follow.
4461 As for other local message submissions, the contents of incoming batch SMTP
4462 messages can be checked using the non-SMTP ACL (see chapter <xref linkend="CHAPACL"/>).
4463 Unqualified addresses are automatically qualified using <option>qualify_domain</option> and
4464 <option>qualify_recipient</option>, as appropriate, unless the <option>-bnq</option> option is used.
4467 Some other SMTP commands are recognized in the input. HELO and EHLO act
4468 as RSET; VRFY, EXPN, ETRN, and HELP act as NOOP;
4469 QUIT quits, ignoring the rest of the standard input.
4472 <indexterm role="concept">
4473 <primary>return code</primary>
4474 <secondary>for <option>-bS</option></secondary>
4476 If any error is encountered, reports are written to the standard output and
4477 error streams, and Exim gives up immediately. The return code is 0 if no error
4478 was detected; it is 1 if one or more messages were accepted before the error
4479 was detected; otherwise it is 2.
4482 More details of input using batched SMTP are given in section
4483 <xref linkend="SECTincomingbatchedSMTP"/>.
4485 </listitem></varlistentry>
4487 <term><option>-bs</option></term>
4490 <indexterm role="option">
4491 <primary><option>-bs</option></primary>
4493 <indexterm role="concept">
4494 <primary>SMTP</primary>
4495 <secondary>local input</secondary>
4497 <indexterm role="concept">
4498 <primary>local SMTP input</primary>
4500 This option causes Exim to accept one or more messages by reading SMTP commands
4501 on the standard input, and producing SMTP replies on the standard output. SMTP
4502 policy controls, as defined in ACLs (see chapter <xref linkend="CHAPACL"/>) are applied.
4503 Some user agents use this interface as a way of passing locally-generated
4504 messages to the MTA.
4508 <indexterm role="concept">
4509 <primary>sender</primary>
4510 <secondary>source of</secondary>
4512 this usage, if the caller of Exim is trusted, or <option>untrusted_set_sender</option> is
4513 set, the senders of messages are taken from the SMTP MAIL commands.
4514 Otherwise the content of these commands is ignored and the sender is set up as
4515 the calling user. Unqualified addresses are automatically qualified using
4516 <option>qualify_domain</option> and <option>qualify_recipient</option>, as appropriate, unless the
4517 <option>-bnq</option> option is used.
4520 <indexterm role="concept">
4521 <primary>inetd</primary>
4524 <option>-bs</option> option is also used to run Exim from <emphasis>inetd</emphasis>, as an alternative to
4525 using a listening daemon. Exim can distinguish the two cases by checking
4526 whether the standard input is a TCP/IP socket. When Exim is called from
4527 <emphasis>inetd</emphasis>, the source of the mail is assumed to be remote, and the comments
4528 above concerning senders and qualification do not apply. In this situation,
4529 Exim behaves in exactly the same way as it does when receiving a message via
4530 the listening daemon.
4532 </listitem></varlistentry>
4534 <term><option>-bt</option></term>
4537 <indexterm role="option">
4538 <primary><option>-bt</option></primary>
4540 <indexterm role="concept">
4541 <primary>testing</primary>
4542 <secondary>addresses</secondary>
4544 <indexterm role="concept">
4545 <primary>address</primary>
4546 <secondary>testing</secondary>
4548 This option runs Exim in address testing mode, in which each argument is taken
4549 as a recipient address to be tested for deliverability. The results are
4550 written to the standard output. If a test fails, and the caller is not an admin
4551 user, no details of the failure are output, because these might contain
4552 sensitive information such as usernames and passwords for database lookups.
4555 If no arguments are given, Exim runs in an interactive manner, prompting with a
4556 right angle bracket for addresses to be tested.
4559 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4560 <function>readline()</function> function, because it is running as <emphasis>root</emphasis> and there are
4564 Each address is handled as if it were the recipient address of a message
4565 (compare the <option>-bv</option> option). It is passed to the routers and the result is
4566 written to the standard output. However, any router that has
4567 <option>no_address_test</option> set is bypassed. This can make <option>-bt</option> easier to use for
4568 genuine routing tests if your first router passes everything to a scanner
4572 <indexterm role="concept">
4573 <primary>return code</primary>
4574 <secondary>for <option>-bt</option></secondary>
4576 The return code is 2 if any address failed outright; it is 1 if no address
4577 failed outright but at least one could not be resolved for some reason. Return
4578 code 0 is given only when all addresses succeed.
4581 <indexterm role="concept">
4582 <primary>duplicate addresses</primary>
4584 <emphasis role="bold">Note</emphasis>: When actually delivering a message, Exim removes duplicate recipient
4585 addresses after routing is complete, so that only one delivery takes place.
4586 This does not happen when testing with <option>-bt</option>; the full results of routing are
4590 <emphasis role="bold">Warning</emphasis>: <option>-bt</option> can only do relatively simple testing. If any of the
4591 routers in the configuration makes any tests on the sender address of a
4593 <indexterm role="option">
4594 <primary><option>-f</option></primary>
4595 <secondary>for address testing</secondary>
4597 you can use the <option>-f</option> option to set an appropriate sender when running
4598 <option>-bt</option> tests. Without it, the sender is assumed to be the calling user at the
4599 default qualifying domain. However, if you have set up (for example) routers
4600 whose behaviour depends on the contents of an incoming message, you cannot test
4601 those conditions using <option>-bt</option>. The <option>-N</option> option provides a possible way of
4604 </listitem></varlistentry>
4606 <term><option>-bV</option></term>
4609 <indexterm role="option">
4610 <primary><option>-bV</option></primary>
4612 <indexterm role="concept">
4613 <primary>version number of Exim</primary>
4615 This option causes Exim to write the current version number, compilation
4616 number, and compilation date of the <emphasis>exim</emphasis> binary to the standard output.
4617 It also lists the DBM library this is being used, the optional modules (such as
4618 specific lookup types), the drivers that are included in the binary, and the
4619 name of the run time configuration file that is in use.
4622 As part of its operation, <option>-bV</option> causes Exim to read and syntax check its
4623 configuration file. However, this is a static check only. It cannot check
4624 values that are to be expanded. For example, although a misspelt ACL verb is
4625 detected, an error in the verb’s arguments is not. You cannot rely on <option>-bV</option>
4626 alone to discover (for example) all the typos in the configuration; some
4627 realistic testing is needed. The <option>-bh</option> and <option>-N</option> options provide more
4628 dynamic testing facilities.
4630 </listitem></varlistentry>
4632 <term><option>-bv</option></term>
4635 <indexterm role="option">
4636 <primary><option>-bv</option></primary>
4638 <indexterm role="concept">
4639 <primary>verifying address</primary>
4640 <secondary>using <option>-bv</option></secondary>
4642 <indexterm role="concept">
4643 <primary>address</primary>
4644 <secondary>verification</secondary>
4646 This option runs Exim in address verification mode, in which each argument is
4647 taken as a recipient address to be verified by the routers. (This does
4648 not involve any verification callouts). During normal operation, verification
4649 happens mostly as a consequence processing a <option>verify</option> condition in an ACL
4650 (see chapter <xref linkend="CHAPACL"/>). If you want to test an entire ACL, possibly
4651 including callouts, see the <option>-bh</option> and <option>-bhc</option> options.
4654 If verification fails, and the caller is not an admin user, no details of the
4655 failure are output, because these might contain sensitive information such as
4656 usernames and passwords for database lookups.
4659 If no arguments are given, Exim runs in an interactive manner, prompting with a
4660 right angle bracket for addresses to be verified.
4663 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4664 <function>readline()</function> function, because it is running as <emphasis>exim</emphasis> and there are
4668 Verification differs from address testing (the <option>-bt</option> option) in that routers
4669 that have <option>no_verify</option> set are skipped, and if the address is accepted by a
4670 router that has <option>fail_verify</option> set, verification fails. The address is
4671 verified as a recipient if <option>-bv</option> is used; to test verification for a sender
4672 address, <option>-bvs</option> should be used.
4675 If the <option>-v</option> option is not set, the output consists of a single line for each
4676 address, stating whether it was verified or not, and giving a reason in the
4677 latter case. Without <option>-v</option>, generating more than one address by redirection
4678 causes verification to end successfully, without considering the generated
4679 addresses. However, if just one address is generated, processing continues,
4680 and the generated address must verify successfully for the overall verification
4684 When <option>-v</option> is set, more details are given of how the address has been handled,
4685 and in the case of address redirection, all the generated addresses are also
4686 considered. Verification may succeed for some and fail for others.
4690 <indexterm role="concept">
4691 <primary>return code</primary>
4692 <secondary>for <option>-bv</option></secondary>
4694 return code is 2 if any address failed outright; it is 1 if no address
4695 failed outright but at least one could not be resolved for some reason. Return
4696 code 0 is given only when all addresses succeed.
4699 If any of the routers in the configuration makes any tests on the sender
4700 address of a message, you should use the <option>-f</option> option to set an appropriate
4701 sender when running <option>-bv</option> tests. Without it, the sender is assumed to be the
4702 calling user at the default qualifying domain.
4704 </listitem></varlistentry>
4706 <term><option>-bvs</option></term>
4709 <indexterm role="option">
4710 <primary><option>-bvs</option></primary>
4712 This option acts like <option>-bv</option>, but verifies the address as a sender rather
4713 than a recipient address. This affects any rewriting and qualification that
4716 </listitem></varlistentry>
4718 <term><option>-C</option> <<emphasis>filelist</emphasis>></term>
4721 <indexterm role="option">
4722 <primary><option>-C</option></primary>
4724 <indexterm role="concept">
4725 <primary>configuration file</primary>
4726 <secondary>alternate</secondary>
4728 <indexterm role="concept">
4729 <primary>CONFIGURE_FILE</primary>
4731 <indexterm role="concept">
4732 <primary>alternate configuration file</primary>
4734 This option causes Exim to find the run time configuration file from the given
4735 list instead of from the list specified by the CONFIGURE_FILE
4736 compile-time setting. Usually, the list will consist of just a single file
4737 name, but it can be a colon-separated list of names. In this case, the first
4738 file that exists is used. Failure to open an existing file stops Exim from
4739 proceeding any further along the list, and an error is generated.
4742 When this option is used by a caller other than root or the Exim user, and the
4743 list is different from the compiled-in list, Exim gives up its root privilege
4744 immediately, and runs with the real and effective uid and gid set to those of
4745 the caller. However, if ALT_CONFIG_ROOT_ONLY is defined in
4746 <filename>Local/Makefile</filename>, root privilege is retained for <option>-C</option> only if the caller of
4750 That is, the Exim user is no longer privileged in this regard. This build-time
4751 option is not set by default in the Exim source distribution tarbundle.
4752 However, if you are using a <quote>packaged</quote> version of Exim (source or binary),
4753 the packagers might have enabled it.
4756 Setting ALT_CONFIG_ROOT_ONLY locks out the possibility of testing a
4757 configuration using <option>-C</option> right through message reception and delivery, even
4758 if the caller is root. The reception works, but by that time, Exim is running
4759 as the Exim user, so when it re-executes to regain privilege for the delivery,
4760 the use of <option>-C</option> causes privilege to be lost. However, root can test reception
4761 and delivery using two separate commands (one to put a message on the queue,
4762 using <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
4765 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
4766 prefix string with which any file named in a <option>-C</option> command line option
4767 must start. In addition, the file name must not contain the sequence <literal>/../</literal>.
4768 However, if the value of the <option>-C</option> option is identical to the value of
4769 CONFIGURE_FILE in <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as
4770 usual. There is no default setting for ALT_CONFIG_PREFIX; when it is
4771 unset, any file name can be used with <option>-C</option>.
4774 ALT_CONFIG_PREFIX can be used to confine alternative configuration files
4775 to a directory to which only root has access. This prevents someone who has
4776 broken into the Exim account from running a privileged Exim with an arbitrary
4780 The <option>-C</option> facility is useful for ensuring that configuration files are
4781 syntactically correct, but cannot be used for test deliveries, unless the
4782 caller is privileged, or unless it is an exotic configuration that does not
4783 require privilege. No check is made on the owner or group of the files
4784 specified by this option.
4786 </listitem></varlistentry>
4788 <term><option>-D</option><<emphasis>macro</emphasis>>=<<emphasis>value</emphasis>></term>
4791 <indexterm role="option">
4792 <primary><option>-D</option></primary>
4794 <indexterm role="concept">
4795 <primary>macro</primary>
4796 <secondary>setting on command line</secondary>
4798 This option can be used to override macro definitions in the configuration file
4799 (see section <xref linkend="SECTmacrodefs"/>). However, like <option>-C</option>, if it is used by an
4800 unprivileged caller, it causes Exim to give up its root privilege.
4801 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
4802 completely disabled, and its use causes an immediate error exit.
4805 The entire option (including equals sign if present) must all be within one
4806 command line item. <option>-D</option> can be used to set the value of a macro to the empty
4807 string, in which case the equals sign is optional. These two commands are
4810 <literallayout class="monospaced">
4815 To include spaces in a macro definition item, quotes must be used. If you use
4816 quotes, spaces are permitted around the macro name and the equals sign. For
4819 <literallayout class="monospaced">
4820 exim '-D ABC = something' ...
4823 <option>-D</option> may be repeated up to 10 times on a command line.
4825 </listitem></varlistentry>
4827 <term><option>-d</option><<emphasis>debug options</emphasis>></term>
4830 <indexterm role="option">
4831 <primary><option>-d</option></primary>
4833 <indexterm role="concept">
4834 <primary>debugging</primary>
4835 <secondary>list of selectors</secondary>
4837 <indexterm role="concept">
4838 <primary>debugging</primary>
4839 <secondary><option>-d</option> option</secondary>
4841 This option causes debugging information to be written to the standard
4842 error stream. It is restricted to admin users because debugging output may show
4843 database queries that contain password information. Also, the details of users’
4844 filter files should be protected. If a non-admin user uses <option>-d</option>, Exim
4845 writes an error message to the standard error stream and exits with a non-zero
4849 When <option>-d</option> is used, <option>-v</option> is assumed. If <option>-d</option> is given on its own, a lot of
4850 standard debugging data is output. This can be reduced, or increased to include
4851 some more rarely needed information, by directly following <option>-d</option> with a string
4852 made up of names preceded by plus or minus characters. These add or remove sets
4853 of debugging data, respectively. For example, <option>-d+filter</option> adds filter
4854 debugging, whereas <option>-d-all+filter</option> selects only filter debugging. Note that
4855 no spaces are allowed in the debug setting. The available debugging categories
4859 <literal>acl </literal> ACL interpretation
4860 <literal>auth </literal> authenticators
4861 <literal>deliver </literal> general delivery logic
4862 <literal>dns </literal> DNS lookups (see also resolver)
4863 <literal>dnsbl </literal> DNS black list (aka RBL) code
4864 <literal>exec </literal> arguments for <function>execv()</function> calls
4865 <literal>expand </literal> detailed debugging for string expansions
4866 <literal>filter </literal> filter handling
4867 <literal>hints_lookup </literal> hints data lookups
4868 <literal>host_lookup </literal> all types of name-to-IP address handling
4869 <literal>ident </literal> ident lookup
4870 <literal>interface </literal> lists of local interfaces
4871 <literal>lists </literal> matching things in lists
4872 <literal>load </literal> system load checks
4873 <literal>local_scan </literal> can be used by <function>local_scan()</function> (see chapter <xref linkend="CHAPlocalscan"/>)
4874 <literal>lookup </literal> general lookup code and all lookups
4875 <literal>memory </literal> memory handling
4876 <literal>pid </literal> add pid to debug output lines
4877 <literal>process_info </literal> setting info for the process log
4878 <literal>queue_run </literal> queue runs
4879 <literal>receive </literal> general message reception logic
4880 <literal>resolver </literal> turn on the DNS resolver’s debugging output
4881 <literal>retry </literal> retry handling
4882 <literal>rewrite </literal> address rewriting
4883 <literal>route </literal> address routing
4884 <literal>timestamp </literal> add timestamp to debug output lines
4885 <literal>tls </literal> TLS logic
4886 <literal>transport </literal> transports
4887 <literal>uid </literal> changes of uid/gid and looking up uid/gid
4888 <literal>verify </literal> address verification logic
4889 <literal>all </literal> almost all of the above (see below), and also <option>-v</option>
4892 The <literal>all</literal> option excludes <literal>memory</literal> when used as <literal>+all</literal>, but includes it
4893 for <literal>-all</literal>. The reason for this is that <literal>+all</literal> is something that people
4894 tend to use when generating debug output for Exim maintainers. If <literal>+memory</literal>
4895 is included, an awful lot of output that is very rarely of interest is
4896 generated, so it now has to be explicitly requested. However, <literal>-all</literal> does
4897 turn everything off.
4900 <indexterm role="concept">
4901 <primary>resolver, debugging output</primary>
4903 <indexterm role="concept">
4904 <primary>DNS resolver, debugging output</primary>
4906 The <literal>resolver</literal> option produces output only if the DNS resolver was compiled
4907 with DEBUG enabled. This is not the case in some operating systems. Also,
4908 unfortunately, debugging output from the DNS resolver is written to stdout
4912 The default (<option>-d</option> with no argument) omits <literal>expand</literal>, <literal>filter</literal>,
4913 <literal>interface</literal>, <literal>load</literal>, <literal>memory</literal>, <literal>pid</literal>, <literal>resolver</literal>, and <literal>timestamp</literal>.
4914 However, the <literal>pid</literal> selector is forced when debugging is turned on for a
4915 daemon, which then passes it on to any re-executed Exims. Exim also
4916 automatically adds the pid to debug lines when several remote deliveries are
4920 The <literal>timestamp</literal> selector causes the current time to be inserted at the start
4921 of all debug output lines. This can be useful when trying to track down delays
4925 If the <option>debug_print</option> option is set in any driver, it produces output whenever
4926 any debugging is selected, or if <option>-v</option> is used.
4928 </listitem></varlistentry>
4930 <term><option>-dd</option><<emphasis>debug options</emphasis>></term>
4933 <indexterm role="option">
4934 <primary><option>-dd</option></primary>
4936 This option behaves exactly like <option>-d</option> except when used on a command that
4937 starts a daemon process. In that case, debugging is turned off for the
4938 subprocesses that the daemon creates. Thus, it is useful for monitoring the
4939 behaviour of the daemon without creating as much output as full debugging does.
4941 </listitem></varlistentry>
4943 <term><option>-dropcr</option></term>
4946 <indexterm role="option">
4947 <primary><option>-dropcr</option></primary>
4949 This is an obsolete option that is now a no-op. It used to affect the way Exim
4950 handled CR and LF characters in incoming messages. What happens now is
4951 described in section <xref linkend="SECTlineendings"/>.
4953 </listitem></varlistentry>
4955 <term><option>-E</option></term>
4958 <indexterm role="option">
4959 <primary><option>-E</option></primary>
4961 <indexterm role="concept">
4962 <primary>bounce message</primary>
4963 <secondary>generating</secondary>
4965 This option specifies that an incoming message is a locally-generated delivery
4966 failure report. It is used internally by Exim when handling delivery failures
4967 and is not intended for external use. Its only effect is to stop Exim
4968 generating certain messages to the postmaster, as otherwise message cascades
4969 could occur in some situations. As part of the same option, a message id may
4970 follow the characters <option>-E</option>. If it does, the log entry for the receipt of the
4971 new message contains the id, following <quote>R=</quote>, as a cross-reference.
4973 </listitem></varlistentry>
4975 <term><option>-e</option><emphasis>x</emphasis></term>
4978 <indexterm role="option">
4979 <primary><option>-e</option><emphasis>x</emphasis></primary>
4981 There are a number of Sendmail options starting with <option>-oe</option> which seem to be
4982 called by various programs without the leading <option>o</option> in the option. For
4983 example, the <option>vacation</option> program uses <option>-eq</option>. Exim treats all options of the
4984 form <option>-e</option><emphasis>x</emphasis> as synonymous with the corresponding <option>-oe</option><emphasis>x</emphasis> options.
4986 </listitem></varlistentry>
4988 <term><option>-F</option> <<emphasis>string</emphasis>></term>
4991 <indexterm role="option">
4992 <primary><option>-F</option></primary>
4994 <indexterm role="concept">
4995 <primary>sender</primary>
4996 <secondary>name</secondary>
4998 <indexterm role="concept">
4999 <primary>name</primary>
5000 <secondary>of sender</secondary>
5002 This option sets the sender’s full name for use when a locally-generated
5003 message is being accepted. In the absence of this option, the user’s <emphasis>gecos</emphasis>
5004 entry from the password data is used. As users are generally permitted to alter
5005 their <emphasis>gecos</emphasis> entries, no security considerations are involved. White space
5006 between <option>-F</option> and the <<emphasis>string</emphasis>> is optional.
5008 </listitem></varlistentry>
5010 <term><option>-f</option> <<emphasis>address</emphasis>></term>
5013 <indexterm role="option">
5014 <primary><option>-f</option></primary>
5016 <indexterm role="concept">
5017 <primary>sender</primary>
5018 <secondary>address</secondary>
5020 <indexterm role="concept">
5021 <primary>address</primary>
5022 <secondary>sender</secondary>
5024 <indexterm role="concept">
5025 <primary>trusted users</primary>
5027 <indexterm role="concept">
5028 <primary>envelope sender</primary>
5030 <indexterm role="concept">
5031 <primary>user</primary>
5032 <secondary>trusted</secondary>
5034 This option sets the address of the envelope sender of a locally-generated
5035 message (also known as the return path). The option can normally be used only
5036 by a trusted user, but <option>untrusted_set_sender</option> can be set to allow untrusted
5040 Processes running as root or the Exim user are always trusted. Other
5041 trusted users are defined by the <option>trusted_users</option> or <option>trusted_groups</option>
5042 options. In the absence of <option>-f</option>, or if the caller is not trusted, the sender
5043 of a local message is set to the caller’s login name at the default qualify
5047 There is one exception to the restriction on the use of <option>-f</option>: an empty sender
5048 can be specified by any user, trusted or not, to create a message that can
5049 never provoke a bounce. An empty sender can be specified either as an empty
5050 string, or as a pair of angle brackets with nothing between them, as in these
5051 examples of shell commands:
5053 <literallayout class="monospaced">
5054 exim -f '<>' user@domain
5055 exim -f "" user@domain
5058 In addition, the use of <option>-f</option> is not restricted when testing a filter file
5059 with <option>-bf</option> or when testing or verifying addresses using the <option>-bt</option> or
5060 <option>-bv</option> options.
5063 Allowing untrusted users to change the sender address does not of itself make
5064 it possible to send anonymous mail. Exim still checks that the <emphasis>From:</emphasis> header
5065 refers to the local user, and if it does not, it adds a <emphasis>Sender:</emphasis> header,
5066 though this can be overridden by setting <option>no_local_from_check</option>.
5070 <indexterm role="concept">
5071 <primary><quote>From</quote> line</primary>
5073 space between <option>-f</option> and the <<emphasis>address</emphasis>> is optional (that is, they can be
5074 given as two arguments or one combined argument). The sender of a
5075 locally-generated message can also be set (when permitted) by an initial
5076 <quote>From </quote> line in the message – see the description of <option>-bm</option> above – but
5077 if <option>-f</option> is also present, it overrides <quote>From </quote>.
5079 </listitem></varlistentry>
5081 <term><option>-G</option></term>
5084 <indexterm role="option">
5085 <primary><option>-G</option></primary>
5087 <indexterm role="concept">
5088 <primary>Sendmail compatibility</primary>
5089 <secondary><option>-G</option> option ignored</secondary>
5091 This is a Sendmail option which is ignored by Exim.
5093 </listitem></varlistentry>
5095 <term><option>-h</option> <<emphasis>number</emphasis>></term>
5098 <indexterm role="option">
5099 <primary><option>-h</option></primary>
5101 <indexterm role="concept">
5102 <primary>Sendmail compatibility</primary>
5103 <secondary><option>-h</option> option ignored</secondary>
5105 This option is accepted for compatibility with Sendmail, but has no effect. (In
5106 Sendmail it overrides the <quote>hop count</quote> obtained by counting <emphasis>Received:</emphasis>
5109 </listitem></varlistentry>
5111 <term><option>-i</option></term>
5114 <indexterm role="option">
5115 <primary><option>-i</option></primary>
5117 <indexterm role="concept">
5118 <primary>Solaris</primary>
5119 <secondary><emphasis>mail</emphasis> command</secondary>
5121 <indexterm role="concept">
5122 <primary>dot</primary>
5123 <secondary>in incoming non-SMTP message</secondary>
5125 This option, which has the same effect as <option>-oi</option>, specifies that a dot on a
5126 line by itself should not terminate an incoming, non-SMTP message. I can find
5127 no documentation for this option in Solaris 2.4 Sendmail, but the <emphasis>mailx</emphasis>
5128 command in Solaris 2.4 uses it. See also <option>-ti</option>.
5130 </listitem></varlistentry>
5132 <term><option>-M</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5135 <indexterm role="option">
5136 <primary><option>-M</option></primary>
5138 <indexterm role="concept">
5139 <primary>forcing delivery</primary>
5141 <indexterm role="concept">
5142 <primary>delivery</primary>
5143 <secondary>forcing attempt</secondary>
5145 <indexterm role="concept">
5146 <primary>frozen messages</primary>
5147 <secondary>forcing delivery</secondary>
5149 This option requests Exim to run a delivery attempt on each message in turn. If
5150 any of the messages are frozen, they are automatically thawed before the
5151 delivery attempt. The settings of <option>queue_domains</option>, <option>queue_smtp_domains</option>,
5152 and <option>hold_domains</option> are ignored.
5156 <indexterm role="concept">
5157 <primary>hints database</primary>
5158 <secondary>overriding retry hints</secondary>
5160 hints for any of the addresses are overridden – Exim tries to deliver even if
5161 the normal retry time has not yet been reached. This option requires the caller
5162 to be an admin user. However, there is an option called <option>prod_requires_admin</option>
5163 which can be set false to relax this restriction (and also the same requirement
5164 for the <option>-q</option>, <option>-R</option>, and <option>-S</option> options).
5167 The deliveries happen synchronously, that is, the original Exim process does
5168 not terminate until all the delivery attempts have finished. No output is
5169 produced unless there is a serious error. If you want to see what is happening,
5170 use the <option>-v</option> option as well, or inspect Exim’s main log.
5172 </listitem></varlistentry>
5174 <term><option>-Mar</option> <<emphasis>message id</emphasis>> <<emphasis>address</emphasis>> <<emphasis>address</emphasis>> ...</term>
5177 <indexterm role="option">
5178 <primary><option>-Mar</option></primary>
5180 <indexterm role="concept">
5181 <primary>message</primary>
5182 <secondary>adding recipients</secondary>
5184 <indexterm role="concept">
5185 <primary>recipient</primary>
5186 <secondary>adding</secondary>
5188 This option requests Exim to add the addresses to the list of recipients of the
5189 message (<quote>ar</quote> for <quote>add recipients</quote>). The first argument must be a message
5190 id, and the remaining ones must be email addresses. However, if the message is
5191 active (in the middle of a delivery attempt), it is not altered. This option
5192 can be used only by an admin user.
5194 </listitem></varlistentry>
5196 <term><option>-MC</option> <<emphasis>transport</emphasis>> <<emphasis>hostname</emphasis>> <<emphasis>sequence number</emphasis>> <<emphasis>message id</emphasis>></term>
5199 <indexterm role="option">
5200 <primary><option>-MC</option></primary>
5202 <indexterm role="concept">
5203 <primary>SMTP</primary>
5204 <secondary>passed connection</secondary>
5206 <indexterm role="concept">
5207 <primary>SMTP</primary>
5208 <secondary>multiple deliveries</secondary>
5210 <indexterm role="concept">
5211 <primary>multiple SMTP deliveries</primary>
5213 This option is not intended for use by external callers. It is used internally
5214 by Exim to invoke another instance of itself to deliver a waiting message using
5215 an existing SMTP connection, which is passed as the standard input. Details are
5216 given in chapter <xref linkend="CHAPSMTP"/>. This must be the final option, and the caller
5217 must be root or the Exim user in order to use it.
5219 </listitem></varlistentry>
5221 <term><option>-MCA</option></term>
5224 <indexterm role="option">
5225 <primary><option>-MCA</option></primary>
5227 This option is not intended for use by external callers. It is used internally
5228 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5229 connection to the remote host has been authenticated.
5231 </listitem></varlistentry>
5233 <term><option>-MCP</option></term>
5236 <indexterm role="option">
5237 <primary><option>-MCP</option></primary>
5239 This option is not intended for use by external callers. It is used internally
5240 by Exim in conjunction with the <option>-MC</option> option. It signifies that the server to
5241 which Exim is connected supports pipelining.
5243 </listitem></varlistentry>
5245 <term><option>-MCQ</option> <<emphasis>process id</emphasis>> <<emphasis>pipe fd</emphasis>></term>
5248 <indexterm role="option">
5249 <primary><option>-MCQ</option></primary>
5251 This option is not intended for use by external callers. It is used internally
5252 by Exim in conjunction with the <option>-MC</option> option when the original delivery was
5253 started by a queue runner. It passes on the process id of the queue runner,
5254 together with the file descriptor number of an open pipe. Closure of the pipe
5255 signals the final completion of the sequence of processes that are passing
5256 messages through the same SMTP connection.
5258 </listitem></varlistentry>
5260 <term><option>-MCS</option></term>
5263 <indexterm role="option">
5264 <primary><option>-MCS</option></primary>
5266 This option is not intended for use by external callers. It is used internally
5267 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5268 SMTP SIZE option should be used on messages delivered down the existing
5271 </listitem></varlistentry>
5273 <term><option>-MCT</option></term>
5276 <indexterm role="option">
5277 <primary><option>-MCT</option></primary>
5279 This option is not intended for use by external callers. It is used internally
5280 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5281 host to which Exim is connected supports TLS encryption.
5283 </listitem></varlistentry>
5285 <term><option>-Mc</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5288 <indexterm role="option">
5289 <primary><option>-Mc</option></primary>
5291 <indexterm role="concept">
5292 <primary>hints database</primary>
5293 <secondary>not overridden by <option>-Mc</option></secondary>
5295 <indexterm role="concept">
5296 <primary>delivery</primary>
5297 <secondary>manually started – not forced</secondary>
5299 This option requests Exim to run a delivery attempt on each message in turn,
5300 but unlike the <option>-M</option> option, it does check for retry hints, and respects any
5301 that are found. This option is not very useful to external callers. It is
5302 provided mainly for internal use by Exim when it needs to re-invoke itself in
5303 order to regain root privilege for a delivery (see chapter <xref linkend="CHAPsecurity"/>).
5304 However, <option>-Mc</option> can be useful when testing, in order to run a delivery that
5305 respects retry times and other options such as <option>hold_domains</option> that are
5306 overridden when <option>-M</option> is used. Such a delivery does not count as a queue run.
5307 If you want to run a specific delivery as if in a queue run, you should use
5308 <option>-q</option> with a message id argument. A distinction between queue run deliveries
5309 and other deliveries is made in one or two places.
5311 </listitem></varlistentry>
5313 <term><option>-Mes</option> <<emphasis>message id</emphasis>> <<emphasis>address</emphasis>></term>
5316 <indexterm role="option">
5317 <primary><option>-Mes</option></primary>
5319 <indexterm role="concept">
5320 <primary>message</primary>
5321 <secondary>changing sender</secondary>
5323 <indexterm role="concept">
5324 <primary>sender</primary>
5325 <secondary>changing</secondary>
5327 This option requests Exim to change the sender address in the message to the
5328 given address, which must be a fully qualified address or <quote><></quote> (<quote>es</quote> for
5329 <quote>edit sender</quote>). There must be exactly two arguments. The first argument must
5330 be a message id, and the second one an email address. However, if the message
5331 is active (in the middle of a delivery attempt), its status is not altered.
5332 This option can be used only by an admin user.
5334 </listitem></varlistentry>
5336 <term><option>-Mf</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5339 <indexterm role="option">
5340 <primary><option>-Mf</option></primary>
5342 <indexterm role="concept">
5343 <primary>freezing messages</primary>
5345 <indexterm role="concept">
5346 <primary>message</primary>
5347 <secondary>manually freezing</secondary>
5349 This option requests Exim to mark each listed message as <quote>frozen</quote>. This
5350 prevents any delivery attempts taking place until the message is <quote>thawed</quote>,
5351 either manually or as a result of the <option>auto_thaw</option> configuration option.
5352 However, if any of the messages are active (in the middle of a delivery
5353 attempt), their status is not altered. This option can be used only by an admin
5356 </listitem></varlistentry>
5358 <term><option>-Mg</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5361 <indexterm role="option">
5362 <primary><option>-Mg</option></primary>
5364 <indexterm role="concept">
5365 <primary>giving up on messages</primary>
5367 <indexterm role="concept">
5368 <primary>message</primary>
5369 <secondary>abandoning delivery attempts</secondary>
5371 <indexterm role="concept">
5372 <primary>delivery</primary>
5373 <secondary>abandoning further attempts</secondary>
5375 This option requests Exim to give up trying to deliver the listed messages,
5376 including any that are frozen. However, if any of the messages are active,
5377 their status is not altered. For non-bounce messages, a delivery error message
5378 is sent to the sender, containing the text <quote>cancelled by administrator</quote>.
5379 Bounce messages are just discarded. This option can be used only by an admin
5382 </listitem></varlistentry>
5384 <term><option>-Mmad</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5387 <indexterm role="option">
5388 <primary><option>-Mmad</option></primary>
5390 <indexterm role="concept">
5391 <primary>delivery</primary>
5392 <secondary>cancelling all</secondary>
5394 This option requests Exim to mark all the recipient addresses in the messages
5395 as already delivered (<quote>mad</quote> for <quote>mark all delivered</quote>). However, if any
5396 message is active (in the middle of a delivery attempt), its status is not
5397 altered. This option can be used only by an admin user.
5399 </listitem></varlistentry>
5401 <term><option>-Mmd</option> <<emphasis>message id</emphasis>> <<emphasis>address</emphasis>> <<emphasis>address</emphasis>> ...</term>
5404 <indexterm role="option">
5405 <primary><option>-Mmd</option></primary>
5407 <indexterm role="concept">
5408 <primary>delivery</primary>
5409 <secondary>cancelling by address</secondary>
5411 <indexterm role="concept">
5412 <primary>recipient</primary>
5413 <secondary>removing</secondary>
5415 <indexterm role="concept">
5416 <primary>removing recipients</primary>
5418 This option requests Exim to mark the given addresses as already delivered
5419 (<quote>md</quote> for <quote>mark delivered</quote>). The first argument must be a message id, and
5420 the remaining ones must be email addresses. These are matched to recipient
5421 addresses in the message in a case-sensitive manner. If the message is active
5422 (in the middle of a delivery attempt), its status is not altered. This option
5423 can be used only by an admin user.
5425 </listitem></varlistentry>
5427 <term><option>-Mrm</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5430 <indexterm role="option">
5431 <primary><option>-Mrm</option></primary>
5433 <indexterm role="concept">
5434 <primary>removing messages</primary>
5436 <indexterm role="concept">
5437 <primary>abandoning mail</primary>
5439 <indexterm role="concept">
5440 <primary>message</primary>
5441 <secondary>manually discarding</secondary>
5443 This option requests Exim to remove the given messages from the queue. No
5444 bounce messages are sent; each message is simply forgotten. However, if any of
5445 the messages are active, their status is not altered. This option can be used
5446 only by an admin user or by the user who originally caused the message to be
5447 placed on the queue.
5449 </listitem></varlistentry>
5451 <term><option>-Mset</option> <<emphasis>message id</emphasis>></term>
5454 <indexterm role="option">
5455 <primary><option>-Mset</option></primary>
5457 <indexterm role="concept">
5458 <primary>testing</primary>
5459 <secondary>string expansion</secondary>
5461 <indexterm role="concept">
5462 <primary>expansion</primary>
5463 <secondary>testing</secondary>
5465 This option is useful only in conjunction with <option>-be</option> (that is, when testing
5466 string expansions). Exim loads the given message from its spool before doing
5467 the test expansions, thus setting message-specific variables such as
5468 <varname>$message_size</varname> and the header variables. The <varname>$recipients</varname> variable is made
5469 available. This feature is provided to make it easier to test expansions that
5470 make use of these variables. However, this option can be used only by an admin
5471 user. See also <option>-bem</option>.
5473 </listitem></varlistentry>
5475 <term><option>-Mt</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5478 <indexterm role="option">
5479 <primary><option>-Mt</option></primary>
5481 <indexterm role="concept">
5482 <primary>thawing messages</primary>
5484 <indexterm role="concept">
5485 <primary>unfreezing messages</primary>
5487 <indexterm role="concept">
5488 <primary>frozen messages</primary>
5489 <secondary>thawing</secondary>
5491 <indexterm role="concept">
5492 <primary>message</primary>
5493 <secondary>thawing frozen</secondary>
5495 This option requests Exim to <quote>thaw</quote> any of the listed messages that are
5496 <quote>frozen</quote>, so that delivery attempts can resume. However, if any of the
5497 messages are active, their status is not altered. This option can be used only
5500 </listitem></varlistentry>
5502 <term><option>-Mvb</option> <<emphasis>message id</emphasis>></term>
5505 <indexterm role="option">
5506 <primary><option>-Mvb</option></primary>
5508 <indexterm role="concept">
5509 <primary>listing</primary>
5510 <secondary>message body</secondary>
5512 <indexterm role="concept">
5513 <primary>message</primary>
5514 <secondary>listing body of</secondary>
5516 This option causes the contents of the message body (-D) spool file to be
5517 written to the standard output. This option can be used only by an admin user.
5519 </listitem></varlistentry>
5521 <term><option>-Mvc</option> <<emphasis>message id</emphasis>></term>
5524 <indexterm role="option">
5525 <primary><option>-Mvc</option></primary>
5527 <indexterm role="concept">
5528 <primary>message</primary>
5529 <secondary>listing in RFC 2822 format</secondary>
5531 <indexterm role="concept">
5532 <primary>listing</primary>
5533 <secondary>message in RFC 2922 format</secondary>
5535 This option causes a copy of the complete message (header lines plus body) to
5536 be written to the standard output in RFC 2822 format. This option can be used
5537 only by an admin user.
5539 </listitem></varlistentry>
5541 <term><option>-Mvh</option> <<emphasis>message id</emphasis>></term>
5544 <indexterm role="option">
5545 <primary><option>-Mvh</option></primary>
5547 <indexterm role="concept">
5548 <primary>listing</primary>
5549 <secondary>message headers</secondary>
5551 <indexterm role="concept">
5552 <primary>header lines</primary>
5553 <secondary>listing</secondary>
5555 <indexterm role="concept">
5556 <primary>message</primary>
5557 <secondary>listing header lines</secondary>
5559 This option causes the contents of the message headers (-H) spool file to be
5560 written to the standard output. This option can be used only by an admin user.
5562 </listitem></varlistentry>
5564 <term><option>-Mvl</option> <<emphasis>message id</emphasis>></term>
5567 <indexterm role="option">
5568 <primary><option>-Mvl</option></primary>
5570 <indexterm role="concept">
5571 <primary>listing</primary>
5572 <secondary>message log</secondary>
5574 <indexterm role="concept">
5575 <primary>message</primary>
5576 <secondary>listing message log</secondary>
5578 This option causes the contents of the message log spool file to be written to
5579 the standard output. This option can be used only by an admin user.
5581 </listitem></varlistentry>
5583 <term><option>-m</option></term>
5586 <indexterm role="option">
5587 <primary><option>-m</option></primary>
5589 This is apparently a synonym for <option>-om</option> that is accepted by Sendmail, so Exim
5590 treats it that way too.
5592 </listitem></varlistentry>
5594 <term><option>-N</option></term>
5597 <indexterm role="option">
5598 <primary><option>-N</option></primary>
5600 <indexterm role="concept">
5601 <primary>debugging</primary>
5602 <secondary><option>-N</option> option</secondary>
5604 <indexterm role="concept">
5605 <primary>debugging</primary>
5606 <secondary>suppressing delivery</secondary>
5608 This is a debugging option that inhibits delivery of a message at the transport
5609 level. It implies <option>-v</option>. Exim goes through many of the motions of delivery –
5610 it just doesn’t actually transport the message, but instead behaves as if it
5611 had successfully done so. However, it does not make any updates to the retry
5612 database, and the log entries for deliveries are flagged with <quote>*></quote> rather
5613 than <quote>=></quote>.
5616 Because <option>-N</option> discards any message to which it applies, only root or the Exim
5617 user are allowed to use it with <option>-bd</option>, <option>-q</option>, <option>-R</option> or <option>-M</option>. In other
5618 words, an ordinary user can use it only when supplying an incoming message to
5619 which it will apply. Although transportation never fails when <option>-N</option> is set, an
5620 address may be deferred because of a configuration problem on a transport, or a
5621 routing problem. Once <option>-N</option> has been used for a delivery attempt, it sticks to
5622 the message, and applies to any subsequent delivery attempts that may happen
5625 </listitem></varlistentry>
5627 <term><option>-n</option></term>
5630 <indexterm role="option">
5631 <primary><option>-n</option></primary>
5633 <indexterm role="concept">
5634 <primary>Sendmail compatibility</primary>
5635 <secondary><option>-n</option> option ignored</secondary>
5637 This option is interpreted by Sendmail to mean <quote>no aliasing</quote>. It is ignored
5640 </listitem></varlistentry>
5642 <term><option>-O</option> <<emphasis>data</emphasis>></term>
5645 <indexterm role="option">
5646 <primary><option>-O</option></primary>
5648 This option is interpreted by Sendmail to mean <literal>set option</literal>. It is ignored by
5651 </listitem></varlistentry>
5653 <term><option>-oA</option> <<emphasis>file name</emphasis>></term>
5656 <indexterm role="option">
5657 <primary><option>-oA</option></primary>
5659 <indexterm role="concept">
5660 <primary>Sendmail compatibility</primary>
5661 <secondary><option>-oA</option> option</secondary>
5663 This option is used by Sendmail in conjunction with <option>-bi</option> to specify an
5664 alternative alias file name. Exim handles <option>-bi</option> differently; see the
5667 </listitem></varlistentry>
5669 <term><option>-oB</option> <<emphasis>n</emphasis>></term>
5672 <indexterm role="option">
5673 <primary><option>-oB</option></primary>
5675 <indexterm role="concept">
5676 <primary>SMTP</primary>
5677 <secondary>passed connection</secondary>
5679 <indexterm role="concept">
5680 <primary>SMTP</primary>
5681 <secondary>multiple deliveries</secondary>
5683 <indexterm role="concept">
5684 <primary>multiple SMTP deliveries</primary>
5686 This is a debugging option which limits the maximum number of messages that can
5687 be delivered down one SMTP connection, overriding the value set in any <command>smtp</command>
5688 transport. If <<emphasis>n</emphasis>> is omitted, the limit is set to 1.
5690 </listitem></varlistentry>
5692 <term><option>-odb</option></term>
5695 <indexterm role="option">
5696 <primary><option>-odb</option></primary>
5698 <indexterm role="concept">
5699 <primary>background delivery</primary>
5701 <indexterm role="concept">
5702 <primary>delivery</primary>
5703 <secondary>in the background</secondary>
5705 This option applies to all modes in which Exim accepts incoming messages,
5706 including the listening daemon. It requests <quote>background</quote> delivery of such
5707 messages, which means that the accepting process automatically starts a
5708 delivery process for each message received, but does not wait for the delivery
5709 processes to finish.
5712 When all the messages have been received, the reception process exits,
5713 leaving the delivery processes to finish in their own time. The standard output
5714 and error streams are closed at the start of each delivery process.
5715 This is the default action if none of the <option>-od</option> options are present.
5718 If one of the queueing options in the configuration file
5719 (<option>queue_only</option> or <option>queue_only_file</option>, for example) is in effect, <option>-odb</option>
5720 overrides it if <option>queue_only_override</option> is set true, which is the default
5721 setting. If <option>queue_only_override</option> is set false, <option>-odb</option> has no effect.
5723 </listitem></varlistentry>
5725 <term><option>-odf</option></term>
5728 <indexterm role="option">
5729 <primary><option>-odf</option></primary>
5731 <indexterm role="concept">
5732 <primary>foreground delivery</primary>
5734 <indexterm role="concept">
5735 <primary>delivery</primary>
5736 <secondary>in the foreground</secondary>
5738 This option requests <quote>foreground</quote> (synchronous) delivery when Exim has
5739 accepted a locally-generated message. (For the daemon it is exactly the same as
5740 <option>-odb</option>.) A delivery process is automatically started to deliver the message,
5741 and Exim waits for it to complete before proceeding.
5744 The original Exim reception process does not finish until the delivery
5745 process for the final message has ended. The standard error stream is left open
5749 However, like <option>-odb</option>, this option has no effect if <option>queue_only_override</option> is
5750 false and one of the queueing options in the configuration file is in effect.
5753 If there is a temporary delivery error during foreground delivery, the
5754 message is left on the queue for later delivery, and the original reception
5755 process exits. See chapter <xref linkend="CHAPnonqueueing"/> for a way of setting up a
5756 restricted configuration that never queues messages.
5758 </listitem></varlistentry>
5760 <term><option>-odi</option></term>
5763 <indexterm role="option">
5764 <primary><option>-odi</option></primary>
5766 This option is synonymous with <option>-odf</option>. It is provided for compatibility with
5769 </listitem></varlistentry>
5771 <term><option>-odq</option></term>
5774 <indexterm role="option">
5775 <primary><option>-odq</option></primary>
5777 <indexterm role="concept">
5778 <primary>non-immediate delivery</primary>
5780 <indexterm role="concept">
5781 <primary>delivery</primary>
5782 <secondary>suppressing immediate</secondary>
5784 <indexterm role="concept">
5785 <primary>queueing incoming messages</primary>
5787 This option applies to all modes in which Exim accepts incoming messages,
5788 including the listening daemon. It specifies that the accepting process should
5789 not automatically start a delivery process for each message received. Messages
5790 are placed on the queue, and remain there until a subsequent queue runner
5791 process encounters them. There are several configuration options (such as
5792 <option>queue_only</option>) that can be used to queue incoming messages under certain
5793 conditions. This option overrides all of them and also <option>-odqs</option>. It always
5796 </listitem></varlistentry>
5798 <term><option>-odqs</option></term>
5801 <indexterm role="option">
5802 <primary><option>-odqs</option></primary>
5804 <indexterm role="concept">
5805 <primary>SMTP</primary>
5806 <secondary>delaying delivery</secondary>
5808 This option is a hybrid between <option>-odb</option>/<option>-odi</option> and <option>-odq</option>.
5809 However, like <option>-odb</option> and <option>-odi</option>, this option has no effect if
5810 <option>queue_only_override</option> is false and one of the queueing options in the
5811 configuration file is in effect.
5814 When <option>-odqs</option> does operate, a delivery process is started for each incoming
5815 message, in the background by default, but in the foreground if <option>-odi</option> is
5816 also present. The recipient addresses are routed, and local deliveries are done
5817 in the normal way. However, if any SMTP deliveries are required, they are not
5818 done at this time, so the message remains on the queue until a subsequent queue
5819 runner process encounters it. Because routing was done, Exim knows which
5820 messages are waiting for which hosts, and so a number of messages for the same
5821 host can be sent in a single SMTP connection. The <option>queue_smtp_domains</option>
5822 configuration option has the same effect for specific domains. See also the
5823 <option>-qq</option> option.
5825 </listitem></varlistentry>
5827 <term><option>-oee</option></term>
5830 <indexterm role="option">
5831 <primary><option>-oee</option></primary>
5833 <indexterm role="concept">
5834 <primary>error</primary>
5835 <secondary>reporting</secondary>
5837 If an error is detected while a non-SMTP message is being received (for
5838 example, a malformed address), the error is reported to the sender in a mail
5842 <indexterm role="concept">
5843 <primary>return code</primary>
5844 <secondary>for <option>-oee</option></secondary>
5847 this error message is successfully sent, the Exim receiving process
5848 exits with a return code of zero. If not, the return code is 2 if the problem
5849 is that the original message has no recipients, or 1 any other error. This is
5850 the default <option>-oe</option><emphasis>x</emphasis> option if Exim is called as <emphasis>rmail</emphasis>.
5852 </listitem></varlistentry>
5854 <term><option>-oem</option></term>
5857 <indexterm role="option">
5858 <primary><option>-oem</option></primary>
5860 <indexterm role="concept">
5861 <primary>error</primary>
5862 <secondary>reporting</secondary>
5864 <indexterm role="concept">
5865 <primary>return code</primary>
5866 <secondary>for <option>-oem</option></secondary>
5868 This is the same as <option>-oee</option>, except that Exim always exits with a non-zero
5869 return code, whether or not the error message was successfully sent.
5870 This is the default <option>-oe</option><emphasis>x</emphasis> option, unless Exim is called as <emphasis>rmail</emphasis>.
5872 </listitem></varlistentry>
5874 <term><option>-oep</option></term>
5877 <indexterm role="option">
5878 <primary><option>-oep</option></primary>
5880 <indexterm role="concept">
5881 <primary>error</primary>
5882 <secondary>reporting</secondary>
5884 If an error is detected while a non-SMTP message is being received, the
5885 error is reported by writing a message to the standard error file (stderr).
5886 <indexterm role="concept">
5887 <primary>return code</primary>
5888 <secondary>for <option>-oep</option></secondary>
5890 The return code is 1 for all errors.
5892 </listitem></varlistentry>
5894 <term><option>-oeq</option></term>
5897 <indexterm role="option">
5898 <primary><option>-oeq</option></primary>
5900 <indexterm role="concept">
5901 <primary>error</primary>
5902 <secondary>reporting</secondary>
5904 This option is supported for compatibility with Sendmail, but has the same
5905 effect as <option>-oep</option>.
5907 </listitem></varlistentry>
5909 <term><option>-oew</option></term>
5912 <indexterm role="option">
5913 <primary><option>-oew</option></primary>
5915 <indexterm role="concept">
5916 <primary>error</primary>
5917 <secondary>reporting</secondary>
5919 This option is supported for compatibility with Sendmail, but has the same
5920 effect as <option>-oem</option>.
5922 </listitem></varlistentry>
5924 <term><option>-oi</option></term>
5927 <indexterm role="option">
5928 <primary><option>-oi</option></primary>
5930 <indexterm role="concept">
5931 <primary>dot</primary>
5932 <secondary>in incoming non-SMTP message</secondary>
5934 This option, which has the same effect as <option>-i</option>, specifies that a dot on a
5935 line by itself should not terminate an incoming, non-SMTP message. Otherwise, a
5936 single dot does terminate, though Exim does no special processing for other
5937 lines that start with a dot. This option is set by default if Exim is called as
5938 <emphasis>rmail</emphasis>. See also <option>-ti</option>.
5940 </listitem></varlistentry>
5942 <term><option>-oitrue</option></term>
5945 <indexterm role="option">
5946 <primary><option>-oitrue</option></primary>
5948 This option is treated as synonymous with <option>-oi</option>.
5950 </listitem></varlistentry>
5952 <term><option>-oMa</option> <<emphasis>host address</emphasis>></term>
5955 <indexterm role="option">
5956 <primary><option>-oMa</option></primary>
5958 <indexterm role="concept">
5959 <primary>sender</primary>
5960 <secondary>host address, specifying for local message</secondary>
5962 A number of options starting with <option>-oM</option> can be used to set values associated
5963 with remote hosts on locally-submitted messages (that is, messages not received
5964 over TCP/IP). These options can be used by any caller in conjunction with the
5965 <option>-bh</option>, <option>-be</option>, <option>-bf</option>, <option>-bF</option>, <option>-bt</option>, or <option>-bv</option> testing options. In
5966 other circumstances, they are ignored unless the caller is trusted.
5969 The <option>-oMa</option> option sets the sender host address. This may include a port
5970 number at the end, after a full stop (period). For example:
5972 <literallayout class="monospaced">
5973 exim -bs -oMa 10.9.8.7.1234
5976 An alternative syntax is to enclose the IP address in square brackets,
5977 followed by a colon and the port number:
5979 <literallayout class="monospaced">
5980 exim -bs -oMa [10.9.8.7]:1234
5983 The IP address is placed in the <varname>$sender_host_address</varname> variable, and the
5984 port, if present, in <varname>$sender_host_port</varname>. If both <option>-oMa</option> and <option>-bh</option>
5985 are present on the command line, the sender host IP address is taken from
5986 whichever one is last.
5988 </listitem></varlistentry>
5990 <term><option>-oMaa</option> <<emphasis>name</emphasis>></term>
5993 <indexterm role="option">
5994 <primary><option>-oMaa</option></primary>
5996 <indexterm role="concept">
5997 <primary>authentication</primary>
5998 <secondary>name, specifying for local message</secondary>
6000 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMaa</option>
6001 option sets the value of <varname>$sender_host_authenticated</varname> (the authenticator
6002 name). See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of SMTP authentication.
6003 This option can be used with <option>-bh</option> and <option>-bs</option> to set up an
6004 authenticated SMTP session without actually using the SMTP AUTH command.
6006 </listitem></varlistentry>
6008 <term><option>-oMai</option> <<emphasis>string</emphasis>></term>
6011 <indexterm role="option">
6012 <primary><option>-oMai</option></primary>
6014 <indexterm role="concept">
6015 <primary>authentication</primary>
6016 <secondary>id, specifying for local message</secondary>
6018 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMai</option>
6019 option sets the value of <varname>$authenticated_id</varname> (the id that was authenticated).
6020 This overrides the default value (the caller’s login id, except with <option>-bh</option>,
6021 where there is no default) for messages from local sources. See chapter
6022 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated ids.
6024 </listitem></varlistentry>
6026 <term><option>-oMas</option> <<emphasis>address</emphasis>></term>
6029 <indexterm role="option">
6030 <primary><option>-oMas</option></primary>
6032 <indexterm role="concept">
6033 <primary>authentication</primary>
6034 <secondary>sender, specifying for local message</secondary>
6036 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMas</option>
6037 option sets the authenticated sender value in <varname>$authenticated_sender</varname>. It
6038 overrides the sender address that is created from the caller’s login id for
6039 messages from local sources, except when <option>-bh</option> is used, when there is no
6040 default. For both <option>-bh</option> and <option>-bs</option>, an authenticated sender that is
6041 specified on a MAIL command overrides this value. See chapter
6042 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated senders.
6044 </listitem></varlistentry>
6046 <term><option>-oMi</option> <<emphasis>interface address</emphasis>></term>
6049 <indexterm role="option">
6050 <primary><option>-oMi</option></primary>
6052 <indexterm role="concept">
6053 <primary>interface</primary>
6054 <secondary>address, specifying for local message</secondary>
6056 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMi</option>
6057 option sets the IP interface address value. A port number may be included,
6058 using the same syntax as for <option>-oMa</option>. The interface address is placed in
6059 <varname>$received_ip_address</varname> and the port number, if present, in <varname>$received_port</varname>.
6061 </listitem></varlistentry>
6063 <term><option>-oMr</option> <<emphasis>protocol name</emphasis>></term>
6066 <indexterm role="option">
6067 <primary><option>-oMr</option></primary>
6069 <indexterm role="concept">
6070 <primary>protocol, specifying for local message</primary>
6072 <indexterm role="variable">
6073 <primary><varname>$received_protocol</varname></primary>
6075 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMr</option>
6076 option sets the received protocol value that is stored in
6077 <varname>$received_protocol</varname>. However, it does not apply (and is ignored) when <option>-bh</option>
6078 or <option>-bs</option> is used. For <option>-bh</option>, the protocol is forced to one of the standard
6079 SMTP protocol names (see the description of <varname>$received_protocol</varname> in section
6080 <xref linkend="SECTexpvar"/>). For <option>-bs</option>, the protocol is always <quote>local-</quote> followed by
6081 one of those same names. For <option>-bS</option> (batched SMTP) however, the protocol can
6082 be set by <option>-oMr</option>.
6084 </listitem></varlistentry>
6086 <term><option>-oMs</option> <<emphasis>host name</emphasis>></term>
6089 <indexterm role="option">
6090 <primary><option>-oMs</option></primary>
6092 <indexterm role="concept">
6093 <primary>sender</primary>
6094 <secondary>host name, specifying for local message</secondary>
6096 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMs</option>
6097 option sets the sender host name in <varname>$sender_host_name</varname>. When this option is
6098 present, Exim does not attempt to look up a host name from an IP address; it
6099 uses the name it is given.
6101 </listitem></varlistentry>
6103 <term><option>-oMt</option> <<emphasis>ident string</emphasis>></term>
6106 <indexterm role="option">
6107 <primary><option>-oMt</option></primary>
6109 <indexterm role="concept">
6110 <primary>sender</primary>
6111 <secondary>ident string, specifying for local message</secondary>
6113 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMt</option>
6114 option sets the sender ident value in <varname>$sender_ident</varname>. The default setting for
6115 local callers is the login id of the calling process, except when <option>-bh</option> is
6116 used, when there is no default.
6118 </listitem></varlistentry>
6120 <term><option>-om</option></term>
6123 <indexterm role="option">
6124 <primary><option>-om</option></primary>
6126 <indexterm role="concept">
6127 <primary>Sendmail compatibility</primary>
6128 <secondary><option>-om</option> option ignored</secondary>
6130 In Sendmail, this option means <quote>me too</quote>, indicating that the sender of a
6131 message should receive a copy of the message if the sender appears in an alias
6132 expansion. Exim always does this, so the option does nothing.
6134 </listitem></varlistentry>
6136 <term><option>-oo</option></term>
6139 <indexterm role="option">
6140 <primary><option>-oo</option></primary>
6142 <indexterm role="concept">
6143 <primary>Sendmail compatibility</primary>
6144 <secondary><option>-oo</option> option ignored</secondary>
6146 This option is ignored. In Sendmail it specifies <quote>old style headers</quote>,
6147 whatever that means.
6149 </listitem></varlistentry>
6151 <term><option>-oP</option> <<emphasis>path</emphasis>></term>
6154 <indexterm role="option">
6155 <primary><option>-oP</option></primary>
6157 <indexterm role="concept">
6158 <primary>pid (process id)</primary>
6159 <secondary>of daemon</secondary>
6161 <indexterm role="concept">
6162 <primary>daemon</primary>
6163 <secondary>process id (pid)</secondary>
6165 This option is useful only in conjunction with <option>-bd</option> or <option>-q</option> with a time
6166 value. The option specifies the file to which the process id of the daemon is
6167 written. When <option>-oX</option> is used with <option>-bd</option>, or when <option>-q</option> with a time is used
6168 without <option>-bd</option>, this is the only way of causing Exim to write a pid file,
6169 because in those cases, the normal pid file is not used.
6171 </listitem></varlistentry>
6173 <term><option>-or</option> <<emphasis>time</emphasis>></term>
6176 <indexterm role="option">
6177 <primary><option>-or</option></primary>
6179 <indexterm role="concept">
6180 <primary>timeout</primary>
6181 <secondary>for non-SMTP input</secondary>
6183 This option sets a timeout value for incoming non-SMTP messages. If it is not
6184 set, Exim will wait forever for the standard input. The value can also be set
6185 by the <option>receive_timeout</option> option. The format used for specifying times is
6186 described in section <xref linkend="SECTtimeformat"/>.
6188 </listitem></varlistentry>
6190 <term><option>-os</option> <<emphasis>time</emphasis>></term>
6193 <indexterm role="option">
6194 <primary><option>-os</option></primary>
6196 <indexterm role="concept">
6197 <primary>timeout</primary>
6198 <secondary>for SMTP input</secondary>
6200 <indexterm role="concept">
6201 <primary>SMTP</primary>
6202 <secondary>input timeout</secondary>
6204 This option sets a timeout value for incoming SMTP messages. The timeout
6205 applies to each SMTP command and block of data. The value can also be set by
6206 the <option>smtp_receive_timeout</option> option; it defaults to 5 minutes. The format used
6207 for specifying times is described in section <xref linkend="SECTtimeformat"/>.
6209 </listitem></varlistentry>
6211 <term><option>-ov</option></term>
6214 <indexterm role="option">
6215 <primary><option>-ov</option></primary>
6217 This option has exactly the same effect as <option>-v</option>.
6219 </listitem></varlistentry>
6221 <term><option>-oX</option> <<emphasis>number or string</emphasis>></term>
6224 <indexterm role="option">
6225 <primary><option>-oX</option></primary>
6227 <indexterm role="concept">
6228 <primary>TCP/IP</primary>
6229 <secondary>setting listening ports</secondary>
6231 <indexterm role="concept">
6232 <primary>TCP/IP</primary>
6233 <secondary>setting listening interfaces</secondary>
6235 <indexterm role="concept">
6236 <primary>port</primary>
6237 <secondary>receiving TCP/IP</secondary>
6239 This option is relevant only when the <option>-bd</option> (start listening daemon) option
6240 is also given. It controls which ports and interfaces the daemon uses. Details
6241 of the syntax, and how it interacts with configuration file options, are given
6242 in chapter <xref linkend="CHAPinterfaces"/>. When <option>-oX</option> is used to start a daemon, no pid
6243 file is written unless <option>-oP</option> is also present to specify a pid file name.
6245 </listitem></varlistentry>
6247 <term><option>-pd</option></term>
6250 <indexterm role="option">
6251 <primary><option>-pd</option></primary>
6253 <indexterm role="concept">
6254 <primary>Perl</primary>
6255 <secondary>starting the interpreter</secondary>
6257 This option applies when an embedded Perl interpreter is linked with Exim (see
6258 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6259 option, forcing the starting of the interpreter to be delayed until it is
6262 </listitem></varlistentry>
6264 <term><option>-ps</option></term>
6267 <indexterm role="option">
6268 <primary><option>-ps</option></primary>
6270 <indexterm role="concept">
6271 <primary>Perl</primary>
6272 <secondary>starting the interpreter</secondary>
6274 This option applies when an embedded Perl interpreter is linked with Exim (see
6275 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6276 option, forcing the starting of the interpreter to occur as soon as Exim is
6279 </listitem></varlistentry>
6281 <term><option>-p</option><<emphasis>rval</emphasis>>:<<emphasis>sval</emphasis>></term>
6284 <indexterm role="option">
6285 <primary><option>-p</option></primary>
6287 For compatibility with Sendmail, this option is equivalent to
6290 <literal>-oMr</literal> <<emphasis>rval</emphasis>> <literal>-oMs</literal> <<emphasis>sval</emphasis>>
6293 It sets the incoming protocol and host name (for trusted callers). The
6294 host name and its colon can be omitted when only the protocol is to be set.
6295 Note the Exim already has two private options, <option>-pd</option> and <option>-ps</option>, that refer
6296 to embedded Perl. It is therefore impossible to set a protocol value of <literal>p</literal>
6297 or <literal>s</literal> using this option (but that does not seem a real limitation).
6299 </listitem></varlistentry>
6301 <term><option>-q</option></term>
6304 <indexterm role="option">
6305 <primary><option>-q</option></primary>
6307 <indexterm role="concept">
6308 <primary>queue runner</primary>
6309 <secondary>starting manually</secondary>
6311 This option is normally restricted to admin users. However, there is a
6312 configuration option called <option>prod_requires_admin</option> which can be set false to
6313 relax this restriction (and also the same requirement for the <option>-M</option>, <option>-R</option>,
6314 and <option>-S</option> options).
6317 <indexterm role="concept">
6318 <primary>queue runner</primary>
6319 <secondary>description of operation</secondary>
6321 The <option>-q</option> option starts one queue runner process. This scans the queue of
6322 waiting messages, and runs a delivery process for each one in turn. It waits
6323 for each delivery process to finish before starting the next one. A delivery
6324 process may not actually do any deliveries if the retry times for the addresses
6325 have not been reached. Use <option>-qf</option> (see below) if you want to override this.
6329 <indexterm role="concept">
6330 <primary>SMTP</primary>
6331 <secondary>passed connection</secondary>
6333 <indexterm role="concept">
6334 <primary>SMTP</primary>
6335 <secondary>multiple deliveries</secondary>
6337 <indexterm role="concept">
6338 <primary>multiple SMTP deliveries</primary>
6340 the delivery process spawns other processes to deliver other messages down
6341 passed SMTP connections, the queue runner waits for these to finish before
6345 When all the queued messages have been considered, the original queue runner
6346 process terminates. In other words, a single pass is made over the waiting
6347 mail, one message at a time. Use <option>-q</option> with a time (see below) if you want
6348 this to be repeated periodically.
6351 Exim processes the waiting messages in an unpredictable order. It isn’t very
6352 random, but it is likely to be different each time, which is all that matters.
6353 If one particular message screws up a remote MTA, other messages to the same
6354 MTA have a chance of getting through if they get tried first.
6357 It is possible to cause the messages to be processed in lexical message id
6358 order, which is essentially the order in which they arrived, by setting the
6359 <option>queue_run_in_order</option> option, but this is not recommended for normal use.
6361 </listitem></varlistentry>
6363 <term><option>-q</option><<emphasis>qflags</emphasis>></term>
6366 The <option>-q</option> option may be followed by one or more flag letters that change its
6367 behaviour. They are all optional, but if more than one is present, they must
6368 appear in the correct order. Each flag is described in a separate item below.
6370 </listitem></varlistentry>
6372 <term><option>-qq...</option></term>
6375 <indexterm role="option">
6376 <primary><option>-qq</option></primary>
6378 <indexterm role="concept">
6379 <primary>queue</primary>
6380 <secondary>double scanning</secondary>
6382 <indexterm role="concept">
6383 <primary>queue</primary>
6384 <secondary>routing</secondary>
6386 <indexterm role="concept">
6387 <primary>routing</primary>
6388 <secondary>whole queue before delivery</secondary>
6390 An option starting with <option>-qq</option> requests a two-stage queue run. In the first
6391 stage, the queue is scanned as if the <option>queue_smtp_domains</option> option matched
6392 every domain. Addresses are routed, local deliveries happen, but no remote
6396 <indexterm role="concept">
6397 <primary>hints database</primary>
6398 <secondary>remembering routing</secondary>
6400 The hints database that remembers which messages are waiting for specific hosts
6401 is updated, as if delivery to those hosts had been deferred. After this is
6402 complete, a second, normal queue scan happens, with routing and delivery taking
6403 place as normal. Messages that are routed to the same host should mostly be
6404 delivered down a single SMTP
6405 <indexterm role="concept">
6406 <primary>SMTP</primary>
6407 <secondary>passed connection</secondary>
6409 <indexterm role="concept">
6410 <primary>SMTP</primary>
6411 <secondary>multiple deliveries</secondary>
6413 <indexterm role="concept">
6414 <primary>multiple SMTP deliveries</primary>
6416 connection because of the hints that were set up during the first queue scan.
6417 This option may be useful for hosts that are connected to the Internet
6420 </listitem></varlistentry>
6422 <term><option>-q[q]i...</option></term>
6425 <indexterm role="option">
6426 <primary><option>-qi</option></primary>
6428 <indexterm role="concept">
6429 <primary>queue</primary>
6430 <secondary>initial delivery</secondary>
6432 If the <emphasis>i</emphasis> flag is present, the queue runner runs delivery processes only for
6433 those messages that haven’t previously been tried. (<emphasis>i</emphasis> stands for <quote>initial
6434 delivery</quote>.) This can be helpful if you are putting messages on the queue using
6435 <option>-odq</option> and want a queue runner just to process the new messages.
6437 </listitem></varlistentry>
6439 <term><option>-q[q][i]f...</option></term>
6442 <indexterm role="option">
6443 <primary><option>-qf</option></primary>
6445 <indexterm role="concept">
6446 <primary>queue</primary>
6447 <secondary>forcing delivery</secondary>
6449 <indexterm role="concept">
6450 <primary>delivery</primary>
6451 <secondary>forcing in queue run</secondary>
6453 If one <emphasis>f</emphasis> flag is present, a delivery attempt is forced for each non-frozen
6454 message, whereas without <emphasis>f</emphasis> only those non-frozen addresses that have passed
6455 their retry times are tried.
6457 </listitem></varlistentry>
6459 <term><option>-q[q][i]ff...</option></term>
6462 <indexterm role="option">
6463 <primary><option>-qff</option></primary>
6465 <indexterm role="concept">
6466 <primary>frozen messages</primary>
6467 <secondary>forcing delivery</secondary>
6469 If <emphasis>ff</emphasis> is present, a delivery attempt is forced for every message, whether
6472 </listitem></varlistentry>
6474 <term><option>-q[q][i][f[f]]l</option></term>
6477 <indexterm role="option">
6478 <primary><option>-ql</option></primary>
6480 <indexterm role="concept">
6481 <primary>queue</primary>
6482 <secondary>local deliveries only</secondary>
6484 The <emphasis>l</emphasis> (the letter <quote>ell</quote>) flag specifies that only local deliveries are to
6485 be done. If a message requires any remote deliveries, it remains on the queue
6488 </listitem></varlistentry>
6490 <term><option>-q</option><<emphasis>qflags</emphasis>> <<emphasis>start id</emphasis>> <<emphasis>end id</emphasis>></term>
6493 <indexterm role="concept">
6494 <primary>queue</primary>
6495 <secondary>delivering specific messages</secondary>
6497 When scanning the queue, Exim can be made to skip over messages whose ids are
6498 lexically less than a given value by following the <option>-q</option> option with a
6499 starting message id. For example:
6501 <literallayout class="monospaced">
6502 exim -q 0t5C6f-0000c8-00
6505 Messages that arrived earlier than <literal>0t5C6f-0000c8-00</literal> are not inspected. If a
6506 second message id is given, messages whose ids are lexically greater than it
6507 are also skipped. If the same id is given twice, for example,
6509 <literallayout class="monospaced">
6510 exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00
6513 just one delivery process is started, for that message. This differs from
6514 <option>-M</option> in that retry data is respected, and it also differs from <option>-Mc</option> in
6515 that it counts as a delivery from a queue run. Note that the selection
6516 mechanism does not affect the order in which the messages are scanned. There
6517 are also other ways of selecting specific sets of messages for delivery in a
6518 queue run – see <option>-R</option> and <option>-S</option>.
6520 </listitem></varlistentry>
6522 <term><option>-q</option><<emphasis>qflags</emphasis>><<emphasis>time</emphasis>></term>
6525 <indexterm role="concept">
6526 <primary>queue runner</primary>
6527 <secondary>starting periodically</secondary>
6529 <indexterm role="concept">
6530 <primary>periodic queue running</primary>
6532 When a time value is present, the <option>-q</option> option causes Exim to run as a daemon,
6533 starting a queue runner process at intervals specified by the given time value
6534 (whose format is described in section <xref linkend="SECTtimeformat"/>). This form of the
6535 <option>-q</option> option is commonly combined with the <option>-bd</option> option, in which case a
6536 single daemon process handles both functions. A common way of starting up a
6537 combined daemon at system boot time is to use a command such as
6539 <literallayout class="monospaced">
6540 /usr/exim/bin/exim -bd -q30m
6543 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
6544 process every 30 minutes.
6547 When a daemon is started by <option>-q</option> with a time value, but without <option>-bd</option>, no
6548 pid file is written unless one is explicitly requested by the <option>-oP</option> option.
6550 </listitem></varlistentry>
6552 <term><option>-qR</option><<emphasis>rsflags</emphasis>> <<emphasis>string</emphasis>></term>
6555 <indexterm role="option">
6556 <primary><option>-qR</option></primary>
6558 This option is synonymous with <option>-R</option>. It is provided for Sendmail
6561 </listitem></varlistentry>
6563 <term><option>-qS</option><<emphasis>rsflags</emphasis>> <<emphasis>string</emphasis>></term>
6566 <indexterm role="option">
6567 <primary><option>-qS</option></primary>
6569 This option is synonymous with <option>-S</option>.
6571 </listitem></varlistentry>
6573 <term><option>-R</option><<emphasis>rsflags</emphasis>> <<emphasis>string</emphasis>></term>
6576 <indexterm role="option">
6577 <primary><option>-R</option></primary>
6579 <indexterm role="concept">
6580 <primary>queue runner</primary>
6581 <secondary>for specific recipients</secondary>
6583 <indexterm role="concept">
6584 <primary>delivery</primary>
6585 <secondary>to given domain</secondary>
6587 <indexterm role="concept">
6588 <primary>domain</primary>
6589 <secondary>delivery to</secondary>
6591 The <<emphasis>rsflags</emphasis>> may be empty, in which case the white space before the string
6592 is optional, unless the string is <emphasis>f</emphasis>, <emphasis>ff</emphasis>, <emphasis>r</emphasis>, <emphasis>rf</emphasis>, or <emphasis>rff</emphasis>,
6593 which are the possible values for <<emphasis>rsflags</emphasis>>. White space is required if
6594 <<emphasis>rsflags</emphasis>> is not empty.
6597 This option is similar to <option>-q</option> with no time value, that is, it causes Exim to
6598 perform a single queue run, except that, when scanning the messages on the
6599 queue, Exim processes only those that have at least one undelivered recipient
6600 address containing the given string, which is checked in a case-independent
6601 way. If the <<emphasis>rsflags</emphasis>> start with <emphasis>r</emphasis>, <<emphasis>string</emphasis>> is interpreted as a
6602 regular expression; otherwise it is a literal string.
6605 If you want to do periodic queue runs for messages with specific recipients,
6606 you can combine <option>-R</option> with <option>-q</option> and a time value. For example:
6608 <literallayout class="monospaced">
6609 exim -q25m -R @special.domain.example
6612 This example does a queue run for messages with recipients in the given domain
6613 every 25 minutes. Any additional flags that are specified with <option>-q</option> are
6614 applied to each queue run.
6617 Once a message is selected for delivery by this mechanism, all its addresses
6618 are processed. For the first selected message, Exim overrides any retry
6619 information and forces a delivery attempt for each undelivered address. This
6620 means that if delivery of any address in the first message is successful, any
6621 existing retry information is deleted, and so delivery attempts for that
6622 address in subsequently selected messages (which are processed without forcing)
6623 will run. However, if delivery of any address does not succeed, the retry
6624 information is updated, and in subsequently selected messages, the failing
6625 address will be skipped.
6628 <indexterm role="concept">
6629 <primary>frozen messages</primary>
6630 <secondary>forcing delivery</secondary>
6632 If the <<emphasis>rsflags</emphasis>> contain <emphasis>f</emphasis> or <emphasis>ff</emphasis>, the delivery forcing applies to
6633 all selected messages, not just the first; frozen messages are included when
6634 <emphasis>ff</emphasis> is present.
6637 The <option>-R</option> option makes it straightforward to initiate delivery of all messages
6638 to a given domain after a host has been down for some time. When the SMTP
6639 command ETRN is accepted by its ACL (see chapter <xref linkend="CHAPACL"/>), its default
6640 effect is to run Exim with the <option>-R</option> option, but it can be configured to run
6641 an arbitrary command instead.
6643 </listitem></varlistentry>
6645 <term><option>-r</option></term>
6648 <indexterm role="option">
6649 <primary><option>-r</option></primary>
6651 This is a documented (for Sendmail) obsolete alternative name for <option>-f</option>.
6653 </listitem></varlistentry>
6655 <term><option>-S</option><<emphasis>rsflags</emphasis>> <<emphasis>string</emphasis>></term>
6658 <indexterm role="option">
6659 <primary><option>-S</option></primary>
6661 <indexterm role="concept">
6662 <primary>delivery</primary>
6663 <secondary>from given sender</secondary>
6665 <indexterm role="concept">
6666 <primary>queue runner</primary>
6667 <secondary>for specific senders</secondary>
6669 This option acts like <option>-R</option> except that it checks the string against each
6670 message’s sender instead of against the recipients. If <option>-R</option> is also set, both
6671 conditions must be met for a message to be selected. If either of the options
6672 has <emphasis>f</emphasis> or <emphasis>ff</emphasis> in its flags, the associated action is taken.
6674 </listitem></varlistentry>
6676 <term><option>-Tqt</option> <<emphasis>times</emphasis>></term>
6679 <indexterm role="option">
6680 <primary><option>-Tqt</option></primary>
6682 This an option that is exclusively for use by the Exim testing suite. It is not
6683 recognized when Exim is run normally. It allows for the setting up of explicit
6684 <quote>queue times</quote> so that various warning/retry features can be tested.
6686 </listitem></varlistentry>
6688 <term><option>-t</option></term>
6691 <indexterm role="option">
6692 <primary><option>-t</option></primary>
6694 <indexterm role="concept">
6695 <primary>recipient</primary>
6696 <secondary>extracting from header lines</secondary>
6698 <indexterm role="concept">
6699 <primary><emphasis>Bcc:</emphasis> header line</primary>
6701 <indexterm role="concept">
6702 <primary><emphasis>Cc:</emphasis> header line</primary>
6704 <indexterm role="concept">
6705 <primary><emphasis>To:</emphasis> header line</primary>
6707 When Exim is receiving a locally-generated, non-SMTP message on its standard
6708 input, the <option>-t</option> option causes the recipients of the message to be obtained
6709 from the <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis> header lines in the message instead of
6710 from the command arguments. The addresses are extracted before any rewriting
6711 takes place and the <emphasis>Bcc:</emphasis> header line, if present, is then removed.
6714 <indexterm role="concept">
6715 <primary>Sendmail compatibility</primary>
6716 <secondary><option>-t</option> option</secondary>
6718 If the command has any arguments, they specify addresses to which the message
6719 is <emphasis>not</emphasis> to be delivered. That is, the argument addresses are removed from
6720 the recipients list obtained from the headers. This is compatible with Smail 3
6721 and in accordance with the documented behaviour of several versions of
6722 Sendmail, as described in man pages on a number of operating systems (e.g.
6723 Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail <emphasis>add</emphasis>
6724 argument addresses to those obtained from the headers, and the O’Reilly
6725 Sendmail book documents it that way. Exim can be made to add argument addresses
6726 instead of subtracting them by setting the option
6727 <option>extract_addresses_remove_arguments</option> false.
6730 <indexterm role="concept">
6731 <primary><option>Resent-</option> header lines</primary>
6732 <secondary>with <option>-t</option></secondary>
6734 If there are any <option>Resent-</option> header lines in the message, Exim extracts
6735 recipients from all <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>, and <emphasis>Resent-Bcc:</emphasis> header
6736 lines instead of from <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis>. This is for compatibility
6737 with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if
6738 <option>-t</option> was used in conjunction with <option>Resent-</option> header lines.)
6741 RFC 2822 talks about different sets of <option>Resent-</option> header lines (for when a
6742 message is resent several times). The RFC also specifies that they should be
6743 added at the front of the message, and separated by <emphasis>Received:</emphasis> lines. It is
6744 not at all clear how <option>-t</option> should operate in the present of multiple sets,
6745 nor indeed exactly what constitutes a <quote>set</quote>.
6746 In practice, it seems that MUAs do not follow the RFC. The <option>Resent-</option> lines
6747 are often added at the end of the header, and if a message is resent more than
6748 once, it is common for the original set of <option>Resent-</option> headers to be renamed as
6749 <option>X-Resent-</option> when a new set is added. This removes any possible ambiguity.
6751 </listitem></varlistentry>
6753 <term><option>-ti</option></term>
6756 <indexterm role="option">
6757 <primary><option>-ti</option></primary>
6759 This option is exactly equivalent to <option>-t</option> <option>-i</option>. It is provided for
6760 compatibility with Sendmail.
6762 </listitem></varlistentry>
6764 <term><option>-tls-on-connect</option></term>
6767 <indexterm role="option">
6768 <primary><option>-tls-on-connect</option></primary>
6770 <indexterm role="concept">
6771 <primary>TLS</primary>
6772 <secondary>use without STARTTLS</secondary>
6774 <indexterm role="concept">
6775 <primary>TLS</primary>
6776 <secondary>automatic start</secondary>
6778 This option is available when Exim is compiled with TLS support. It forces all
6779 incoming SMTP connections to behave as if the incoming port is listed in the
6780 <option>tls_on_connect_ports</option> option. See section <xref linkend="SECTsupobssmt"/> and chapter
6781 <xref linkend="CHAPTLS"/> for further details.
6783 </listitem></varlistentry>
6785 <term><option>-U</option></term>
6788 <indexterm role="option">
6789 <primary><option>-U</option></primary>
6791 <indexterm role="concept">
6792 <primary>Sendmail compatibility</primary>
6793 <secondary><option>-U</option> option ignored</secondary>
6795 Sendmail uses this option for <quote>initial message submission</quote>, and its
6796 documentation states that in future releases, it may complain about
6797 syntactically invalid messages rather than fixing them when this flag is not
6798 set. Exim ignores this option.
6800 </listitem></varlistentry>
6802 <term><option>-v</option></term>
6805 <indexterm role="option">
6806 <primary><option>-v</option></primary>
6808 This option causes Exim to write information to the standard error stream,
6809 describing what it is doing. In particular, it shows the log lines for
6810 receiving and delivering a message, and if an SMTP connection is made, the SMTP
6811 dialogue is shown. Some of the log lines shown may not actually be written to
6812 the log if the setting of <option>log_selector</option> discards them. Any relevant
6813 selectors are shown with each log line. If none are shown, the logging is
6816 </listitem></varlistentry>
6818 <term><option>-x</option></term>
6821 <indexterm role="option">
6822 <primary><option>-x</option></primary>
6824 AIX uses <option>-x</option> for a private purpose (<quote>mail from a local mail program has
6825 National Language Support extended characters in the body of the mail item</quote>).
6826 It sets <option>-x</option> when calling the MTA from its <option>mail</option> command. Exim ignores
6829 </listitem></varlistentry>
6832 <indexterm role="concept" startref="IIDclo1" class="endofrange"/>
6833 <indexterm role="concept" startref="IIDclo2" class="endofrange"/>
6835 <!-- === End of command line options === -->
6839 <chapter id="CHAPconf">
6840 <title>The Exim run time configuration file</title>
6841 <titleabbrev>The runtime configuration file</titleabbrev>
6843 <indexterm role="concept">
6844 <primary>run time configuration</primary>
6846 <indexterm role="concept">
6847 <primary>configuration file</primary>
6848 <secondary>general description</secondary>
6850 <indexterm role="concept">
6851 <primary>CONFIGURE_FILE</primary>
6853 <indexterm role="concept">
6854 <primary>configuration file</primary>
6855 <secondary>errors in</secondary>
6857 <indexterm role="concept">
6858 <primary>error</primary>
6859 <secondary>in configuration file</secondary>
6861 <indexterm role="concept">
6862 <primary>return code</primary>
6863 <secondary>for bad configuration</secondary>
6865 Exim uses a single run time configuration file that is read whenever an Exim
6866 binary is executed. Note that in normal operation, this happens frequently,
6867 because Exim is designed to operate in a distributed manner, without central
6871 If a syntax error is detected while reading the configuration file, Exim
6872 writes a message on the standard error, and exits with a non-zero return code.
6873 The message is also written to the panic log. <emphasis role="bold">Note</emphasis>: Only simple syntax
6874 errors can be detected at this time. The values of any expanded options are
6875 not checked until the expansion happens, even when the expansion does not
6876 actually alter the string.
6879 The name of the configuration file is compiled into the binary for security
6880 reasons, and is specified by the CONFIGURE_FILE compilation option. In
6881 most configurations, this specifies a single file. However, it is permitted to
6882 give a colon-separated list of file names, in which case Exim uses the first
6883 existing file in the list.
6886 <indexterm role="concept">
6887 <primary>EXIM_USER</primary>
6889 <indexterm role="concept">
6890 <primary>EXIM_GROUP</primary>
6892 <indexterm role="concept">
6893 <primary>CONFIGURE_OWNER</primary>
6895 <indexterm role="concept">
6896 <primary>CONFIGURE_GROUP</primary>
6898 <indexterm role="concept">
6899 <primary>configuration file</primary>
6900 <secondary>ownership</secondary>
6902 <indexterm role="concept">
6903 <primary>ownership</primary>
6904 <secondary>configuration file</secondary>
6906 The run time configuration file must be owned by root or by the user that is
6907 specified at compile time by the EXIM_USER option, or by the user that is
6908 specified at compile time by the CONFIGURE_OWNER option (if set). The
6909 configuration file must not be world-writeable or group-writeable, unless its
6910 group is the one specified at compile time by the EXIM_GROUP option or by the
6911 CONFIGURE_GROUP option.
6914 <emphasis role="bold">Warning</emphasis>: In a conventional configuration, where the Exim binary is setuid
6915 to root, anybody who is able to edit the run time configuration file has an
6916 easy way to run commands as root. If you make your mail administrators members
6917 of the Exim group, but do not trust them with root, make sure that the run time
6918 configuration is not group writeable.
6921 A default configuration file, which will work correctly in simple situations,
6922 is provided in the file <filename>src/configure.default</filename>. If CONFIGURE_FILE
6923 defines just one file name, the installation process copies the default
6924 configuration to a new file of that name if it did not previously exist. If
6925 CONFIGURE_FILE is a list, no default is automatically installed. Chapter
6926 <xref linkend="CHAPdefconfil"/> is a <quote>walk-through</quote> discussion of the default
6929 <section id="SECID40">
6930 <title>Using a different configuration file</title>
6932 <indexterm role="concept">
6933 <primary>configuration file</primary>
6934 <secondary>alternate</secondary>
6936 A one-off alternate configuration can be specified by the <option>-C</option> command line
6937 option, which may specify a single file or a list of files. However, when
6938 <option>-C</option> is used, Exim gives up its root privilege, unless called by root or the
6939 Exim user (or unless the argument for <option>-C</option> is identical to the built-in value
6940 from CONFIGURE_FILE). <option>-C</option> is useful mainly for checking the syntax of
6941 configuration files before installing them. No owner or group checks are done
6942 on a configuration file specified by <option>-C</option>.
6945 The privileged use of <option>-C</option> by the Exim user can be locked out by setting
6946 ALT_CONFIG_ROOT_ONLY in <filename>Local/Makefile</filename> when building Exim. However,
6947 if you do this, you also lock out the possibility of testing a
6948 configuration using <option>-C</option> right through message reception and delivery, even
6949 if the caller is root. The reception works, but by that time, Exim is running
6950 as the Exim user, so when it re-execs to regain privilege for the delivery, the
6951 use of <option>-C</option> causes privilege to be lost. However, root can test reception and
6952 delivery using two separate commands (one to put a message on the queue, using
6953 <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
6956 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
6957 prefix string with which any file named in a <option>-C</option> command line option must
6958 start. In addition, the file name must not contain the sequence <quote><literal>/../</literal></quote>.
6959 There is no default setting for ALT_CONFIG_PREFIX; when it is unset, any file
6960 name can be used with <option>-C</option>.
6963 One-off changes to a configuration can be specified by the <option>-D</option> command line
6964 option, which defines and overrides values for macros used inside the
6965 configuration file. However, like <option>-C</option>, the use of this option by a
6966 non-privileged user causes Exim to discard its root privilege.
6967 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
6968 completely disabled, and its use causes an immediate error exit.
6971 Some sites may wish to use the same Exim binary on different machines that
6972 share a file system, but to use different configuration files on each machine.
6973 If CONFIGURE_FILE_USE_NODE is defined in <filename>Local/Makefile</filename>, Exim first
6974 looks for a file whose name is the configuration file name followed by a dot
6975 and the machine’s node name, as obtained from the <function>uname()</function> function. If this
6976 file does not exist, the standard name is tried. This processing occurs for
6977 each file name in the list given by CONFIGURE_FILE or <option>-C</option>.
6980 In some esoteric situations different versions of Exim may be run under
6981 different effective uids and the CONFIGURE_FILE_USE_EUID is defined to
6982 help with this. See the comments in <filename>src/EDITME</filename> for details.
6985 <section id="SECTconffilfor">
6986 <title>Configuration file format</title>
6988 <indexterm role="concept">
6989 <primary>configuration file</primary>
6990 <secondary>format of</secondary>
6992 <indexterm role="concept">
6993 <primary>format</primary>
6994 <secondary>configuration file</secondary>
6996 Exim’s configuration file is divided into a number of different parts. General
6997 option settings must always appear at the start of the file. The other parts
6998 are all optional, and may appear in any order. Each part other than the first
6999 is introduced by the word <quote>begin</quote> followed by the name of the part. The
7005 <emphasis>ACL</emphasis>: Access control lists for controlling incoming SMTP mail (see chapter
7006 <xref linkend="CHAPACL"/>).
7011 <indexterm role="concept">
7012 <primary>AUTH</primary>
7013 <secondary>configuration</secondary>
7015 <emphasis>authenticators</emphasis>: Configuration settings for the authenticator drivers. These
7016 are concerned with the SMTP AUTH command (see chapter <xref linkend="CHAPSMTPAUTH"/>).
7021 <emphasis>routers</emphasis>: Configuration settings for the router drivers. Routers process
7022 addresses and determine how the message is to be delivered (see chapters
7023 <xref linkend="CHAProutergeneric"/>–<xref linkend="CHAPredirect"/>).
7028 <emphasis>transports</emphasis>: Configuration settings for the transport drivers. Transports
7029 define mechanisms for copying messages to destinations (see chapters
7030 <xref linkend="CHAPtransportgeneric"/>–<xref linkend="CHAPsmtptrans"/>).
7035 <emphasis>retry</emphasis>: Retry rules, for use when a message cannot be delivered immediately.
7036 If there is no retry section, or if it is empty (that is, no retry rules are
7037 defined), Exim will not retry deliveries. In this situation, temporary errors
7038 are treated the same as permanent errors. Retry rules are discussed in chapter
7039 <xref linkend="CHAPretry"/>.
7044 <emphasis>rewrite</emphasis>: Global address rewriting rules, for use when a message arrives and
7045 when new addresses are generated during delivery. Rewriting is discussed in
7046 chapter <xref linkend="CHAPrewrite"/>.
7051 <emphasis>local_scan</emphasis>: Private options for the <function>local_scan()</function> function. If you
7052 want to use this feature, you must set
7054 <literallayout class="monospaced">
7055 LOCAL_SCAN_HAS_OPTIONS=yes
7058 in <filename>Local/Makefile</filename> before building Exim. Details of the <function>local_scan()</function>
7059 facility are given in chapter <xref linkend="CHAPlocalscan"/>.
7064 <indexterm role="concept">
7065 <primary>configuration file</primary>
7066 <secondary>leading white space in</secondary>
7068 <indexterm role="concept">
7069 <primary>configuration file</primary>
7070 <secondary>trailing white space in</secondary>
7072 <indexterm role="concept">
7073 <primary>white space</primary>
7074 <secondary>in configuration file</secondary>
7076 Leading and trailing white space in configuration lines is always ignored.
7079 Blank lines in the file, and lines starting with a # character (ignoring
7080 leading white space) are treated as comments and are ignored. <emphasis role="bold">Note</emphasis>: A
7081 # character other than at the beginning of a line is not treated specially,
7082 and does not introduce a comment.
7085 Any non-comment line can be continued by ending it with a backslash. Note that
7086 the general rule for white space means that trailing white space after the
7087 backslash and leading white space at the start of continuation
7088 lines is ignored. Comment lines beginning with # (but not empty lines) may
7089 appear in the middle of a sequence of continuation lines.
7092 A convenient way to create a configuration file is to start from the
7093 default, which is supplied in <filename>src/configure.default</filename>, and add, delete, or
7094 change settings as required.
7097 The ACLs, retry rules, and rewriting rules have their own syntax which is
7098 described in chapters <xref linkend="CHAPACL"/>, <xref linkend="CHAPretry"/>, and <xref linkend="CHAPrewrite"/>,
7099 respectively. The other parts of the configuration file have some syntactic
7100 items in common, and these are described below, from section <xref linkend="SECTcos"/>
7101 onwards. Before that, the inclusion, macro, and conditional facilities are
7105 <section id="SECID41">
7106 <title>File inclusions in the configuration file</title>
7108 <indexterm role="concept">
7109 <primary>inclusions in configuration file</primary>
7111 <indexterm role="concept">
7112 <primary>configuration file</primary>
7113 <secondary>including other files</secondary>
7115 <indexterm role="concept">
7116 <primary><literal>.include</literal> in configuration file</primary>
7118 <indexterm role="concept">
7119 <primary><literal>.include_if_exists</literal> in configuration file</primary>
7121 You can include other files inside Exim’s run time configuration file by
7125 <literal>.include</literal> <<emphasis>file name</emphasis>>
7126 <literal>.include_if_exists</literal> <<emphasis>file name</emphasis>>
7129 on a line by itself. Double quotes round the file name are optional. If you use
7130 the first form, a configuration error occurs if the file does not exist; the
7131 second form does nothing for non-existent files. In all cases, an absolute file
7135 Includes may be nested to any depth, but remember that Exim reads its
7136 configuration file often, so it is a good idea to keep them to a minimum.
7137 If you change the contents of an included file, you must HUP the daemon,
7138 because an included file is read only when the configuration itself is read.
7141 The processing of inclusions happens early, at a physical line level, so, like
7142 comment lines, an inclusion can be used in the middle of an option setting,
7145 <literallayout class="monospaced">
7146 hosts_lookup = a.b.c \
7150 Include processing happens after macro processing (see below). Its effect is to
7151 process the lines of the included file as if they occurred inline where the
7155 <section id="SECTmacrodefs">
7156 <title>Macros in the configuration file</title>
7158 <indexterm role="concept">
7159 <primary>macro</primary>
7160 <secondary>description of</secondary>
7162 <indexterm role="concept">
7163 <primary>configuration file</primary>
7164 <secondary>macros</secondary>
7166 If a line in the main part of the configuration (that is, before the first
7167 <quote>begin</quote> line) begins with an upper case letter, it is taken as a macro
7168 definition, and must be of the form
7171 <<emphasis>name</emphasis>> = <<emphasis>rest of line</emphasis>>
7174 The name must consist of letters, digits, and underscores, and need not all be
7175 in upper case, though that is recommended. The rest of the line, including any
7176 continuations, is the replacement text, and has leading and trailing white
7177 space removed. Quotes are not removed. The replacement text can never end with
7178 a backslash character, but this doesn’t seem to be a serious limitation.
7181 Macros may also be defined between router, transport, authenticator, or ACL
7182 definitions. They may not, however, be defined within an individual driver or
7183 ACL, or in the <option>local_scan</option>, retry, or rewrite sections of the configuration.
7186 <section id="SECID42">
7187 <title>Macro substitution</title>
7189 Once a macro is defined, all subsequent lines in the file (and any included
7190 files) are scanned for the macro name; if there are several macros, the line is
7191 scanned for each in turn, in the order in which the macros are defined. The
7192 replacement text is not re-scanned for the current macro, though it is scanned
7193 for subsequently defined macros. For this reason, a macro name may not contain
7194 the name of a previously defined macro as a substring. You could, for example,
7198 <literal>ABCD_XYZ = </literal><<emphasis>something</emphasis>>
7199 <literal>ABCD = </literal><<emphasis>something else</emphasis>>
7202 but putting the definitions in the opposite order would provoke a configuration
7203 error. Macro expansion is applied to individual physical lines from the file,
7204 before checking for line continuation or file inclusion (see above). If a line
7205 consists solely of a macro name, and the expansion of the macro is empty, the
7206 line is ignored. A macro at the start of a line may turn the line into a
7207 comment line or a <literal>.include</literal> line.
7210 <section id="SECID43">
7211 <title>Redefining macros</title>
7213 Once defined, the value of a macro can be redefined later in the configuration
7214 (or in an included file). Redefinition is specified by using <emphasis>==</emphasis> instead of
7215 <emphasis>=</emphasis>. For example:
7217 <literallayout class="monospaced">
7220 MAC == updated value
7223 Redefinition does not alter the order in which the macros are applied to the
7224 subsequent lines of the configuration file. It is still the same order in which
7225 the macros were originally defined. All that changes is the macro’s value.
7226 Redefinition makes it possible to accumulate values. For example:
7228 <literallayout class="monospaced">
7231 MAC == MAC and something added
7234 This can be helpful in situations where the configuration file is built
7235 from a number of other files.
7238 <section id="SECID44">
7239 <title>Overriding macro values</title>
7241 The values set for macros in the configuration file can be overridden by the
7242 <option>-D</option> command line option, but Exim gives up its root privilege when <option>-D</option> is
7243 used, unless called by root or the Exim user. A definition on the command line
7244 using the <option>-D</option> option causes all definitions and redefinitions within the
7248 <section id="SECID45">
7249 <title>Example of macro usage</title>
7251 As an example of macro usage, consider a configuration where aliases are looked
7252 up in a MySQL database. It helps to keep the file less cluttered if long
7253 strings such as SQL statements are defined separately as macros, for example:
7255 <literallayout class="monospaced">
7256 ALIAS_QUERY = select mailbox from user where \
7257 login='${quote_mysql:$local_part}';
7260 This can then be used in a <command>redirect</command> router setting like this:
7262 <literallayout class="monospaced">
7263 data = ${lookup mysql{ALIAS_QUERY}}
7266 In earlier versions of Exim macros were sometimes used for domain, host, or
7267 address lists. In Exim 4 these are handled better by named lists – see
7268 section <xref linkend="SECTnamedlists"/>.
7271 <section id="SECID46">
7272 <title>Conditional skips in the configuration file</title>
7274 <indexterm role="concept">
7275 <primary>configuration file</primary>
7276 <secondary>conditional skips</secondary>
7278 <indexterm role="concept">
7279 <primary><literal>.ifdef</literal></primary>
7281 You can use the directives <literal>.ifdef</literal>, <literal>.ifndef</literal>, <literal>.elifdef</literal>,
7282 <literal>.elifndef</literal>, <literal>.else</literal>, and <literal>.endif</literal> to dynamically include or exclude
7283 portions of the configuration file. The processing happens whenever the file is
7284 read (that is, when an Exim binary starts to run).
7287 The implementation is very simple. Instances of the first four directives must
7288 be followed by text that includes the names of one or macros. The condition
7289 that is tested is whether or not any macro substitution has taken place in the
7292 <literallayout class="monospaced">
7294 message_size_limit = 50M
7296 message_size_limit = 100M
7300 sets a message size limit of 50M if the macro <literal>AAA</literal> is defined, and 100M
7301 otherwise. If there is more than one macro named on the line, the condition
7302 is true if any of them are defined. That is, it is an <quote>or</quote> condition. To
7303 obtain an <quote>and</quote> condition, you need to use nested <literal>.ifdef</literal>s.
7306 Although you can use a macro expansion to generate one of these directives,
7307 it is not very useful, because the condition <quote>there was a macro substitution
7308 in this line</quote> will always be true.
7311 Text following <literal>.else</literal> and <literal>.endif</literal> is ignored, and can be used as comment
7312 to clarify complicated nestings.
7315 <section id="SECTcos">
7316 <title>Common option syntax</title>
7318 <indexterm role="concept">
7319 <primary>common option syntax</primary>
7321 <indexterm role="concept">
7322 <primary>syntax of common options</primary>
7324 <indexterm role="concept">
7325 <primary>configuration file</primary>
7326 <secondary>common option syntax</secondary>
7328 For the main set of options, driver options, and <function>local_scan()</function> options,
7329 each setting is on a line by itself, and starts with a name consisting of
7330 lower-case letters and underscores. Many options require a data value, and in
7331 these cases the name must be followed by an equals sign (with optional white
7332 space) and then the value. For example:
7334 <literallayout class="monospaced">
7335 qualify_domain = mydomain.example.com
7338 <indexterm role="concept">
7339 <primary>hiding configuration option values</primary>
7341 <indexterm role="concept">
7342 <primary>configuration options</primary>
7343 <secondary>hiding value of</secondary>
7345 <indexterm role="concept">
7346 <primary>options</primary>
7347 <secondary>hiding value of</secondary>
7349 Some option settings may contain sensitive data, for example, passwords for
7350 accessing databases. To stop non-admin users from using the <option>-bP</option> command
7351 line option to read these values, you can precede the option settings with the
7352 word <quote>hide</quote>. For example:
7354 <literallayout class="monospaced">
7355 hide mysql_servers = localhost/users/admin/secret-password
7358 For non-admin users, such options are displayed like this:
7360 <literallayout class="monospaced">
7361 mysql_servers = <value not displayable>
7364 If <quote>hide</quote> is used on a driver option, it hides the value of that option on
7365 all instances of the same driver.
7368 The following sections describe the syntax used for the different data types
7369 that are found in option settings.
7372 <section id="SECID47">
7373 <title>Boolean options</title>
7375 <indexterm role="concept">
7376 <primary>format</primary>
7377 <secondary>boolean</secondary>
7379 <indexterm role="concept">
7380 <primary>boolean configuration values</primary>
7382 <indexterm role="option">
7383 <primary><option>no_</option><emphasis>xxx</emphasis></primary>
7385 <indexterm role="option">
7386 <primary><option>not_</option><emphasis>xxx</emphasis></primary>
7388 Options whose type is given as boolean are on/off switches. There are two
7389 different ways of specifying such options: with and without a data value. If
7390 the option name is specified on its own without data, the switch is turned on;
7391 if it is preceded by <quote>no_</quote> or <quote>not_</quote> the switch is turned off. However,
7392 boolean options may be followed by an equals sign and one of the words
7393 <quote>true</quote>, <quote>false</quote>, <quote>yes</quote>, or <quote>no</quote>, as an alternative syntax. For example,
7394 the following two settings have exactly the same effect:
7396 <literallayout class="monospaced">
7401 The following two lines also have the same (opposite) effect:
7403 <literallayout class="monospaced">
7408 You can use whichever syntax you prefer.
7411 <section id="SECID48">
7412 <title>Integer values</title>
7414 <indexterm role="concept">
7415 <primary>integer configuration values</primary>
7417 <indexterm role="concept">
7418 <primary>format</primary>
7419 <secondary>integer</secondary>
7421 If an option’s type is given as <quote>integer</quote>, the value can be given in decimal,
7422 hexadecimal, or octal. If it starts with a digit greater than zero, a decimal
7423 number is assumed. Otherwise, it is treated as an octal number unless it starts
7424 with the characters <quote>0x</quote>, in which case the remainder is interpreted as a
7428 If an integer value is followed by the letter K, it is multiplied by 1024; if
7429 it is followed by the letter M, it is multiplied by 1024x1024. When the values
7430 of integer option settings are output, values which are an exact multiple of
7431 1024 or 1024x1024 are sometimes, but not always, printed using the letters K
7432 and M. The printing style is independent of the actual input format that was
7436 <section id="SECID49">
7437 <title>Octal integer values</title>
7439 <indexterm role="concept">
7440 <primary>integer format</primary>
7442 <indexterm role="concept">
7443 <primary>format</primary>
7444 <secondary>octal integer</secondary>
7446 If an option’s type is given as <quote>octal integer</quote>, its value is always
7447 interpreted as an octal number, whether or not it starts with the digit zero.
7448 Such options are always output in octal.
7451 <section id="SECID50">
7452 <title>Fixed point numbers</title>
7454 <indexterm role="concept">
7455 <primary>fixed point configuration values</primary>
7457 <indexterm role="concept">
7458 <primary>format</primary>
7459 <secondary>fixed point</secondary>
7461 If an option’s type is given as <quote>fixed-point</quote>, its value must be a decimal
7462 integer, optionally followed by a decimal point and up to three further digits.
7465 <section id="SECTtimeformat">
7466 <title>Time intervals</title>
7468 <indexterm role="concept">
7469 <primary>time interval</primary>
7470 <secondary>specifying in configuration</secondary>
7472 <indexterm role="concept">
7473 <primary>format</primary>
7474 <secondary>time interval</secondary>
7476 A time interval is specified as a sequence of numbers, each followed by one of
7477 the following letters, with no intervening white space:
7479 <informaltable frame="none">
7480 <tgroup cols="2" colsep="0" rowsep="0">
7481 <colspec colwidth="30pt" align="left"/>
7482 <colspec colwidth="254pt" align="left"/>
7485 <entry> <option>s</option></entry>
7486 <entry>seconds</entry>
7489 <entry> <option>m</option></entry>
7490 <entry>minutes</entry>
7493 <entry> <option>h</option></entry>
7494 <entry>hours</entry>
7497 <entry> <option>d</option></entry>
7501 <entry> <option>w</option></entry>
7502 <entry>weeks</entry>
7508 For example, <quote>3h50m</quote> specifies 3 hours and 50 minutes. The values of time
7509 intervals are output in the same format. Exim does not restrict the values; it
7510 is perfectly acceptable, for example, to specify <quote>90m</quote> instead of <quote>1h30m</quote>.
7513 <section id="SECTstrings">
7514 <title>String values</title>
7516 <indexterm role="concept">
7517 <primary>string</primary>
7518 <secondary>format of configuration values</secondary>
7520 <indexterm role="concept">
7521 <primary>format</primary>
7522 <secondary>string</secondary>
7524 If an option’s type is specified as <quote>string</quote>, the value can be specified with
7525 or without double-quotes. If it does not start with a double-quote, the value
7526 consists of the remainder of the line plus any continuation lines, starting at
7527 the first character after any leading white space, with trailing white space
7528 removed, and with no interpretation of the characters in the string. Because
7529 Exim removes comment lines (those beginning with #) at an early stage, they can
7530 appear in the middle of a multi-line string. The following two settings are
7531 therefore equivalent:
7533 <literallayout class="monospaced">
7534 trusted_users = uucp:mail
7535 trusted_users = uucp:\
7536 # This comment line is ignored
7540 <indexterm role="concept">
7541 <primary>string</primary>
7542 <secondary>quoted</secondary>
7544 <indexterm role="concept">
7545 <primary>escape characters in quoted strings</primary>
7547 If a string does start with a double-quote, it must end with a closing
7548 double-quote, and any backslash characters other than those used for line
7549 continuation are interpreted as escape characters, as follows:
7551 <informaltable frame="none">
7552 <tgroup cols="2" colsep="0" rowsep="0">
7553 <colspec colwidth="100pt" align="left"/>
7554 <colspec colwidth="254pt" align="left"/>
7557 <entry> <literal>\\</literal></entry>
7558 <entry>single backslash</entry>
7561 <entry> <literal>\n</literal></entry>
7562 <entry>newline</entry>
7565 <entry> <literal>\r</literal></entry>
7566 <entry>carriage return</entry>
7569 <entry> <literal>\t</literal></entry>
7573 <entry> <literal>\</literal><<emphasis>octal digits</emphasis>></entry>
7574 <entry>up to 3 octal digits specify one character</entry>
7577 <entry> <literal>\x</literal><<emphasis>hex digits</emphasis>></entry>
7578 <entry>up to 2 hexadecimal digits specify one character</entry>
7584 If a backslash is followed by some other character, including a double-quote
7585 character, that character replaces the pair.
7588 Quoting is necessary only if you want to make use of the backslash escapes to
7589 insert special characters, or if you need to specify a value with leading or
7590 trailing spaces. These cases are rare, so quoting is almost never needed in
7591 current versions of Exim. In versions of Exim before 3.14, quoting was required
7592 in order to continue lines, so you may come across older configuration files
7593 and examples that apparently quote unnecessarily.
7596 <section id="SECID51">
7597 <title>Expanded strings</title>
7599 <indexterm role="concept">
7600 <primary>expansion</primary>
7601 <secondary>definition of</secondary>
7603 Some strings in the configuration file are subjected to <emphasis>string expansion</emphasis>,
7604 by which means various parts of the string may be changed according to the
7605 circumstances (see chapter <xref linkend="CHAPexpand"/>). The input syntax for such strings
7606 is as just described; in particular, the handling of backslashes in quoted
7607 strings is done as part of the input process, before expansion takes place.
7608 However, backslash is also an escape character for the expander, so any
7609 backslashes that are required for that reason must be doubled if they are
7610 within a quoted configuration string.
7613 <section id="SECID52">
7614 <title>User and group names</title>
7616 <indexterm role="concept">
7617 <primary>user name</primary>
7618 <secondary>format of</secondary>
7620 <indexterm role="concept">
7621 <primary>format</primary>
7622 <secondary>user name</secondary>
7624 <indexterm role="concept">
7625 <primary>groups</primary>
7626 <secondary>name format</secondary>
7628 <indexterm role="concept">
7629 <primary>format</primary>
7630 <secondary>group name</secondary>
7632 User and group names are specified as strings, using the syntax described
7633 above, but the strings are interpreted specially. A user or group name must
7634 either consist entirely of digits, or be a name that can be looked up using the
7635 <function>getpwnam()</function> or <function>getgrnam()</function> function, as appropriate.
7638 <section id="SECTlistconstruct">
7639 <title>List construction</title>
7641 <indexterm role="concept">
7642 <primary>list</primary>
7643 <secondary>syntax of in configuration</secondary>
7645 <indexterm role="concept">
7646 <primary>format</primary>
7647 <secondary>list item in configuration</secondary>
7649 <indexterm role="concept">
7650 <primary>string</primary>
7651 <secondary>list, definition of</secondary>
7653 The data for some configuration options is a list of items, with colon as the
7654 default separator. Many of these options are shown with type <quote>string list</quote> in
7655 the descriptions later in this document. Others are listed as <quote>domain list</quote>,
7656 <quote>host list</quote>, <quote>address list</quote>, or <quote>local part list</quote>. Syntactically, they
7657 are all the same; however, those other than <quote>string list</quote> are subject to
7658 particular kinds of interpretation, as described in chapter
7659 <xref linkend="CHAPdomhosaddlists"/>.
7662 In all these cases, the entire list is treated as a single string as far as the
7663 input syntax is concerned. The <option>trusted_users</option> setting in section
7664 <xref linkend="SECTstrings"/> above is an example. If a colon is actually needed in an item
7665 in a list, it must be entered as two colons. Leading and trailing white space
7666 on each item in a list is ignored. This makes it possible to include items that
7667 start with a colon, and in particular, certain forms of IPv6 address. For
7670 <literallayout class="monospaced">
7671 local_interfaces = 127.0.0.1 : ::::1
7674 contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1.
7677 <emphasis role="bold">Note</emphasis>: Although leading and trailing white space is ignored in individual
7678 list items, it is not ignored when parsing the list. The space after the first
7679 colon in the example above is necessary. If it were not there, the list would
7680 be interpreted as the two items 127.0.0.1:: and 1.
7683 <section id="SECID53">
7684 <title>Changing list separators</title>
7686 <indexterm role="concept">
7687 <primary>list separator</primary>
7688 <secondary>changing</secondary>
7690 <indexterm role="concept">
7691 <primary>IPv6</primary>
7692 <secondary>addresses in lists</secondary>
7694 Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was
7695 introduced to allow the separator character to be changed. If a list begins
7696 with a left angle bracket, followed by any punctuation character, that
7697 character is used instead of colon as the list separator. For example, the list
7698 above can be rewritten to use a semicolon separator like this:
7700 <literallayout class="monospaced">
7701 local_interfaces = <; 127.0.0.1 ; ::1
7704 This facility applies to all lists, with the exception of the list in
7705 <option>log_file_path</option>. It is recommended that the use of non-colon separators be
7706 confined to circumstances where they really are needed.
7709 <indexterm role="concept">
7710 <primary>list separator</primary>
7711 <secondary>newline as</secondary>
7713 <indexterm role="concept">
7714 <primary>newline</primary>
7715 <secondary>as list separator</secondary>
7717 It is also possible to use newline and other control characters (those with
7718 code values less than 32, plus DEL) as separators in lists. Such separators
7719 must be provided literally at the time the list is processed. For options that
7720 are string-expanded, you can write the separator using a normal escape
7721 sequence. This will be processed by the expander before the string is
7722 interpreted as a list. For example, if a newline-separated list of domains is
7723 generated by a lookup, you can process it directly by a line such as this:
7725 <literallayout class="monospaced">
7726 domains = <\n ${lookup mysql{.....}}
7729 This avoids having to change the list separator in such data. You are unlikely
7730 to want to use a control character as a separator in an option that is not
7731 expanded, because the value is literal text. However, it can be done by giving
7732 the value in quotes. For example:
7734 <literallayout class="monospaced">
7735 local_interfaces = "<\n 127.0.0.1 \n ::1"
7738 Unlike printing character separators, which can be included in list items by
7739 doubling, it is not possible to include a control character as data when it is
7740 set as the separator. Two such characters in succession are interpreted as
7741 enclosing an empty list item.
7744 <section id="SECTempitelis">
7745 <title>Empty items in lists</title>
7747 <indexterm role="concept">
7748 <primary>list</primary>
7749 <secondary>empty item in</secondary>
7751 An empty item at the end of a list is always ignored. In other words, trailing
7752 separator characters are ignored. Thus, the list in
7754 <literallayout class="monospaced">
7755 senders = user@domain :
7758 contains only a single item. If you want to include an empty string as one item
7759 in a list, it must not be the last item. For example, this list contains three
7760 items, the second of which is empty:
7762 <literallayout class="monospaced">
7763 senders = user1@domain : : user2@domain
7766 <emphasis role="bold">Note</emphasis>: There must be white space between the two colons, as otherwise they
7767 are interpreted as representing a single colon data character (and the list
7768 would then contain just one item). If you want to specify a list that contains
7769 just one, empty item, you can do it as in this example:
7771 <literallayout class="monospaced">
7775 In this case, the first item is empty, and the second is discarded because it
7776 is at the end of the list.
7779 <section id="SECTfordricon">
7780 <title>Format of driver configurations</title>
7782 <indexterm role="concept">
7783 <primary>drivers</primary>
7784 <secondary>configuration format</secondary>
7786 There are separate parts in the configuration for defining routers, transports,
7787 and authenticators. In each part, you are defining a number of driver
7788 instances, each with its own set of options. Each driver instance is defined by
7789 a sequence of lines like this:
7792 <<emphasis>instance name</emphasis>>:
7793 <<emphasis>option</emphasis>>
7795 <<emphasis>option</emphasis>>
7798 In the following example, the instance name is <command>localuser</command>, and it is
7799 followed by three options settings:
7801 <literallayout class="monospaced">
7805 transport = local_delivery
7808 For each driver instance, you specify which Exim code module it uses – by the
7809 setting of the <option>driver</option> option – and (optionally) some configuration
7810 settings. For example, in the case of transports, if you want a transport to
7811 deliver with SMTP you would use the <command>smtp</command> driver; if you want to deliver to
7812 a local file you would use the <command>appendfile</command> driver. Each of the drivers is
7813 described in detail in its own separate chapter later in this manual.
7816 You can have several routers, transports, or authenticators that are based on
7817 the same underlying driver (each must have a different instance name).
7820 The order in which routers are defined is important, because addresses are
7821 passed to individual routers one by one, in order. The order in which
7822 transports are defined does not matter at all. The order in which
7823 authenticators are defined is used only when Exim, as a client, is searching
7824 them to find one that matches an authentication mechanism offered by the
7828 <indexterm role="concept">
7829 <primary>generic options</primary>
7831 <indexterm role="concept">
7832 <primary>options</primary>
7833 <secondary>generic – definition of</secondary>
7835 Within a driver instance definition, there are two kinds of option: <emphasis>generic</emphasis>
7836 and <emphasis>private</emphasis>. The generic options are those that apply to all drivers of the
7837 same type (that is, all routers, all transports or all authenticators). The
7838 <option>driver</option> option is a generic option that must appear in every definition.
7839 <indexterm role="concept">
7840 <primary>private options</primary>
7842 The private options are special for each driver, and none need appear, because
7843 they all have default values.
7846 The options may appear in any order, except that the <option>driver</option> option must
7847 precede any private options, since these depend on the particular driver. For
7848 this reason, it is recommended that <option>driver</option> always be the first option.
7851 Driver instance names, which are used for reference in log entries and
7852 elsewhere, can be any sequence of letters, digits, and underscores (starting
7853 with a letter) and must be unique among drivers of the same type. A router and
7854 a transport (for example) can each have the same name, but no two router
7855 instances can have the same name. The name of a driver instance should not be
7856 confused with the name of the underlying driver module. For example, the
7857 configuration lines:
7859 <literallayout class="monospaced">
7864 create an instance of the <command>smtp</command> transport driver whose name is
7865 <command>remote_smtp</command>. The same driver code can be used more than once, with
7866 different instance names and different option settings each time. A second
7867 instance of the <command>smtp</command> transport, with different options, might be defined
7870 <literallayout class="monospaced">
7874 command_timeout = 10s
7877 The names <command>remote_smtp</command> and <command>special_smtp</command> would be used to reference
7878 these transport instances from routers, and these names would appear in log
7882 Comment lines may be present in the middle of driver specifications. The full
7883 list of option settings for any particular driver instance, including all the
7884 defaulted values, can be extracted by making use of the <option>-bP</option> command line
7890 <chapter id="CHAPdefconfil">
7891 <title>The default configuration file</title>
7893 <indexterm role="concept" id="IIDconfiwal" class="startofrange">
7894 <primary>configuration file</primary>
7895 <secondary>default <quote>walk through</quote></secondary>
7897 <indexterm role="concept">
7898 <primary>default</primary>
7899 <secondary>configuration file <quote>walk through</quote></secondary>
7901 The default configuration file supplied with Exim as <filename>src/configure.default</filename>
7902 is sufficient for a host with simple mail requirements. As an introduction to
7903 the way Exim is configured, this chapter <quote>walks through</quote> the default
7904 configuration, giving brief explanations of the settings. Detailed descriptions
7905 of the options are given in subsequent chapters. The default configuration file
7906 itself contains extensive comments about ways you might want to modify the
7907 initial settings. However, note that there are many options that are not
7908 mentioned at all in the default configuration.
7910 <section id="SECTdefconfmain">
7911 <title>Main configuration settings</title>
7913 The main (global) configuration option settings must always come first in the
7914 file. The first thing you’ll see in the file, after some initial comments, is
7917 <literallayout class="monospaced">
7918 # primary_hostname =
7921 This is a commented-out setting of the <option>primary_hostname</option> option. Exim needs
7922 to know the official, fully qualified name of your host, and this is where you
7923 can specify it. However, in most cases you do not need to set this option. When
7924 it is unset, Exim uses the <function>uname()</function> system function to obtain the host name.
7927 The first three non-comment configuration lines are as follows:
7929 <literallayout class="monospaced">
7930 domainlist local_domains = @
7931 domainlist relay_to_domains =
7932 hostlist relay_from_hosts = 127.0.0.1
7935 These are not, in fact, option settings. They are definitions of two named
7936 domain lists and one named host list. Exim allows you to give names to lists of
7937 domains, hosts, and email addresses, in order to make it easier to manage the
7938 configuration file (see section <xref linkend="SECTnamedlists"/>).
7941 The first line defines a domain list called <emphasis>local_domains</emphasis>; this is used
7942 later in the configuration to identify domains that are to be delivered
7946 <indexterm role="concept">
7947 <primary>@ in a domain list</primary>
7949 There is just one item in this list, the string <quote>@</quote>. This is a special form
7950 of entry which means <quote>the name of the local host</quote>. Thus, if the local host is
7951 called <emphasis>a.host.example</emphasis>, mail to <emphasis>any.user@a.host.example</emphasis> is expected to
7952 be delivered locally. Because the local host’s name is referenced indirectly,
7953 the same configuration file can be used on different hosts.
7956 The second line defines a domain list called <emphasis>relay_to_domains</emphasis>, but the
7957 list itself is empty. Later in the configuration we will come to the part that
7958 controls mail relaying through the local host; it allows relaying to any
7959 domains in this list. By default, therefore, no relaying on the basis of a mail
7960 domain is permitted.
7963 The third line defines a host list called <emphasis>relay_from_hosts</emphasis>. This list is
7964 used later in the configuration to permit relaying from any host or IP address
7965 that matches the list. The default contains just the IP address of the IPv4
7966 loopback interface, which means that processes on the local host are able to
7967 submit mail for relaying by sending it over TCP/IP to that interface. No other
7968 hosts are permitted to submit messages for relaying.
7971 Just to be sure there’s no misunderstanding: at this point in the configuration
7972 we aren’t actually setting up any controls. We are just defining some domains
7973 and hosts that will be used in the controls that are specified later.
7976 The next two configuration lines are genuine option settings:
7978 <literallayout class="monospaced">
7979 acl_smtp_rcpt = acl_check_rcpt
7980 acl_smtp_data = acl_check_data
7983 These options specify <emphasis>Access Control Lists</emphasis> (ACLs) that are to be used
7984 during an incoming SMTP session for every recipient of a message (every RCPT
7985 command), and after the contents of the message have been received,
7986 respectively. The names of the lists are <emphasis>acl_check_rcpt</emphasis> and
7987 <emphasis>acl_check_data</emphasis>, and we will come to their definitions below, in the ACL
7988 section of the configuration. The RCPT ACL controls which recipients are
7989 accepted for an incoming message – if a configuration does not provide an ACL
7990 to check recipients, no SMTP mail can be accepted. The DATA ACL allows the
7991 contents of a message to be checked.
7994 Two commented-out option settings are next:
7996 <literallayout class="monospaced">
7997 # av_scanner = clamd:/tmp/clamd
7998 # spamd_address = 127.0.0.1 783
8001 These are example settings that can be used when Exim is compiled with the
8002 content-scanning extension. The first specifies the interface to the virus
8003 scanner, and the second specifies the interface to SpamAssassin. Further
8004 details are given in chapter <xref linkend="CHAPexiscan"/>.
8007 Three more commented-out option settings follow:
8009 <literallayout class="monospaced">
8010 # tls_advertise_hosts = *
8011 # tls_certificate = /etc/ssl/exim.crt
8012 # tls_privatekey = /etc/ssl/exim.pem
8015 These are example settings that can be used when Exim is compiled with
8016 support for TLS (aka SSL) as described in section <xref linkend="SECTinctlsssl"/>. The
8017 first one specifies the list of clients that are allowed to use TLS when
8018 connecting to this server; in this case the wildcard means all clients. The
8019 other options specify where Exim should find its TLS certificate and private
8020 key, which together prove the server’s identity to any clients that connect.
8021 More details are given in chapter <xref linkend="CHAPTLS"/>.
8024 Another two commented-out option settings follow:
8026 <literallayout class="monospaced">
8027 # daemon_smtp_ports = 25 : 465 : 587
8028 # tls_on_connect_ports = 465
8031 <indexterm role="concept">
8032 <primary>port</primary>
8033 <secondary>465 and 587</secondary>
8035 <indexterm role="concept">
8036 <primary>port</primary>
8037 <secondary>for message submission</secondary>
8039 <indexterm role="concept">
8040 <primary>message</primary>
8041 <secondary>submission, ports for</secondary>
8043 <indexterm role="concept">
8044 <primary>ssmtp protocol</primary>
8046 <indexterm role="concept">
8047 <primary>smtps protocol</primary>
8049 <indexterm role="concept">
8050 <primary>SMTP</primary>
8051 <secondary>ssmtp protocol</secondary>
8053 <indexterm role="concept">
8054 <primary>SMTP</primary>
8055 <secondary>smtps protocol</secondary>
8057 These options provide better support for roaming users who wish to use this
8058 server for message submission. They are not much use unless you have turned on
8059 TLS (as described in the previous paragraph) and authentication (about which
8060 more in section <xref linkend="SECTdefconfauth"/>). The usual SMTP port 25 is often blocked
8061 on end-user networks, so RFC 4409 specifies that message submission should use
8062 port 587 instead. However some software (notably Microsoft Outlook) cannot be
8063 configured to use port 587 correctly, so these settings also enable the
8064 non-standard <quote>smtps</quote> (aka <quote>ssmtp</quote>) port 465 (see section
8065 <xref linkend="SECTsupobssmt"/>).
8068 Two more commented-out options settings follow:
8070 <literallayout class="monospaced">
8072 # qualify_recipient =
8075 The first of these specifies a domain that Exim uses when it constructs a
8076 complete email address from a local login name. This is often needed when Exim
8077 receives a message from a local process. If you do not set <option>qualify_domain</option>,
8078 the value of <option>primary_hostname</option> is used. If you set both of these options,
8079 you can have different qualification domains for sender and recipient
8080 addresses. If you set only the first one, its value is used in both cases.
8083 <indexterm role="concept">
8084 <primary>domain literal</primary>
8085 <secondary>recognizing format</secondary>
8087 The following line must be uncommented if you want Exim to recognize
8088 addresses of the form <emphasis>user@[10.11.12.13]</emphasis> that is, with a <quote>domain literal</quote>
8089 (an IP address within square brackets) instead of a named domain.
8091 <literallayout class="monospaced">
8092 # allow_domain_literals
8095 The RFCs still require this form, but many people think that in the modern
8096 Internet it makes little sense to permit mail to be sent to specific hosts by
8097 quoting their IP addresses. This ancient format has been used by people who
8098 try to abuse hosts by using them for unwanted relaying. However, some
8099 people believe there are circumstances (for example, messages addressed to
8100 <emphasis>postmaster</emphasis>) where domain literals are still useful.
8103 The next configuration line is a kind of trigger guard:
8105 <literallayout class="monospaced">
8109 It specifies that no delivery must ever be run as the root user. The normal
8110 convention is to set up <emphasis>root</emphasis> as an alias for the system administrator. This
8111 setting is a guard against slips in the configuration.
8112 The list of users specified by <option>never_users</option> is not, however, the complete
8113 list; the build-time configuration in <filename>Local/Makefile</filename> has an option called
8114 FIXED_NEVER_USERS specifying a list that cannot be overridden. The
8115 contents of <option>never_users</option> are added to this list. By default
8116 FIXED_NEVER_USERS also specifies root.
8119 When a remote host connects to Exim in order to send mail, the only information
8120 Exim has about the host’s identity is its IP address. The next configuration
8123 <literallayout class="monospaced">
8127 specifies that Exim should do a reverse DNS lookup on all incoming connections,
8128 in order to get a host name. This improves the quality of the logging
8129 information, but if you feel it is too expensive, you can remove it entirely,
8130 or restrict the lookup to hosts on <quote>nearby</quote> networks.
8131 Note that it is not always possible to find a host name from an IP address,
8132 because not all DNS reverse zones are maintained, and sometimes DNS servers are
8136 The next two lines are concerned with <emphasis>ident</emphasis> callbacks, as defined by RFC
8137 1413 (hence their names):
8139 <literallayout class="monospaced">
8141 rfc1413_query_timeout = 5s
8144 These settings cause Exim to make ident callbacks for all incoming SMTP calls.
8145 You can limit the hosts to which these calls are made, or change the timeout
8146 that is used. If you set the timeout to zero, all ident calls are disabled.
8147 Although they are cheap and can provide useful information for tracing problem
8148 messages, some hosts and firewalls have problems with ident calls. This can
8149 result in a timeout instead of an immediate refused connection, leading to
8150 delays on starting up an incoming SMTP session.
8153 When Exim receives messages over SMTP connections, it expects all addresses to
8154 be fully qualified with a domain, as required by the SMTP definition. However,
8155 if you are running a server to which simple clients submit messages, you may
8156 find that they send unqualified addresses. The two commented-out options:
8158 <literallayout class="monospaced">
8159 # sender_unqualified_hosts =
8160 # recipient_unqualified_hosts =
8163 show how you can specify hosts that are permitted to send unqualified sender
8164 and recipient addresses, respectively.
8167 The <option>percent_hack_domains</option> option is also commented out:
8169 <literallayout class="monospaced">
8170 # percent_hack_domains =
8173 It provides a list of domains for which the <quote>percent hack</quote> is to operate.
8174 This is an almost obsolete form of explicit email routing. If you do not know
8175 anything about it, you can safely ignore this topic.
8178 The last two settings in the main part of the default configuration are
8179 concerned with messages that have been <quote>frozen</quote> on Exim’s queue. When a
8180 message is frozen, Exim no longer continues to try to deliver it. Freezing
8181 occurs when a bounce message encounters a permanent failure because the sender
8182 address of the original message that caused the bounce is invalid, so the
8183 bounce cannot be delivered. This is probably the most common case, but there
8184 are also other conditions that cause freezing, and frozen messages are not
8185 always bounce messages.
8187 <literallayout class="monospaced">
8188 ignore_bounce_errors_after = 2d
8189 timeout_frozen_after = 7d
8192 The first of these options specifies that failing bounce messages are to be
8193 discarded after 2 days on the queue. The second specifies that any frozen
8194 message (whether a bounce message or not) is to be timed out (and discarded)
8195 after a week. In this configuration, the first setting ensures that no failing
8196 bounce message ever lasts a week.
8199 <section id="SECID54">
8200 <title>ACL configuration</title>
8202 <indexterm role="concept">
8203 <primary>default</primary>
8204 <secondary>ACLs</secondary>
8206 <indexterm role="concept">
8207 <primary>access control lists (ACLs)</primary>
8208 <secondary>default configuration</secondary>
8210 In the default configuration, the ACL section follows the main configuration.
8211 It starts with the line
8213 <literallayout class="monospaced">
8217 and it contains the definitions of two ACLs, called <emphasis>acl_check_rcpt</emphasis> and
8218 <emphasis>acl_check_data</emphasis>, that were referenced in the settings of <option>acl_smtp_rcpt</option>
8219 and <option>acl_smtp_data</option> above.
8222 <indexterm role="concept">
8223 <primary>RCPT</primary>
8224 <secondary>ACL for</secondary>
8226 The first ACL is used for every RCPT command in an incoming SMTP message. Each
8227 RCPT command specifies one of the message’s recipients. The ACL statements
8228 are considered in order, until the recipient address is either accepted or
8229 rejected. The RCPT command is then accepted or rejected, according to the
8230 result of the ACL processing.
8232 <literallayout class="monospaced">
8236 This line, consisting of a name terminated by a colon, marks the start of the
8239 <literallayout class="monospaced">
8243 This ACL statement accepts the recipient if the sending host matches the list.
8244 But what does that strange list mean? It doesn’t actually contain any host
8245 names or IP addresses. The presence of the colon puts an empty item in the
8246 list; Exim matches this only if the incoming message did not come from a remote
8247 host, because in that case, the remote hostname is empty. The colon is
8248 important. Without it, the list itself is empty, and can never match anything.
8251 What this statement is doing is to accept unconditionally all recipients in
8252 messages that are submitted by SMTP from local processes using the standard
8253 input and output (that is, not using TCP/IP). A number of MUAs operate in this
8256 <literallayout class="monospaced">
8257 deny message = Restricted characters in address
8258 domains = +local_domains
8259 local_parts = ^[.] : ^.*[@%!/|]
8261 deny message = Restricted characters in address
8262 domains = !+local_domains
8263 local_parts = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
8266 These statements are concerned with local parts that contain any of the
8267 characters <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>, <quote>|</quote>, or dots in unusual places.
8268 Although these characters are entirely legal in local parts (in the case of
8269 <quote>@</quote> and leading dots, only if correctly quoted), they do not commonly occur
8270 in Internet mail addresses.
8273 The first three have in the past been associated with explicitly routed
8274 addresses (percent is still sometimes used – see the <option>percent_hack_domains</option>
8275 option). Addresses containing these characters are regularly tried by spammers
8276 in an attempt to bypass relaying restrictions, and also by open relay testing
8277 programs. Unless you really need them it is safest to reject these characters
8278 at this early stage. This configuration is heavy-handed in rejecting these
8279 characters for all messages it accepts from remote hosts. This is a deliberate
8280 policy of being as safe as possible.
8283 The first rule above is stricter, and is applied to messages that are addressed
8284 to one of the local domains handled by this host. This is implemented by the
8285 first condition, which restricts it to domains that are listed in the
8286 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8287 reference to a named list. In this configuration, there is just one domain in
8288 <emphasis>local_domains</emphasis>, but in general there may be many.
8291 The second condition on the first statement uses two regular expressions to
8292 block local parts that begin with a dot or contain <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>,
8293 or <quote>|</quote>. If you have local accounts that include these characters, you will
8294 have to modify this rule.
8297 Empty components (two dots in a row) are not valid in RFC 2822, but Exim
8298 allows them because they have been encountered in practice. (Consider the
8299 common convention of local parts constructed as
8300 <quote><emphasis>first-initial.second-initial.family-name</emphasis></quote> when applied to someone like
8301 the author of Exim, who has no second initial.) However, a local part starting
8302 with a dot or containing <quote>/../</quote> can cause trouble if it is used as part of a
8303 file name (for example, for a mailing list). This is also true for local parts
8304 that contain slashes. A pipe symbol can also be troublesome if the local part
8305 is incorporated unthinkingly into a shell command line.
8308 The second rule above applies to all other domains, and is less strict. This
8309 allows your own users to send outgoing messages to sites that use slashes
8310 and vertical bars in their local parts. It blocks local parts that begin
8311 with a dot, slash, or vertical bar, but allows these characters within the
8312 local part. However, the sequence <quote>/../</quote> is barred. The use of <quote>@</quote>, <quote>%</quote>,
8313 and <quote>!</quote> is blocked, as before. The motivation here is to prevent your users
8314 (or your users’ viruses) from mounting certain kinds of attack on remote sites.
8316 <literallayout class="monospaced">
8317 accept local_parts = postmaster
8318 domains = +local_domains
8321 This statement, which has two conditions, accepts an incoming address if the
8322 local part is <emphasis>postmaster</emphasis> and the domain is one of those listed in the
8323 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8324 reference to a named list. In this configuration, there is just one domain in
8325 <emphasis>local_domains</emphasis>, but in general there may be many.
8328 The presence of this statement means that mail to postmaster is never blocked
8329 by any of the subsequent tests. This can be helpful while sorting out problems
8330 in cases where the subsequent tests are incorrectly denying access.
8332 <literallayout class="monospaced">
8333 require verify = sender
8336 This statement requires the sender address to be verified before any subsequent
8337 ACL statement can be used. If verification fails, the incoming recipient
8338 address is refused. Verification consists of trying to route the address, to
8339 see if a bounce message could be delivered to it. In the case of remote
8340 addresses, basic verification checks only the domain, but <emphasis>callouts</emphasis> can be
8341 used for more verification if required. Section <xref linkend="SECTaddressverification"/>
8342 discusses the details of address verification.
8344 <literallayout class="monospaced">
8345 accept hosts = +relay_from_hosts
8346 control = submission
8349 This statement accepts the address if the message is coming from one of the
8350 hosts that are defined as being allowed to relay through this host. Recipient
8351 verification is omitted here, because in many cases the clients are dumb MUAs
8352 that do not cope well with SMTP error responses. For the same reason, the
8353 second line specifies <quote>submission mode</quote> for messages that are accepted. This
8354 is described in detail in section <xref linkend="SECTsubmodnon"/>; it causes Exim to fix
8355 messages that are deficient in some way, for example, because they lack a
8356 <emphasis>Date:</emphasis> header line. If you are actually relaying out from MTAs, you should
8357 probably add recipient verification here, and disable submission mode.
8359 <literallayout class="monospaced">
8360 accept authenticated = *
8361 control = submission
8364 This statement accepts the address if the client host has authenticated itself.
8365 Submission mode is again specified, on the grounds that such messages are most
8366 likely to come from MUAs. The default configuration does not define any
8367 authenticators, though it does include some nearly complete commented-out
8368 examples described in <xref linkend="SECTdefconfauth"/>. This means that no client can in
8369 fact authenticate until you complete the authenticator definitions.
8371 <literallayout class="monospaced">
8372 require message = relay not permitted
8373 domains = +local_domains : +relay_domains
8376 This statement rejects the address if its domain is neither a local domain nor
8377 one of the domains for which this host is a relay.
8379 <literallayout class="monospaced">
8380 require verify = recipient
8383 This statement requires the recipient address to be verified; if verification
8384 fails, the address is rejected.
8386 <literallayout class="monospaced">
8387 # deny message = rejected because $sender_host_address \
8388 # is in a black list at $dnslist_domain\n\
8390 # dnslists = black.list.example
8392 # warn dnslists = black.list.example
8393 # add_header = X-Warning: $sender_host_address is in \
8394 # a black list at $dnslist_domain
8395 # log_message = found in $dnslist_domain
8398 These commented-out lines are examples of how you could configure Exim to check
8399 sending hosts against a DNS black list. The first statement rejects messages
8400 from blacklisted hosts, whereas the second just inserts a warning header
8403 <literallayout class="monospaced">
8404 # require verify = csa
8407 This commented-out line is an example of how you could turn on client SMTP
8408 authorization (CSA) checking. Such checks do DNS lookups for special SRV
8411 <literallayout class="monospaced">
8415 The final statement in the first ACL unconditionally accepts any recipient
8416 address that has successfully passed all the previous tests.
8418 <literallayout class="monospaced">
8422 This line marks the start of the second ACL, and names it. Most of the contents
8423 of this ACL are commented out:
8425 <literallayout class="monospaced">
8427 # message = This message contains a virus \
8431 These lines are examples of how to arrange for messages to be scanned for
8432 viruses when Exim has been compiled with the content-scanning extension, and a
8433 suitable virus scanner is installed. If the message is found to contain a
8434 virus, it is rejected with the given custom error message.
8436 <literallayout class="monospaced">
8437 # warn spam = nobody
8438 # message = X-Spam_score: $spam_score\n\
8439 # X-Spam_score_int: $spam_score_int\n\
8440 # X-Spam_bar: $spam_bar\n\
8441 # X-Spam_report: $spam_report
8444 These lines are an example of how to arrange for messages to be scanned by
8445 SpamAssassin when Exim has been compiled with the content-scanning extension,
8446 and SpamAssassin has been installed. The SpamAssassin check is run with
8447 <literal>nobody</literal> as its user parameter, and the results are added to the message as a
8448 series of extra header line. In this case, the message is not rejected,
8449 whatever the spam score.
8451 <literallayout class="monospaced">
8455 This final line in the DATA ACL accepts the message unconditionally.
8458 <section id="SECID55">
8459 <title>Router configuration</title>
8461 <indexterm role="concept">
8462 <primary>default</primary>
8463 <secondary>routers</secondary>
8465 <indexterm role="concept">
8466 <primary>routers</primary>
8467 <secondary>default</secondary>
8469 The router configuration comes next in the default configuration, introduced
8472 <literallayout class="monospaced">
8476 Routers are the modules in Exim that make decisions about where to send
8477 messages. An address is passed to each router in turn, until it is either
8478 accepted, or failed. This means that the order in which you define the routers
8479 matters. Each router is fully described in its own chapter later in this
8480 manual. Here we give only brief overviews.
8482 <literallayout class="monospaced">
8484 # driver = ipliteral
8485 # domains = !+local_domains
8486 # transport = remote_smtp
8489 <indexterm role="concept">
8490 <primary>domain literal</primary>
8491 <secondary>default router</secondary>
8493 This router is commented out because the majority of sites do not want to
8494 support domain literal addresses (those of the form <emphasis>user@[10.9.8.7]</emphasis>). If
8495 you uncomment this router, you also need to uncomment the setting of
8496 <option>allow_domain_literals</option> in the main part of the configuration.
8498 <literallayout class="monospaced">
8501 domains = ! +local_domains
8502 transport = remote_smtp
8503 ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
8507 The first uncommented router handles addresses that do not involve any local
8508 domains. This is specified by the line
8510 <literallayout class="monospaced">
8511 domains = ! +local_domains
8514 The <option>domains</option> option lists the domains to which this router applies, but the
8515 exclamation mark is a negation sign, so the router is used only for domains
8516 that are not in the domain list called <emphasis>local_domains</emphasis> (which was defined at
8517 the start of the configuration). The plus sign before <emphasis>local_domains</emphasis>
8518 indicates that it is referring to a named list. Addresses in other domains are
8519 passed on to the following routers.
8522 The name of the router driver is <command>dnslookup</command>,
8523 and is specified by the <option>driver</option> option. Do not be confused by the fact that
8524 the name of this router instance is the same as the name of the driver. The
8525 instance name is arbitrary, but the name set in the <option>driver</option> option must be
8526 one of the driver modules that is in the Exim binary.
8529 The <command>dnslookup</command> router routes addresses by looking up their domains in the
8530 DNS in order to obtain a list of hosts to which the address is routed. If the
8531 router succeeds, the address is queued for the <command>remote_smtp</command> transport, as
8532 specified by the <option>transport</option> option. If the router does not find the domain
8533 in the DNS, no further routers are tried because of the <option>no_more</option> setting, so
8534 the address fails and is bounced.
8537 The <option>ignore_target_hosts</option> option specifies a list of IP addresses that are to
8538 be entirely ignored. This option is present because a number of cases have been
8539 encountered where MX records in the DNS point to host names
8540 whose IP addresses are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1).
8541 Completely ignoring these IP addresses causes Exim to fail to route the
8542 email address, so it bounces. Otherwise, Exim would log a routing problem, and
8543 continue to try to deliver the message periodically until the address timed
8546 <literallayout class="monospaced">
8551 data = ${lookup{$local_part}lsearch{/etc/aliases}}
8553 file_transport = address_file
8554 pipe_transport = address_pipe
8557 Control reaches this and subsequent routers only for addresses in the local
8558 domains. This router checks to see whether the local part is defined as an
8559 alias in the <filename>/etc/aliases</filename> file, and if so, redirects it according to the
8560 data that it looks up from that file. If no data is found for the local part,
8561 the value of the <option>data</option> option is empty, causing the address to be passed to
8565 <filename>/etc/aliases</filename> is a conventional name for the system aliases file that is
8566 often used. That is why it is referenced by from the default configuration
8567 file. However, you can change this by setting SYSTEM_ALIASES_FILE in
8568 <filename>Local/Makefile</filename> before building Exim.
8570 <literallayout class="monospaced">
8574 # local_part_suffix = +* : -*
8575 # local_part_suffix_optional
8576 file = $home/.forward
8581 file_transport = address_file
8582 pipe_transport = address_pipe
8583 reply_transport = address_reply
8586 This is the most complicated router in the default configuration. It is another
8587 redirection router, but this time it is looking for forwarding data set up by
8588 individual users. The <option>check_local_user</option> setting specifies a check that the
8589 local part of the address is the login name of a local user. If it is not, the
8590 router is skipped. The two commented options that follow <option>check_local_user</option>,
8593 <literallayout class="monospaced">
8594 # local_part_suffix = +* : -*
8595 # local_part_suffix_optional
8598 <indexterm role="variable">
8599 <primary><varname>$local_part_suffix</varname></primary>
8601 show how you can specify the recognition of local part suffixes. If the first
8602 is uncommented, a suffix beginning with either a plus or a minus sign, followed
8603 by any sequence of characters, is removed from the local part and placed in the
8604 variable <varname>$local_part_suffix</varname>. The second suffix option specifies that the
8605 presence of a suffix in the local part is optional. When a suffix is present,
8606 the check for a local login uses the local part with the suffix removed.
8609 When a local user account is found, the file called <filename>.forward</filename> in the user’s
8610 home directory is consulted. If it does not exist, or is empty, the router
8611 declines. Otherwise, the contents of <filename>.forward</filename> are interpreted as
8612 redirection data (see chapter <xref linkend="CHAPredirect"/> for more details).
8615 <indexterm role="concept">
8616 <primary>Sieve filter</primary>
8617 <secondary>enabling in default router</secondary>
8619 Traditional <filename>.forward</filename> files contain just a list of addresses, pipes, or
8620 files. Exim supports this by default. However, if <option>allow_filter</option> is set (it
8621 is commented out by default), the contents of the file are interpreted as a set
8622 of Exim or Sieve filtering instructions, provided the file begins with <quote>#Exim
8623 filter</quote> or <quote>#Sieve filter</quote>, respectively. User filtering is discussed in the
8624 separate document entitled <emphasis>Exim’s interfaces to mail filtering</emphasis>.
8627 The <option>no_verify</option> and <option>no_expn</option> options mean that this router is skipped when
8628 verifying addresses, or when running as a consequence of an SMTP EXPN command.
8629 There are two reasons for doing this:
8631 <orderedlist numeration="arabic">
8634 Whether or not a local user has a <filename>.forward</filename> file is not really relevant when
8635 checking an address for validity; it makes sense not to waste resources doing
8641 More importantly, when Exim is verifying addresses or handling an EXPN
8642 command during an SMTP session, it is running as the Exim user, not as root.
8643 The group is the Exim group, and no additional groups are set up.
8644 It may therefore not be possible for Exim to read users’ <filename>.forward</filename> files at
8650 The setting of <option>check_ancestor</option> prevents the router from generating a new
8651 address that is the same as any previous address that was redirected. (This
8652 works round a problem concerning a bad interaction between aliasing and
8653 forwarding – see section <xref linkend="SECTredlocmai"/>).
8656 The final three option settings specify the transports that are to be used when
8657 forwarding generates a direct delivery to a file, or to a pipe, or sets up an
8658 auto-reply, respectively. For example, if a <filename>.forward</filename> file contains
8660 <literallayout class="monospaced">
8661 a.nother@elsewhere.example, /home/spqr/archive
8664 the delivery to <filename>/home/spqr/archive</filename> is done by running the <option>address_file</option>
8667 <literallayout class="monospaced">
8671 # local_part_suffix = +* : -*
8672 # local_part_suffix_optional
8673 transport = local_delivery
8676 The final router sets up delivery into local mailboxes, provided that the local
8677 part is the name of a local login, by accepting the address and assigning it to
8678 the <command>local_delivery</command> transport. Otherwise, we have reached the end of the
8679 routers, so the address is bounced. The commented suffix settings fulfil the
8680 same purpose as they do for the <command>userforward</command> router.
8683 <section id="SECID56">
8684 <title>Transport configuration</title>
8686 <indexterm role="concept">
8687 <primary>default</primary>
8688 <secondary>transports</secondary>
8690 <indexterm role="concept">
8691 <primary>transports</primary>
8692 <secondary>default</secondary>
8694 Transports define mechanisms for actually delivering messages. They operate
8695 only when referenced from routers, so the order in which they are defined does
8696 not matter. The transports section of the configuration starts with
8698 <literallayout class="monospaced">
8702 One remote transport and four local transports are defined.
8704 <literallayout class="monospaced">
8709 This transport is used for delivering messages over SMTP connections. All its
8710 options are defaulted. The list of remote hosts comes from the router.
8712 <literallayout class="monospaced">
8715 file = /var/mail/$local_part
8723 This <command>appendfile</command> transport is used for local delivery to user mailboxes in
8724 traditional BSD mailbox format. By default it runs under the uid and gid of the
8725 local user, which requires the sticky bit to be set on the <filename>/var/mail</filename>
8726 directory. Some systems use the alternative approach of running mail deliveries
8727 under a particular group instead of using the sticky bit. The commented options
8728 show how this can be done.
8731 Exim adds three headers to the message as it delivers it: <emphasis>Delivery-date:</emphasis>,
8732 <emphasis>Envelope-to:</emphasis> and <emphasis>Return-path:</emphasis>. This action is requested by the three
8733 similarly-named options above.
8735 <literallayout class="monospaced">
8741 This transport is used for handling deliveries to pipes that are generated by
8742 redirection (aliasing or users’ <filename>.forward</filename> files). The <option>return_output</option>
8743 option specifies that any output generated by the pipe is to be returned to the
8746 <literallayout class="monospaced">
8754 This transport is used for handling deliveries to files that are generated by
8755 redirection. The name of the file is not specified in this instance of
8756 <command>appendfile</command>, because it comes from the <command>redirect</command> router.
8758 <literallayout class="monospaced">
8763 This transport is used for handling automatic replies generated by users’
8767 <section id="SECID57">
8768 <title>Default retry rule</title>
8770 <indexterm role="concept">
8771 <primary>retry</primary>
8772 <secondary>default rule</secondary>
8774 <indexterm role="concept">
8775 <primary>default</primary>
8776 <secondary>retry rule</secondary>
8778 The retry section of the configuration file contains rules which affect the way
8779 Exim retries deliveries that cannot be completed at the first attempt. It is
8780 introduced by the line
8782 <literallayout class="monospaced">
8786 In the default configuration, there is just one rule, which applies to all
8789 <literallayout class="monospaced">
8790 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
8793 This causes any temporarily failing address to be retried every 15 minutes for
8794 2 hours, then at intervals starting at one hour and increasing by a factor of
8795 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address
8796 is not delivered after 4 days of temporary failure, it is bounced.
8799 If the retry section is removed from the configuration, or is empty (that is,
8800 if no retry rules are defined), Exim will not retry deliveries. This turns
8801 temporary errors into permanent errors.
8804 <section id="SECID58">
8805 <title>Rewriting configuration</title>
8807 The rewriting section of the configuration, introduced by
8809 <literallayout class="monospaced">
8813 contains rules for rewriting addresses in messages as they arrive. There are no
8814 rewriting rules in the default configuration file.
8817 <section id="SECTdefconfauth">
8818 <title>Authenticators configuration</title>
8820 <indexterm role="concept">
8821 <primary>AUTH</primary>
8822 <secondary>configuration</secondary>
8824 The authenticators section of the configuration, introduced by
8826 <literallayout class="monospaced">
8827 begin authenticators
8830 defines mechanisms for the use of the SMTP AUTH command. The default
8831 configuration file contains two commented-out example authenticators
8832 which support plaintext username/password authentication using the
8833 standard PLAIN mechanism and the traditional but non-standard LOGIN
8834 mechanism, with Exim acting as the server. PLAIN and LOGIN are enough
8835 to support most MUA software.
8838 The example PLAIN authenticator looks like this:
8840 <literallayout class="monospaced">
8842 # driver = plaintext
8843 # server_set_id = $auth2
8844 # server_prompts = :
8845 # server_condition = Authentication is not yet configured
8846 # server_advertise_condition = ${if def:tls_cipher }
8849 And the example LOGIN authenticator looks like this:
8851 <literallayout class="monospaced">
8853 # driver = plaintext
8854 # server_set_id = $auth1
8855 # server_prompts = <| Username: | Password:
8856 # server_condition = Authentication is not yet configured
8857 # server_advertise_condition = ${if def:tls_cipher }
8860 The <option>server_set_id</option> option makes Exim remember the authenticated username
8861 in <varname>$authenticated_id</varname>, which can be used later in ACLs or routers. The
8862 <option>server_prompts</option> option configures the <command>plaintext</command> authenticator so
8863 that it implements the details of the specific authentication mechanism,
8864 i.e. PLAIN or LOGIN. The <option>server_advertise_condition</option> setting controls
8865 when Exim offers authentication to clients; in the examples, this is only
8866 when TLS or SSL has been started, so to enable the authenticators you also
8867 need to add support for TLS as described in <xref linkend="SECTdefconfmain"/>.
8870 The <option>server_condition</option> setting defines how to verify that the username and
8871 password are correct. In the examples it just produces an error message.
8872 To make the authenticators work, you can use a string expansion
8873 expression like one of the examples in <xref linkend="CHAPplaintext"/>.
8875 <para revisionflag="changed">
8876 Beware that the sequence of the parameters to PLAIN and LOGIN differ; the
8877 usercode and password are in different positions. <xref linkend="CHAPplaintext"/>
8881 <indexterm role="concept" startref="IIDconfiwal" class="endofrange"/>
8886 <chapter id="CHAPregexp">
8887 <title>Regular expressions</title>
8889 <indexterm role="concept">
8890 <primary>regular expressions</primary>
8891 <secondary>library</secondary>
8893 <indexterm role="concept">
8894 <primary>PCRE</primary>
8896 Exim supports the use of regular expressions in many of its options. It
8897 uses the PCRE regular expression library; this provides regular expression
8898 matching that is compatible with Perl 5. The syntax and semantics of
8899 regular expressions is discussed in many Perl reference books, and also in
8900 Jeffrey Friedl’s <emphasis>Mastering Regular Expressions</emphasis>, which is published by
8901 O’Reilly (see <emphasis role="bold"><ulink url="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</ulink></emphasis>).
8903 <para revisionflag="changed">
8904 The documentation for the syntax and semantics of the regular expressions that
8905 are supported by PCRE is included in the PCRE distribution, and no further
8906 description is included here. The PCRE functions are called from Exim using
8907 the default option settings (that is, with no PCRE options set), except that
8908 the PCRE_CASELESS option is set when the matching is required to be
8912 In most cases, when a regular expression is required in an Exim configuration,
8913 it has to start with a circumflex, in order to distinguish it from plain text
8914 or an <quote>ends with</quote> wildcard. In this example of a configuration setting, the
8915 second item in the colon-separated list is a regular expression.
8917 <literallayout class="monospaced">
8918 domains = a.b.c : ^\\d{3} : *.y.z : ...
8921 The doubling of the backslash is required because of string expansion that
8922 precedes interpretation – see section <xref linkend="SECTlittext"/> for more discussion
8923 of this issue, and a way of avoiding the need for doubling backslashes. The
8924 regular expression that is eventually used in this example contains just one
8925 backslash. The circumflex is included in the regular expression, and has the
8926 normal effect of <quote>anchoring</quote> it to the start of the string that is being
8930 There are, however, two cases where a circumflex is not required for the
8931 recognition of a regular expression: these are the <option>match</option> condition in a
8932 string expansion, and the <option>matches</option> condition in an Exim filter file. In
8933 these cases, the relevant string is always treated as a regular expression; if
8934 it does not start with a circumflex, the expression is not anchored, and can
8935 match anywhere in the subject string.
8938 In all cases, if you want a regular expression to match at the end of a string,
8939 you must code the $ metacharacter to indicate this. For example:
8941 <literallayout class="monospaced">
8942 domains = ^\\d{3}\\.example
8945 matches the domain <emphasis>123.example</emphasis>, but it also matches <emphasis>123.example.com</emphasis>.
8948 <literallayout class="monospaced">
8949 domains = ^\\d{3}\\.example\$
8952 if you want <emphasis>example</emphasis> to be the top-level domain. The backslash before the
8953 $ is needed because string expansion also interprets dollar characters.
8957 <chapter id="CHAPfdlookup">
8958 <title>File and database lookups</title>
8960 <indexterm role="concept" id="IIDfidalo1" class="startofrange">
8961 <primary>file</primary>
8962 <secondary>lookups</secondary>
8964 <indexterm role="concept" id="IIDfidalo2" class="startofrange">
8965 <primary>database</primary>
8966 <secondary>lookups</secondary>
8968 <indexterm role="concept">
8969 <primary>lookup</primary>
8970 <secondary>description of</secondary>
8972 Exim can be configured to look up data in files or databases as it processes
8973 messages. Two different kinds of syntax are used:
8975 <orderedlist numeration="arabic">
8978 A string that is to be expanded may contain explicit lookup requests. These
8979 cause parts of the string to be replaced by data that is obtained from the
8980 lookup. Lookups of this type are conditional expansion items. Different results
8981 can be defined for the cases of lookup success and failure. See chapter
8982 <xref linkend="CHAPexpand"/>, where string expansions are described in detail.
8987 Lists of domains, hosts, and email addresses can contain lookup requests as a
8988 way of avoiding excessively long linear lists. In this case, the data that is
8989 returned by the lookup is often (but not always) discarded; whether the lookup
8990 succeeds or fails is what really counts. These kinds of list are described in
8991 chapter <xref linkend="CHAPdomhosaddlists"/>.
8996 String expansions, lists, and lookups interact with each other in such a way
8997 that there is no order in which to describe any one of them that does not
8998 involve references to the others. Each of these three chapters makes more sense
8999 if you have read the other two first. If you are reading this for the first
9000 time, be aware that some of it will make a lot more sense after you have read
9001 chapters <xref linkend="CHAPdomhosaddlists"/> and <xref linkend="CHAPexpand"/>.
9003 <section id="SECID60">
9004 <title>Examples of different lookup syntax</title>
9006 It is easy to confuse the two different kinds of lookup, especially as the
9007 lists that may contain the second kind are always expanded before being
9008 processed as lists. Therefore, they may also contain lookups of the first kind.
9009 Be careful to distinguish between the following two examples:
9011 <literallayout class="monospaced">
9012 domains = ${lookup{$sender_host_address}lsearch{/some/file}}
9013 domains = lsearch;/some/file
9016 The first uses a string expansion, the result of which must be a domain list.
9017 No strings have been specified for a successful or a failing lookup; the
9018 defaults in this case are the looked-up data and an empty string, respectively.
9019 The expansion takes place before the string is processed as a list, and the
9020 file that is searched could contain lines like this:
9022 <literallayout class="monospaced">
9023 192.168.3.4: domain1:domain2:...
9024 192.168.1.9: domain3:domain4:...
9027 When the lookup succeeds, the result of the expansion is a list of domains (and
9028 possibly other types of item that are allowed in domain lists).
9031 In the second example, the lookup is a single item in a domain list. It causes
9032 Exim to use a lookup to see if the domain that is being processed can be found
9033 in the file. The file could contains lines like this:
9035 <literallayout class="monospaced">
9040 Any data that follows the keys is not relevant when checking that the domain
9041 matches the list item.
9044 It is possible, though no doubt confusing, to use both kinds of lookup at once.
9045 Consider a file containing lines like this:
9047 <literallayout class="monospaced">
9048 192.168.5.6: lsearch;/another/file
9051 If the value of <varname>$sender_host_address</varname> is 192.168.5.6, expansion of the
9052 first <option>domains</option> setting above generates the second setting, which therefore
9053 causes a second lookup to occur.
9056 The rest of this chapter describes the different lookup types that are
9057 available. Any of them can be used in any part of the configuration where a
9058 lookup is permitted.
9061 <section id="SECID61">
9062 <title>Lookup types</title>
9064 <indexterm role="concept">
9065 <primary>lookup</primary>
9066 <secondary>types of</secondary>
9068 <indexterm role="concept">
9069 <primary>single-key lookup</primary>
9070 <secondary>definition of</secondary>
9072 Two different types of data lookup are implemented:
9077 The <emphasis>single-key</emphasis> type requires the specification of a file in which to look,
9078 and a single key to search for. The key must be a non-empty string for the
9079 lookup to succeed. The lookup type determines how the file is searched.
9084 <indexterm role="concept">
9085 <primary>query-style lookup</primary>
9086 <secondary>definition of</secondary>
9088 The <emphasis>query-style</emphasis> type accepts a generalized database query. No particular
9089 key value is assumed by Exim for query-style lookups. You can use whichever
9090 Exim variables you need to construct the database query.
9095 The code for each lookup type is in a separate source file that is included in
9096 the binary of Exim only if the corresponding compile-time option is set. The
9097 default settings in <filename>src/EDITME</filename> are:
9099 <literallayout class="monospaced">
9104 which means that only linear searching and DBM lookups are included by default.
9105 For some types of lookup (e.g. SQL databases), you need to install appropriate
9106 libraries and header files before building Exim.
9109 <section id="SECTsinglekeylookups">
9110 <title>Single-key lookup types</title>
9112 <indexterm role="concept">
9113 <primary>lookup</primary>
9114 <secondary>single-key types</secondary>
9116 <indexterm role="concept">
9117 <primary>single-key lookup</primary>
9118 <secondary>list of types</secondary>
9120 The following single-key lookup types are implemented:
9125 <indexterm role="concept">
9126 <primary>cdb</primary>
9127 <secondary>description of</secondary>
9129 <indexterm role="concept">
9130 <primary>lookup</primary>
9131 <secondary>cdb</secondary>
9133 <indexterm role="concept">
9134 <primary>binary zero</primary>
9135 <secondary>in lookup key</secondary>
9137 <command>cdb</command>: The given file is searched as a Constant DataBase file, using the key
9138 string without a terminating binary zero. The cdb format is designed for
9139 indexed files that are read frequently and never updated, except by total
9140 re-creation. As such, it is particularly suitable for large files containing
9141 aliases or other indexed data referenced by an MTA. Information about cdb can
9142 be found in several places:
9145 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>
9146 <emphasis role="bold"><ulink url="ftp://ftp.corpit.ru/pub/tinycdb/">ftp://ftp.corpit.ru/pub/tinycdb/</ulink></emphasis>
9147 <emphasis role="bold"><ulink url="http://packages.debian.org/stable/utils/freecdb.html">http://packages.debian.org/stable/utils/freecdb.html</ulink></emphasis>
9150 A cdb distribution is not needed in order to build Exim with cdb support,
9151 because the code for reading cdb files is included directly in Exim itself.
9152 However, no means of building or testing cdb files is provided with Exim, so
9153 you need to obtain a cdb distribution in order to do this.
9158 <indexterm role="concept">
9159 <primary>DBM</primary>
9160 <secondary>lookup type</secondary>
9162 <indexterm role="concept">
9163 <primary>lookup</primary>
9164 <secondary>dbm</secondary>
9166 <indexterm role="concept">
9167 <primary>binary zero</primary>
9168 <secondary>in lookup key</secondary>
9170 <command>dbm</command>: Calls to DBM library functions are used to extract data from the given
9171 DBM file by looking up the record with the given key. A terminating binary
9172 zero is included in the key that is passed to the DBM library. See section
9173 <xref linkend="SECTdb"/> for a discussion of DBM libraries.
9176 <indexterm role="concept">
9177 <primary>Berkeley DB library</primary>
9178 <secondary>file format</secondary>
9180 For all versions of Berkeley DB, Exim uses the DB_HASH style of database
9181 when building DBM files using the <option>exim_dbmbuild</option> utility. However, when
9182 using Berkeley DB versions 3 or 4, it opens existing databases for reading with
9183 the DB_UNKNOWN option. This enables it to handle any of the types of database
9184 that the library supports, and can be useful for accessing DBM files created by
9185 other applications. (For earlier DB versions, DB_HASH is always used.)
9190 <indexterm role="concept">
9191 <primary>lookup</primary>
9192 <secondary>dbmnz</secondary>
9194 <indexterm role="concept">
9195 <primary>lookup</primary>
9196 <secondary>dbm – terminating zero</secondary>
9198 <indexterm role="concept">
9199 <primary>binary zero</primary>
9200 <secondary>in lookup key</secondary>
9202 <indexterm role="concept">
9203 <primary>Courier</primary>
9205 <indexterm role="concept">
9206 <primary><filename>/etc/userdbshadow.dat</filename></primary>
9208 <indexterm role="concept">
9209 <primary>dmbnz lookup type</primary>
9211 <command>dbmnz</command>: This is the same as <command>dbm</command>, except that a terminating binary zero
9212 is not included in the key that is passed to the DBM library. You may need this
9213 if you want to look up data in files that are created by or shared with some
9214 other application that does not use terminating zeros. For example, you need to
9215 use <command>dbmnz</command> rather than <command>dbm</command> if you want to authenticate incoming SMTP
9216 calls using the passwords from Courier’s <filename>/etc/userdbshadow.dat</filename> file. Exim’s
9217 utility program for creating DBM files (<emphasis>exim_dbmbuild</emphasis>) includes the zeros
9218 by default, but has an option to omit them (see section <xref linkend="SECTdbmbuild"/>).
9223 <indexterm role="concept">
9224 <primary>lookup</primary>
9225 <secondary>dsearch</secondary>
9227 <indexterm role="concept">
9228 <primary>dsearch lookup type</primary>
9230 <command>dsearch</command>: The given file must be a directory; this is searched for an entry
9231 whose name is the key by calling the <function>lstat()</function> function. The key may not
9232 contain any forward slash characters. If <function>lstat()</function> succeeds, the result of
9233 the lookup is the name of the entry, which may be a file, directory,
9234 symbolic link, or any other kind of directory entry. An example of how this
9235 lookup can be used to support virtual domains is given in section
9236 <xref linkend="SECTvirtualdomains"/>.
9241 <indexterm role="concept">
9242 <primary>lookup</primary>
9243 <secondary>iplsearch</secondary>
9245 <indexterm role="concept">
9246 <primary>iplsearch lookup type</primary>
9248 <command>iplsearch</command>: The given file is a text file containing keys and data. A key is
9249 terminated by a colon or white space or the end of the line. The keys in the
9250 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
9251 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
9252 being interpreted as a key terminator. For example:
9254 <literallayout class="monospaced">
9255 1.2.3.4: data for 1.2.3.4
9256 192.168.0.0/16: data for 192.168.0.0/16
9257 "abcd::cdab": data for abcd::cdab
9258 "abcd:abcd::/32" data for abcd:abcd::/32
9261 The key for an <command>iplsearch</command> lookup must be an IP address (without a mask). The
9262 file is searched linearly, using the CIDR masks where present, until a matching
9263 key is found. The first key that matches is used; there is no attempt to find a
9264 <quote>best</quote> match. Apart from the way the keys are matched, the processing for
9265 <command>iplsearch</command> is the same as for <command>lsearch</command>.
9268 <emphasis role="bold">Warning 1</emphasis>: Unlike most other single-key lookup types, a file of data for
9269 <command>iplsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9270 lookup types support only literal keys.
9273 <emphasis role="bold">Warning 2</emphasis>: In a host list, you must always use <command>net-iplsearch</command> so that
9274 the implicit key is the host’s IP address rather than its name (see section
9275 <xref linkend="SECThoslispatsikey"/>).
9280 <indexterm role="concept">
9281 <primary>linear search</primary>
9283 <indexterm role="concept">
9284 <primary>lookup</primary>
9285 <secondary>lsearch</secondary>
9287 <indexterm role="concept">
9288 <primary>lsearch lookup type</primary>
9290 <indexterm role="concept">
9291 <primary>case sensitivity</primary>
9292 <secondary>in lsearch lookup</secondary>
9294 <command>lsearch</command>: The given file is a text file that is searched linearly for a
9295 line beginning with the search key, terminated by a colon or white space or the
9296 end of the line. The search is case-insensitive; that is, upper and lower case
9297 letters are treated as the same. The first occurrence of the key that is found
9298 in the file is used.
9301 White space between the key and the colon is permitted. The remainder of the
9302 line, with leading and trailing white space removed, is the data. This can be
9303 continued onto subsequent lines by starting them with any amount of white
9304 space, but only a single space character is included in the data at such a
9305 junction. If the data begins with a colon, the key must be terminated by a
9308 <literallayout class="monospaced">
9312 Empty lines and lines beginning with # are ignored, even if they occur in the
9313 middle of an item. This is the traditional textual format of alias files. Note
9314 that the keys in an <command>lsearch</command> file are literal strings. There is no
9315 wildcarding of any kind.
9318 <indexterm role="concept">
9319 <primary>lookup</primary>
9320 <secondary>lsearch – colons in keys</secondary>
9322 <indexterm role="concept">
9323 <primary>white space</primary>
9324 <secondary>in lsearch key</secondary>
9326 In most <command>lsearch</command> files, keys are not required to contain colons or #
9327 characters, or white space. However, if you need this feature, it is available.
9328 If a key begins with a doublequote character, it is terminated only by a
9329 matching quote (or end of line), and the normal escaping rules apply to its
9330 contents (see section <xref linkend="SECTstrings"/>). An optional colon is permitted after
9331 quoted keys (exactly as for unquoted keys). There is no special handling of
9332 quotes for the data part of an <command>lsearch</command> line.
9337 <indexterm role="concept">
9338 <primary>NIS lookup type</primary>
9340 <indexterm role="concept">
9341 <primary>lookup</primary>
9342 <secondary>NIS</secondary>
9344 <indexterm role="concept">
9345 <primary>binary zero</primary>
9346 <secondary>in lookup key</secondary>
9348 <command>nis</command>: The given file is the name of a NIS map, and a NIS lookup is done with
9349 the given key, without a terminating binary zero. There is a variant called
9350 <command>nis0</command> which does include the terminating binary zero in the key. This is
9351 reportedly needed for Sun-style alias files. Exim does not recognize NIS
9352 aliases; the full map names must be used.
9357 <indexterm role="concept">
9358 <primary>wildlsearch lookup type</primary>
9360 <indexterm role="concept">
9361 <primary>lookup</primary>
9362 <secondary>wildlsearch</secondary>
9364 <indexterm role="concept">
9365 <primary>nwildlsearch lookup type</primary>
9367 <indexterm role="concept">
9368 <primary>lookup</primary>
9369 <secondary>nwildlsearch</secondary>
9371 <command>wildlsearch</command> or <command>nwildlsearch</command>: These search a file linearly, like
9372 <command>lsearch</command>, but instead of being interpreted as a literal string, each key in
9373 the file may be wildcarded. The difference between these two lookup types is
9374 that for <command>wildlsearch</command>, each key in the file is string-expanded before being
9375 used, whereas for <command>nwildlsearch</command>, no expansion takes place.
9378 <indexterm role="concept">
9379 <primary>case sensitivity</primary>
9380 <secondary>in (n)wildlsearch lookup</secondary>
9382 Like <command>lsearch</command>, the testing is done case-insensitively. However, keys in the
9383 file that are regular expressions can be made case-sensitive by the use of
9384 <literal>(-i)</literal> within the pattern. The following forms of wildcard are recognized:
9386 <orderedlist numeration="arabic">
9389 The string may begin with an asterisk to mean <quote>ends with</quote>. For example:
9391 <literallayout class="monospaced">
9392 *.a.b.c data for anything.a.b.c
9393 *fish data for anythingfish
9398 The string may begin with a circumflex to indicate a regular expression. For
9399 example, for <command>wildlsearch</command>:
9401 <literallayout class="monospaced">
9402 ^\N\d+\.a\.b\N data for <digits>.a.b
9405 Note the use of <literal>\N</literal> to disable expansion of the contents of the regular
9406 expression. If you are using <command>nwildlsearch</command>, where the keys are not
9407 string-expanded, the equivalent entry is:
9409 <literallayout class="monospaced">
9410 ^\d+\.a\.b data for <digits>.a.b
9413 The case-insensitive flag is set at the start of compiling the regular
9414 expression, but it can be turned off by using <literal>(-i)</literal> at an appropriate point.
9415 For example, to make the entire pattern case-sensitive:
9417 <literallayout class="monospaced">
9418 ^(?-i)\d+\.a\.b data for <digits>.a.b
9421 If the regular expression contains white space or colon characters, you must
9422 either quote it (see <command>lsearch</command> above), or represent these characters in other
9423 ways. For example, <literal>\s</literal> can be used for white space and <literal>\x3A</literal> for a
9424 colon. This may be easier than quoting, because if you quote, you have to
9425 escape all the backslashes inside the quotes.
9428 <emphasis role="bold">Note</emphasis>: It is not possible to capture substrings in a regular expression
9429 match for later use, because the results of all lookups are cached. If a lookup
9430 is repeated, the result is taken from the cache, and no actual pattern matching
9431 takes place. The values of all the numeric variables are unset after a
9432 <command>(n)wildlsearch</command> match.
9437 Although I cannot see it being of much use, the general matching function that
9438 is used to implement <command>(n)wildlsearch</command> means that the string may begin with a
9439 lookup name terminated by a semicolon, and followed by lookup data. For
9442 <literallayout class="monospaced">
9443 cdb;/some/file data for keys that match the file
9446 The data that is obtained from the nested lookup is discarded.
9451 Keys that do not match any of these patterns are interpreted literally. The
9452 continuation rules for the data are the same as for <command>lsearch</command>, and keys may
9453 be followed by optional colons.
9456 <emphasis role="bold">Warning</emphasis>: Unlike most other single-key lookup types, a file of data for
9457 <command>(n)wildlsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9458 lookup types support only literal keys.
9463 <section id="SECID62">
9464 <title>Query-style lookup types</title>
9466 <indexterm role="concept">
9467 <primary>lookup</primary>
9468 <secondary>query-style types</secondary>
9470 <indexterm role="concept">
9471 <primary>query-style lookup</primary>
9472 <secondary>list of types</secondary>
9474 The supported query-style lookup types are listed below. Further details about
9475 many of them are given in later sections.
9480 <indexterm role="concept">
9481 <primary>DNS</primary>
9482 <secondary>as a lookup type</secondary>
9484 <indexterm role="concept">
9485 <primary>lookup</primary>
9486 <secondary>DNS</secondary>
9488 <command>dnsdb</command>: This does a DNS search for one or more records whose domain names
9489 are given in the supplied query. The resulting data is the contents of the
9490 records. See section <xref linkend="SECTdnsdb"/>.
9495 <indexterm role="concept">
9496 <primary>InterBase lookup type</primary>
9498 <indexterm role="concept">
9499 <primary>lookup</primary>
9500 <secondary>InterBase</secondary>
9502 <command>ibase</command>: This does a lookup in an InterBase database.
9507 <indexterm role="concept">
9508 <primary>LDAP</primary>
9509 <secondary>lookup type</secondary>
9511 <indexterm role="concept">
9512 <primary>lookup</primary>
9513 <secondary>LDAP</secondary>
9515 <command>ldap</command>: This does an LDAP lookup using a query in the form of a URL, and
9516 returns attributes from a single entry. There is a variant called <command>ldapm</command>
9517 that permits values from multiple entries to be returned. A third variant
9518 called <command>ldapdn</command> returns the Distinguished Name of a single entry instead of
9519 any attribute values. See section <xref linkend="SECTldap"/>.
9524 <indexterm role="concept">
9525 <primary>MySQL</primary>
9526 <secondary>lookup type</secondary>
9528 <indexterm role="concept">
9529 <primary>lookup</primary>
9530 <secondary>MySQL</secondary>
9532 <command>mysql</command>: The format of the query is an SQL statement that is passed to a
9533 MySQL database. See section <xref linkend="SECTsql"/>.
9538 <indexterm role="concept">
9539 <primary>NIS+ lookup type</primary>
9541 <indexterm role="concept">
9542 <primary>lookup</primary>
9543 <secondary>NIS+</secondary>
9545 <command>nisplus</command>: This does a NIS+ lookup using a query that can specify the name of
9546 the field to be returned. See section <xref linkend="SECTnisplus"/>.
9551 <indexterm role="concept">
9552 <primary>Oracle</primary>
9553 <secondary>lookup type</secondary>
9555 <indexterm role="concept">
9556 <primary>lookup</primary>
9557 <secondary>Oracle</secondary>
9559 <command>oracle</command>: The format of the query is an SQL statement that is passed to an
9560 Oracle database. See section <xref linkend="SECTsql"/>.
9565 <indexterm role="concept">
9566 <primary>lookup</primary>
9567 <secondary>passwd</secondary>
9569 <indexterm role="concept">
9570 <primary>passwd lookup type</primary>
9572 <indexterm role="concept">
9573 <primary><filename>/etc/passwd</filename></primary>
9575 <command>passwd</command> is a query-style lookup with queries that are just user names. The
9576 lookup calls <function>getpwnam()</function> to interrogate the system password data, and on
9577 success, the result string is the same as you would get from an <command>lsearch</command>
9578 lookup on a traditional <filename>/etc/passwd file</filename>, though with <literal>*</literal> for the
9579 password value. For example:
9581 <literallayout class="monospaced">
9582 *:42:42:King Rat:/home/kr:/bin/bash
9587 <indexterm role="concept">
9588 <primary>PostgreSQL lookup type</primary>
9590 <indexterm role="concept">
9591 <primary>lookup</primary>
9592 <secondary>PostgreSQL</secondary>
9594 <command>pgsql</command>: The format of the query is an SQL statement that is passed to a
9595 PostgreSQL database. See section <xref linkend="SECTsql"/>.
9600 <indexterm role="concept">
9601 <primary>sqlite lookup type</primary>
9603 <indexterm role="concept">
9604 <primary>lookup</primary>
9605 <secondary>sqlite</secondary>
9607 <command>sqlite</command>: The format of the query is a file name followed by an SQL statement
9608 that is passed to an SQLite database. See section <xref linkend="SECTsqlite"/>.
9613 <command>testdb</command>: This is a lookup type that is used for testing Exim. It is
9614 not likely to be useful in normal operation.
9619 <indexterm role="concept">
9620 <primary>whoson lookup type</primary>
9622 <indexterm role="concept">
9623 <primary>lookup</primary>
9624 <secondary>whoson</secondary>
9626 <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
9627 allows a server to check whether a particular (dynamically allocated) IP
9628 address is currently allocated to a known (trusted) user and, optionally, to
9629 obtain the identity of the said user. For SMTP servers, <emphasis>Whoson</emphasis> was popular
9630 at one time for <quote>POP before SMTP</quote> authentication, but that approach has been
9631 superseded by SMTP authentication. In Exim, <emphasis>Whoson</emphasis> can be used to implement
9632 <quote>POP before SMTP</quote> checking using ACL statements such as
9634 <literallayout class="monospaced">
9635 require condition = \
9636 ${lookup whoson {$sender_host_address}{yes}{no}}
9639 The query consists of a single IP address. The value returned is the name of
9640 the authenticated user, which is stored in the variable <varname>$value</varname>. However, in
9641 this example, the data in <varname>$value</varname> is not used; the result of the lookup is
9642 one of the fixed strings <quote>yes</quote> or <quote>no</quote>.
9647 <section id="SECID63">
9648 <title>Temporary errors in lookups</title>
9650 <indexterm role="concept">
9651 <primary>lookup</primary>
9652 <secondary>temporary error in</secondary>
9654 Lookup functions can return temporary error codes if the lookup cannot be
9655 completed. For example, an SQL or LDAP database might be unavailable. For this
9656 reason, it is not advisable to use a lookup that might do this for critical
9657 options such as a list of local domains.
9660 When a lookup cannot be completed in a router or transport, delivery
9661 of the message (to the relevant address) is deferred, as for any other
9662 temporary error. In other circumstances Exim may assume the lookup has failed,
9663 or may give up altogether.
9666 <section id="SECTdefaultvaluelookups">
9667 <title>Default values in single-key lookups</title>
9669 <indexterm role="concept">
9670 <primary>wildcard lookups</primary>
9672 <indexterm role="concept">
9673 <primary>lookup</primary>
9674 <secondary>default values</secondary>
9676 <indexterm role="concept">
9677 <primary>lookup</primary>
9678 <secondary>wildcard</secondary>
9680 <indexterm role="concept">
9681 <primary>lookup</primary>
9682 <secondary>* added to type</secondary>
9684 <indexterm role="concept">
9685 <primary>default</primary>
9686 <secondary>in single-key lookups</secondary>
9688 In this context, a <quote>default value</quote> is a value specified by the administrator
9689 that is to be used if a lookup fails.
9692 <emphasis role="bold">Note:</emphasis> This section applies only to single-key lookups. For query-style
9693 lookups, the facilities of the query language must be used. An attempt to
9694 specify a default for a query-style lookup provokes an error.
9697 If <quote>*</quote> is added to a single-key lookup type (for example, <option>lsearch*</option>)
9698 and the initial lookup fails, the key <quote>*</quote> is looked up in the file to
9699 provide a default value. See also the section on partial matching below.
9702 <indexterm role="concept">
9703 <primary>*@ with single-key lookup</primary>
9705 <indexterm role="concept">
9706 <primary>lookup</primary>
9707 <secondary>*@ added to type</secondary>
9709 <indexterm role="concept">
9710 <primary>alias file</primary>
9711 <secondary>per-domain default</secondary>
9713 Alternatively, if <quote>*@</quote> is added to a single-key lookup type (for example
9714 <option>dbm*@</option>) then, if the initial lookup fails and the key contains an @
9715 character, a second lookup is done with everything before the last @ replaced
9716 by *. This makes it possible to provide per-domain defaults in alias files
9717 that include the domains in the keys. If the second lookup fails (or doesn’t
9718 take place because there is no @ in the key), <quote>*</quote> is looked up.
9719 For example, a <command>redirect</command> router might contain:
9721 <literallayout class="monospaced">
9722 data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}}
9725 Suppose the address that is being processed is <emphasis>jane@eyre.example</emphasis>. Exim
9726 looks up these keys, in this order:
9728 <literallayout class="monospaced">
9734 The data is taken from whichever key it finds first. <emphasis role="bold">Note</emphasis>: In an
9735 <command>lsearch</command> file, this does not mean the first of these keys in the file. A
9736 complete scan is done for each key, and only if it is not found at all does
9737 Exim move on to try the next key.
9740 <section id="SECTpartiallookup">
9741 <title>Partial matching in single-key lookups</title>
9743 <indexterm role="concept">
9744 <primary>partial matching</primary>
9746 <indexterm role="concept">
9747 <primary>wildcard lookups</primary>
9749 <indexterm role="concept">
9750 <primary>lookup</primary>
9751 <secondary>partial matching</secondary>
9753 <indexterm role="concept">
9754 <primary>lookup</primary>
9755 <secondary>wildcard</secondary>
9757 <indexterm role="concept">
9758 <primary>asterisk</primary>
9759 <secondary>in search type</secondary>
9761 The normal operation of a single-key lookup is to search the file for an exact
9762 match with the given key. However, in a number of situations where domains are
9763 being looked up, it is useful to be able to do partial matching. In this case,
9764 information in the file that has a key starting with <quote>*.</quote> is matched by any
9765 domain that ends with the components that follow the full stop. For example, if
9766 a key in a DBM file is
9768 <literallayout class="monospaced">
9769 *.dates.fict.example
9772 then when partial matching is enabled this is matched by (amongst others)
9773 <emphasis>2001.dates.fict.example</emphasis> and <emphasis>1984.dates.fict.example</emphasis>. It is also matched
9774 by <emphasis>dates.fict.example</emphasis>, if that does not appear as a separate key in the
9778 <emphasis role="bold">Note</emphasis>: Partial matching is not available for query-style lookups. It is
9779 also not available for any lookup items in address lists (see section
9780 <xref linkend="SECTaddresslist"/>).
9783 Partial matching is implemented by doing a series of separate lookups using
9784 keys constructed by modifying the original subject key. This means that it can
9785 be used with any of the single-key lookup types, provided that
9786 partial matching keys
9787 beginning with a special prefix (default <quote>*.</quote>) are included in the data file.
9788 Keys in the file that do not begin with the prefix are matched only by
9789 unmodified subject keys when partial matching is in use.
9792 Partial matching is requested by adding the string <quote>partial-</quote> to the front of
9793 the name of a single-key lookup type, for example, <option>partial-dbm</option>. When this
9794 is done, the subject key is first looked up unmodified; if that fails, <quote>*.</quote>
9795 is added at the start of the subject key, and it is looked up again. If that
9796 fails, further lookups are tried with dot-separated components removed from the
9797 start of the subject key, one-by-one, and <quote>*.</quote> added on the front of what
9801 A minimum number of two non-* components are required. This can be adjusted
9802 by including a number before the hyphen in the search type. For example,
9803 <option>partial3-lsearch</option> specifies a minimum of three non-* components in the
9804 modified keys. Omitting the number is equivalent to <quote>partial2-</quote>. If the
9805 subject key is <emphasis>2250.dates.fict.example</emphasis> then the following keys are looked
9806 up when the minimum number of non-* components is two:
9808 <literallayout class="monospaced">
9809 2250.dates.fict.example
9810 *.2250.dates.fict.example
9811 *.dates.fict.example
9815 As soon as one key in the sequence is successfully looked up, the lookup
9819 <indexterm role="concept">
9820 <primary>lookup</primary>
9821 <secondary>partial matching – changing prefix</secondary>
9823 <indexterm role="concept">
9824 <primary>prefix</primary>
9825 <secondary>for partial matching</secondary>
9827 The use of <quote>*.</quote> as the partial matching prefix is a default that can be
9828 changed. The motivation for this feature is to allow Exim to operate with file
9829 formats that are used by other MTAs. A different prefix can be supplied in
9830 parentheses instead of the hyphen after <quote>partial</quote>. For example:
9832 <literallayout class="monospaced">
9833 domains = partial(.)lsearch;/some/file
9836 In this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
9837 <literal>a.b.c</literal>, <literal>.a.b.c</literal>, and <literal>.b.c</literal> (the default minimum of 2 non-wild
9838 components is unchanged). The prefix may consist of any punctuation characters
9839 other than a closing parenthesis. It may be empty, for example:
9841 <literallayout class="monospaced">
9842 domains = partial1()cdb;/some/file
9845 For this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
9846 <literal>a.b.c</literal>, <literal>b.c</literal>, and <literal>c</literal>.
9849 If <quote>partial0</quote> is specified, what happens at the end (when the lookup with
9850 just one non-wild component has failed, and the original key is shortened right
9851 down to the null string) depends on the prefix:
9856 If the prefix has zero length, the whole lookup fails.
9861 If the prefix has length 1, a lookup for just the prefix is done. For
9862 example, the final lookup for <quote>partial0(.)</quote> is for <literal>.</literal> alone.
9867 Otherwise, if the prefix ends in a dot, the dot is removed, and the
9868 remainder is looked up. With the default prefix, therefore, the final lookup is
9869 for <quote>*</quote> on its own.
9874 Otherwise, the whole prefix is looked up.
9879 If the search type ends in <quote>*</quote> or <quote>*@</quote> (see section
9880 <xref linkend="SECTdefaultvaluelookups"/> above), the search for an ultimate default that
9881 this implies happens after all partial lookups have failed. If <quote>partial0</quote> is
9882 specified, adding <quote>*</quote> to the search type has no effect with the default
9883 prefix, because the <quote>*</quote> key is already included in the sequence of partial
9884 lookups. However, there might be a use for lookup types such as
9885 <quote>partial0(.)lsearch*</quote>.
9888 The use of <quote>*</quote> in lookup partial matching differs from its use as a wildcard
9889 in domain lists and the like. Partial matching works only in terms of
9890 dot-separated components; a key such as <literal>*fict.example</literal>
9891 in a database file is useless, because the asterisk in a partial matching
9892 subject key is always followed by a dot.
9895 <section id="SECID64">
9896 <title>Lookup caching</title>
9898 <indexterm role="concept">
9899 <primary>lookup</primary>
9900 <secondary>caching</secondary>
9902 <indexterm role="concept">
9903 <primary>caching</primary>
9904 <secondary>lookup data</secondary>
9906 Exim caches all lookup results in order to avoid needless repetition of
9907 lookups. However, because (apart from the daemon) Exim operates as a collection
9908 of independent, short-lived processes, this caching applies only within a
9909 single Exim process. There is no inter-process lookup caching facility.
9912 For single-key lookups, Exim keeps the relevant files open in case there is
9913 another lookup that needs them. In some types of configuration this can lead to
9914 many files being kept open for messages with many recipients. To avoid hitting
9915 the operating system limit on the number of simultaneously open files, Exim
9916 closes the least recently used file when it needs to open more files than its
9917 own internal limit, which can be changed via the <option>lookup_open_max</option> option.
9920 The single-key lookup files are closed and the lookup caches are flushed at
9921 strategic points during delivery – for example, after all routing is
9925 <section id="SECID65">
9926 <title>Quoting lookup data</title>
9928 <indexterm role="concept">
9929 <primary>lookup</primary>
9930 <secondary>quoting</secondary>
9932 <indexterm role="concept">
9933 <primary>quoting</primary>
9934 <secondary>in lookups</secondary>
9936 When data from an incoming message is included in a query-style lookup, there
9937 is the possibility of special characters in the data messing up the syntax of
9938 the query. For example, a NIS+ query that contains
9940 <literallayout class="monospaced">
9944 will be broken if the local part happens to contain a closing square bracket.
9945 For NIS+, data can be enclosed in double quotes like this:
9947 <literallayout class="monospaced">
9948 [name="$local_part"]
9951 but this still leaves the problem of a double quote in the data. The rule for
9952 NIS+ is that double quotes must be doubled. Other lookup types have different
9953 rules, and to cope with the differing requirements, an expansion operator
9954 of the following form is provided:
9956 <literallayout class="monospaced">
9957 ${quote_<lookup-type>:<string>}
9960 For example, the safest way to write the NIS+ query is
9962 <literallayout class="monospaced">
9963 [name="${quote_nisplus:$local_part}"]
9966 See chapter <xref linkend="CHAPexpand"/> for full coverage of string expansions. The quote
9967 operator can be used for all lookup types, but has no effect for single-key
9968 lookups, since no quoting is ever needed in their key strings.
9971 <section id="SECTdnsdb">
9972 <title>More about dnsdb</title>
9974 <indexterm role="concept">
9975 <primary>dnsdb lookup</primary>
9977 <indexterm role="concept">
9978 <primary>lookup</primary>
9979 <secondary>dnsdb</secondary>
9981 <indexterm role="concept">
9982 <primary>DNS</primary>
9983 <secondary>as a lookup type</secondary>
9985 The <command>dnsdb</command> lookup type uses the DNS as its database. A simple query consists
9986 of a record type and a domain name, separated by an equals sign. For example,
9987 an expansion string could contain:
9989 <literallayout class="monospaced">
9990 ${lookup dnsdb{mx=a.b.example}{$value}fail}
9993 If the lookup succeeds, the result is placed in <varname>$value</varname>, which in this case
9994 is used on its own as the result. If the lookup does not succeed, the
9995 <literal>fail</literal> keyword causes a <emphasis>forced expansion failure</emphasis> – see section
9996 <xref linkend="SECTforexpfai"/> for an explanation of what this means.
9999 The supported DNS record types are A, CNAME, MX, NS, PTR, SRV, and TXT, and,
10000 when Exim is compiled with IPv6 support, AAAA (and A6 if that is also
10001 configured). If no type is given, TXT is assumed. When the type is PTR,
10002 the data can be an IP address, written as normal; inversion and the addition of
10003 <option>in-addr.arpa</option> or <option>ip6.arpa</option> happens automatically. For example:
10005 <literallayout class="monospaced">
10006 ${lookup dnsdb{ptr=192.168.4.5}{$value}fail}
10009 If the data for a PTR record is not a syntactically valid IP address, it is not
10010 altered and nothing is added.
10013 <indexterm role="concept">
10014 <primary>MX record</primary>
10015 <secondary>in <command>dnsdb</command> lookup</secondary>
10017 <indexterm role="concept">
10018 <primary>SRV record</primary>
10019 <secondary>in <command>dnsdb</command> lookup</secondary>
10021 For an MX lookup, both the preference value and the host name are returned for
10022 each record, separated by a space. For an SRV lookup, the priority, weight,
10023 port, and host name are returned for each record, separated by spaces.
10026 For any record type, if multiple records are found (or, for A6 lookups, if a
10027 single record leads to multiple addresses), the data is returned as a
10028 concatenation, with newline as the default separator. The order, of course,
10029 depends on the DNS resolver. You can specify a different separator character
10030 between multiple records by putting a right angle-bracket followed immediately
10031 by the new separator at the start of the query. For example:
10033 <literallayout class="monospaced">
10034 ${lookup dnsdb{>: a=host1.example}}
10037 It is permitted to specify a space as the separator character. Further
10038 white space is ignored.
10041 <section id="SECID66">
10042 <title>Pseudo dnsdb record types</title>
10044 <indexterm role="concept">
10045 <primary>MX record</primary>
10046 <secondary>in <command>dnsdb</command> lookup</secondary>
10048 By default, both the preference value and the host name are returned for
10049 each MX record, separated by a space. If you want only host names, you can use
10050 the pseudo-type MXH:
10052 <literallayout class="monospaced">
10053 ${lookup dnsdb{mxh=a.b.example}}
10056 In this case, the preference values are omitted, and just the host names are
10060 <indexterm role="concept">
10061 <primary>name server for enclosing domain</primary>
10063 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
10064 records on the given domain, but if none are found, it removes the first
10065 component of the domain name, and tries again. This process continues until NS
10066 records are found or there are no more components left (or there is a DNS
10067 error). In other words, it may return the name servers for a top-level domain,
10068 but it never returns the root name servers. If there are no NS records for the
10069 top-level domain, the lookup fails. Consider these examples:
10071 <literallayout class="monospaced">
10072 ${lookup dnsdb{zns=xxx.quercite.com}}
10073 ${lookup dnsdb{zns=xxx.edu}}
10076 Assuming that in each case there are no NS records for the full domain name,
10077 the first returns the name servers for <option>quercite.com</option>, and the second returns
10078 the name servers for <option>edu</option>.
10081 You should be careful about how you use this lookup because, unless the
10082 top-level domain does not exist, the lookup always returns some host names. The
10083 sort of use to which this might be put is for seeing if the name servers for a
10084 given domain are on a blacklist. You can probably assume that the name servers
10085 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
10089 <indexterm role="concept">
10090 <primary>CSA</primary>
10091 <secondary>in <command>dnsdb</command> lookup</secondary>
10093 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
10094 records according to the CSA rules, which are described in section
10095 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
10096 not sufficient because of the extra parent domain search behaviour of CSA. The
10097 result of a successful lookup such as:
10099 <literallayout class="monospaced">
10100 ${lookup dnsdb {csa=$sender_helo_name}}
10103 has two space-separated fields: an authorization code and a target host name.
10104 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
10105 authorization required but absent, or <quote>?</quote> for unknown.
10108 <section id="SECID67">
10109 <title>Multiple dnsdb lookups</title>
10111 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
10112 However, you can specify a list of domains or IP addresses in a single
10113 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
10114 the default separator, but with the ability to change this. For example:
10116 <literallayout class="monospaced">
10117 ${lookup dnsdb{one.domain.com:two.domain.com}}
10118 ${lookup dnsdb{a=one.host.com:two.host.com}}
10119 ${lookup dnsdb{ptr = <; 1.2.3.4 ; 4.5.6.8}}
10122 In order to retain backwards compatibility, there is one special case: if
10123 the lookup type is PTR and no change of separator is specified, Exim looks
10124 to see if the rest of the string is precisely one IPv6 address. In this
10125 case, it does not treat it as a list.
10128 The data from each lookup is concatenated, with newline separators by default,
10129 in the same way that multiple DNS records for a single item are handled. A
10130 different separator can be specified, as described above.
10133 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
10134 temporary DNS error for any of them, the behaviour is controlled by
10135 an optional keyword followed by a comma that may appear before the record
10136 type. The possible keywords are <quote>defer_strict</quote>, <quote>defer_never</quote>, and
10137 <quote>defer_lax</quote>. With <quote>strict</quote> behaviour, any temporary DNS error causes the
10138 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
10139 ignored, and the behaviour is as if the DNS lookup failed to find anything.
10140 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
10141 error causes the whole lookup to defer only if none of the other lookups
10142 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
10144 <literallayout class="monospaced">
10145 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
10146 ${lookup dnsdb{a=one.host.com:two.host.com}}
10149 Thus, in the default case, as long as at least one of the DNS lookups
10150 yields some data, the lookup succeeds.
10153 <section id="SECTldap">
10154 <title>More about LDAP</title>
10156 <indexterm role="concept">
10157 <primary>LDAP</primary>
10158 <secondary>lookup, more about</secondary>
10160 <indexterm role="concept">
10161 <primary>lookup</primary>
10162 <secondary>LDAP</secondary>
10164 <indexterm role="concept">
10165 <primary>Solaris</primary>
10166 <secondary>LDAP</secondary>
10168 The original LDAP implementation came from the University of Michigan; this has
10169 become <quote>Open LDAP</quote>, and there are now two different releases. Another
10170 implementation comes from Netscape, and Solaris 7 and subsequent releases
10171 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
10172 the lookup function level, their error handling is different. For this reason
10173 it is necessary to set a compile-time variable when building Exim with LDAP, to
10174 indicate which LDAP library is in use. One of the following should appear in
10175 your <filename>Local/Makefile</filename>:
10177 <literallayout class="monospaced">
10178 LDAP_LIB_TYPE=UMICHIGAN
10179 LDAP_LIB_TYPE=OPENLDAP1
10180 LDAP_LIB_TYPE=OPENLDAP2
10181 LDAP_LIB_TYPE=NETSCAPE
10182 LDAP_LIB_TYPE=SOLARIS
10185 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
10186 same interface as the University of Michigan version.
10189 There are three LDAP lookup types in Exim. These behave slightly differently in
10190 the way they handle the results of a query:
10195 <command>ldap</command> requires the result to contain just one entry; if there are more, it
10201 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
10202 Distinguished Name that is returned rather than any attribute values.
10207 <command>ldapm</command> permits the result to contain more than one entry; the attributes
10208 from all of them are returned.
10213 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
10214 Exim behaves as if the entry did not exist, and the lookup fails. The format of
10215 the data returned by a successful lookup is described in the next section.
10216 First we explain how LDAP queries are coded.
10219 <section id="SECTforldaque">
10220 <title>Format of LDAP queries</title>
10222 <indexterm role="concept">
10223 <primary>LDAP</primary>
10224 <secondary>query format</secondary>
10226 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
10227 the configuration of a <command>redirect</command> router one might have this setting:
10229 <literallayout class="monospaced">
10230 data = ${lookup ldap \
10231 {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
10232 c=UK?mailbox?base?}}
10235 <indexterm role="concept">
10236 <primary>LDAP</primary>
10237 <secondary>with TLS</secondary>
10239 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
10240 secure (encrypted) LDAP connections. The second of these ensures that an
10241 encrypted TLS connection is used.
10244 <section id="SECID68">
10245 <title>LDAP quoting</title>
10247 <indexterm role="concept">
10248 <primary>LDAP</primary>
10249 <secondary>quoting</secondary>
10251 Two levels of quoting are required in LDAP queries, the first for LDAP itself
10252 and the second because the LDAP query is represented as a URL. Furthermore,
10253 within an LDAP query, two different kinds of quoting are required. For this
10254 reason, there are two different LDAP-specific quoting operators.
10257 The <option>quote_ldap</option> operator is designed for use on strings that are part of
10258 filter specifications. Conceptually, it first does the following conversions on
10261 <literallayout class="monospaced">
10268 in accordance with RFC 2254. The resulting string is then quoted according
10269 to the rules for URLs, that is, all non-alphanumeric characters except
10271 <literallayout class="monospaced">
10272 ! $ ' - . _ ( ) * +
10275 are converted to their hex values, preceded by a percent sign. For example:
10277 <literallayout class="monospaced">
10278 ${quote_ldap: a(bc)*, a<yz>; }
10283 <literallayout class="monospaced">
10284 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
10287 Removing the URL quoting, this is (with a leading and a trailing space):
10289 <literallayout class="monospaced">
10290 a\28bc\29\2A, a<yz>;
10293 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
10294 base DN specifications in queries. Conceptually, it first converts the string
10295 by inserting a backslash in front of any of the following characters:
10297 <literallayout class="monospaced">
10298 , + " \ < > ;
10301 It also inserts a backslash before any leading spaces or # characters, and
10302 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
10303 is then quoted according to the rules for URLs. For example:
10305 <literallayout class="monospaced">
10306 ${quote_ldap_dn: a(bc)*, a<yz>; }
10311 <literallayout class="monospaced">
10312 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
10315 Removing the URL quoting, this is (with a trailing space):
10317 <literallayout class="monospaced">
10318 \ a(bc)*\, a\<yz\>\;\
10321 There are some further comments about quoting in the section on LDAP
10322 authentication below.
10325 <section id="SECID69">
10326 <title>LDAP connections</title>
10328 <indexterm role="concept">
10329 <primary>LDAP</primary>
10330 <secondary>connections</secondary>
10332 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
10333 is in use, via a Unix domain socket. The example given above does not specify
10334 an LDAP server. A server that is reached by TCP/IP can be specified in a query
10335 by starting it with
10337 <literallayout class="monospaced">
10338 ldap://<hostname>:<port>/...
10341 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
10342 used. When no server is specified in a query, a list of default servers is
10343 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
10344 colon-separated list of servers which are tried in turn until one successfully
10345 handles a query, or there is a serious error. Successful handling either
10346 returns the requested data, or indicates that it does not exist. Serious errors
10347 are syntactical, or multiple values when only a single value is expected.
10348 Errors which cause the next server to be tried are connection failures, bind
10349 failures, and timeouts.
10352 For each server name in the list, a port number can be given. The standard way
10353 of specifying a host and port is to use a colon separator (RFC 1738). Because
10354 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
10355 doubled. For example
10357 <literallayout class="monospaced">
10358 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
10361 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
10362 to the LDAP library with no server name, and the library’s default (normally
10363 the local host) is used.
10366 If you are using the OpenLDAP library, you can connect to an LDAP server using
10367 a Unix domain socket instead of a TCP/IP connection. This is specified by using
10368 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
10369 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
10373 For this type of connection, instead of a host name for the server, a pathname
10374 for the socket is required, and the port number is not relevant. The pathname
10375 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
10376 the query. In the former case, you can have settings such as
10378 <literallayout class="monospaced">
10379 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
10382 When the pathname is given in the query, you have to escape the slashes as
10383 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
10385 <literallayout class="monospaced">
10386 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
10389 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
10390 a pathname, it uses the Unix domain socket code, even if the query actually
10391 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
10392 socket connection. This behaviour means that you can use a setting of
10393 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
10394 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
10395 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
10399 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
10400 specified, an error is diagnosed. However, if there are more items in
10401 <option>ldap_default_servers</option>, they are tried. In other words:
10406 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
10412 Using <literal>ldapi</literal> with a host name causes an error.
10417 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
10418 <option>ldap_default_servers</option>, does whatever the library does by default.
10421 <section id="SECID70">
10422 <title>LDAP authentication and control information</title>
10424 <indexterm role="concept">
10425 <primary>LDAP</primary>
10426 <secondary>authentication</secondary>
10428 The LDAP URL syntax provides no way of passing authentication and other control
10429 information to the server. To make this possible, the URL in an LDAP query may
10430 be preceded by any number of <<emphasis>name</emphasis>>=<<emphasis>value</emphasis>> settings, separated by
10431 spaces. If a value contains spaces it must be enclosed in double quotes, and
10432 when double quotes are used, backslash is interpreted in the usual way inside
10433 them. The following names are recognized:
10436 <literal>DEREFERENCE</literal> set the dereferencing parameter
10437 <literal>NETTIME </literal> set a timeout for a network operation
10438 <literal>USER </literal> set the DN, for authenticating the LDAP bind
10439 <literal>PASS </literal> set the password, likewise
10440 <literal>REFERRALS </literal> set the referrals parameter
10441 <literal>SIZE </literal> set the limit for the number of entries returned
10442 <literal>TIME </literal> set the maximum waiting time for a query
10445 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
10446 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>. The value of the REFERRALS parameter
10447 must be <quote>follow</quote> (the default) or <quote>nofollow</quote>. The latter stops the LDAP
10448 library from trying to follow referrals issued by the LDAP server.
10451 The name CONNECT is an obsolete name for NETTIME, retained for
10452 backwards compatibility. This timeout (specified as a number of seconds) is
10453 enforced from the client end for operations that can be carried out over a
10454 network. Specifically, it applies to network connections and calls to the
10455 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
10456 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
10457 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
10458 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
10459 Netscape SDK; for OpenLDAP no action is taken.
10462 The TIME parameter (also a number of seconds) is passed to the server to
10463 set a server-side limit on the time taken to complete a search.
10466 Here is an example of an LDAP query in an Exim lookup that uses some of these
10467 values. This is a single line, folded to fit on the page:
10469 <literallayout class="monospaced">
10471 {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
10472 ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
10476 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
10477 any of the auxiliary data. Exim configuration settings that include lookups
10478 which contain password information should be preceded by <quote>hide</quote> to prevent
10479 non-admin users from using the <option>-bP</option> option to see their values.
10482 The auxiliary data items may be given in any order. The default is no
10483 connection timeout (the system timeout is used), no user or password, no limit
10484 on the number of entries returned, and no time limit on queries.
10487 When a DN is quoted in the USER= setting for LDAP authentication, Exim
10488 removes any URL quoting that it may contain before passing it LDAP. Apparently
10489 some libraries do this for themselves, but some do not. Removing the URL
10490 quoting has two advantages:
10495 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
10496 DNs as with DNs inside actual queries.
10501 It permits spaces inside USER= DNs.
10506 For example, a setting such as
10508 <literallayout class="monospaced">
10509 USER=cn=${quote_ldap_dn:$1}
10512 should work even if <varname>$1</varname> contains spaces.
10515 Expanded data for the PASS= value should be quoted using the <option>quote</option>
10516 expansion operator, rather than the LDAP quote operators. The only reason this
10517 field needs quoting is to ensure that it conforms to the Exim syntax, which
10518 does not allow unquoted spaces. For example:
10520 <literallayout class="monospaced">
10524 The LDAP authentication mechanism can be used to check passwords as part of
10525 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
10526 <xref linkend="CHAPexpand"/>.
10529 <section id="SECID71">
10530 <title>Format of data returned by LDAP</title>
10532 <indexterm role="concept">
10533 <primary>LDAP</primary>
10534 <secondary>returned data formats</secondary>
10536 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
10537 as a sequence of values, for example
10539 <literallayout class="monospaced">
10540 cn=manager, o=University of Cambridge, c=UK
10543 The <command>ldap</command> lookup type generates an error if more than one entry matches the
10544 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
10545 the result between the data from different entries. It is possible for multiple
10546 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
10547 you know that whatever values are returned all came from a single entry in the
10551 In the common case where you specify a single attribute in your LDAP query, the
10552 result is not quoted, and does not contain the attribute name. If the attribute
10553 has multiple values, they are separated by commas.
10556 If you specify multiple attributes, the result contains space-separated, quoted
10557 strings, each preceded by the attribute name and an equals sign. Within the
10558 quotes, the quote character, backslash, and newline are escaped with
10559 backslashes, and commas are used to separate multiple values for the attribute.
10560 Apart from the escaping, the string within quotes takes the same form as the
10561 output when a single attribute is requested. Specifying no attributes is the
10562 same as specifying all of an entry’s attributes.
10565 Here are some examples of the output format. The first line of each pair is an
10566 LDAP query, and the second is the data that is returned. The attribute called
10567 <option>attr1</option> has two values, whereas <option>attr2</option> has only one value:
10569 <literallayout class="monospaced">
10570 ldap:///o=base?attr1?sub?(uid=fred)
10573 ldap:///o=base?attr2?sub?(uid=fred)
10576 ldap:///o=base?attr1,attr2?sub?(uid=fred)
10577 attr1="value1.1, value1.2" attr2="value two"
10579 ldap:///o=base??sub?(uid=fred)
10580 objectClass="top" attr1="value1.1, value1.2" attr2="value two"
10583 The <option>extract</option> operator in string expansions can be used to pick out
10584 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs. You can
10585 make use of Exim’s <option>-be</option> option to run expansion tests and thereby check the
10586 results of LDAP lookups.
10589 <section id="SECTnisplus">
10590 <title>More about NIS+</title>
10592 <indexterm role="concept">
10593 <primary>NIS+ lookup type</primary>
10595 <indexterm role="concept">
10596 <primary>lookup</primary>
10597 <secondary>NIS+</secondary>
10599 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
10600 and field name. If this is given, the result of a successful query is the
10601 contents of the named field; otherwise the result consists of a concatenation
10602 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
10603 values containing spaces are quoted. For example, the query
10605 <literallayout class="monospaced">
10606 [name=mg1456],passwd.org_dir
10609 might return the string
10611 <literallayout class="monospaced">
10612 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
10613 home=/home/mg1456 shell=/bin/bash shadow=""
10616 (split over two lines here to fit on the page), whereas
10618 <literallayout class="monospaced">
10619 [name=mg1456],passwd.org_dir:gcos
10624 <literallayout class="monospaced">
10628 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
10629 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
10630 operator is to double any quote characters within the text.
10633 <section id="SECTsql">
10634 <title>SQL lookups</title>
10636 <indexterm role="concept">
10637 <primary>SQL lookup types</primary>
10639 <indexterm role="concept">
10640 <primary>MySQL</primary>
10641 <secondary>lookup type</secondary>
10643 <indexterm role="concept">
10644 <primary>PostgreSQL lookup type</primary>
10646 <indexterm role="concept">
10647 <primary>lookup</primary>
10648 <secondary>MySQL</secondary>
10650 <indexterm role="concept">
10651 <primary>lookup</primary>
10652 <secondary>PostgreSQL</secondary>
10654 <indexterm role="concept">
10655 <primary>Oracle</primary>
10656 <secondary>lookup type</secondary>
10658 <indexterm role="concept">
10659 <primary>lookup</primary>
10660 <secondary>Oracle</secondary>
10662 <indexterm role="concept">
10663 <primary>InterBase lookup type</primary>
10665 <indexterm role="concept">
10666 <primary>lookup</primary>
10667 <secondary>InterBase</secondary>
10669 Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, and SQLite
10670 databases. Queries for these databases contain SQL statements, so an example
10673 <literallayout class="monospaced">
10674 ${lookup mysql{select mailbox from users where id='userx'}\
10678 If the result of the query contains more than one field, the data for each
10679 field in the row is returned, preceded by its name, so the result of
10681 <literallayout class="monospaced">
10682 ${lookup pgsql{select home,name from users where id='userx'}\
10688 <literallayout class="monospaced">
10689 home=/home/userx name="Mister X"
10692 Empty values and values containing spaces are double quoted, with embedded
10693 quotes escaped by a backslash. If the result of the query contains just one
10694 field, the value is passed back verbatim, without a field name, for example:
10696 <literallayout class="monospaced">
10700 If the result of the query yields more than one row, it is all concatenated,
10701 with a newline between the data for each row.
10704 <section id="SECID72">
10705 <title>More about MySQL, PostgreSQL, Oracle, and InterBase</title>
10707 <indexterm role="concept">
10708 <primary>MySQL</primary>
10709 <secondary>lookup type</secondary>
10711 <indexterm role="concept">
10712 <primary>PostgreSQL lookup type</primary>
10714 <indexterm role="concept">
10715 <primary>lookup</primary>
10716 <secondary>MySQL</secondary>
10718 <indexterm role="concept">
10719 <primary>lookup</primary>
10720 <secondary>PostgreSQL</secondary>
10722 <indexterm role="concept">
10723 <primary>Oracle</primary>
10724 <secondary>lookup type</secondary>
10726 <indexterm role="concept">
10727 <primary>lookup</primary>
10728 <secondary>Oracle</secondary>
10730 <indexterm role="concept">
10731 <primary>InterBase lookup type</primary>
10733 <indexterm role="concept">
10734 <primary>lookup</primary>
10735 <secondary>InterBase</secondary>
10737 If any MySQL, PostgreSQL, Oracle, or InterBase lookups are used, the
10738 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, or <option>ibase_servers</option>
10739 option (as appropriate) must be set to a colon-separated list of server
10741 (For MySQL and PostgreSQL only, the global option need not be set if all
10742 queries contain their own server information – see section
10743 <xref linkend="SECTspeserque"/>.) Each item in the list is a slash-separated list of four
10744 items: host name, database name, user name, and password. In the case of
10745 Oracle, the host name field is used for the <quote>service name</quote>, and the database
10746 name field is not used and should be empty. For example:
10748 <literallayout class="monospaced">
10749 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
10752 Because password data is sensitive, you should always precede the setting with
10753 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
10754 option. Here is an example where two MySQL servers are listed:
10756 <literallayout class="monospaced">
10757 hide mysql_servers = localhost/users/root/secret:\
10758 otherhost/users/root/othersecret
10761 For MySQL and PostgreSQL, a host may be specified as <<emphasis>name</emphasis>>:<<emphasis>port</emphasis>> but
10762 because this is a colon-separated list, the colon has to be doubled. For each
10763 query, these parameter groups are tried in order until a connection is made and
10764 a query is successfully processed. The result of a query may be that no data is
10765 found, but that is still a successful query. In other words, the list of
10766 servers provides a backup facility, not a list of different places to look.
10769 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
10770 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
10771 respectively, and the characters single-quote, double-quote, and backslash
10772 itself are escaped with backslashes. The <option>quote_pgsql</option> expansion operator, in
10773 addition, escapes the percent and underscore characters. This cannot be done
10774 for MySQL because these escapes are not recognized in contexts where these
10775 characters are not special.
10778 <section id="SECTspeserque">
10779 <title>Specifying the server in the query</title>
10781 For MySQL and PostgreSQL lookups (but not currently for Oracle and InterBase),
10782 it is possible to specify a list of servers with an individual query. This is
10783 done by starting the query with
10786 <literal>servers=</literal><emphasis>server1:server2:server3:...</emphasis><literal>;</literal>
10789 Each item in the list may take one of two forms:
10791 <orderedlist numeration="arabic">
10794 If it contains no slashes it is assumed to be just a host name. The appropriate
10795 global option (<option>mysql_servers</option> or <option>pgsql_servers</option>) is searched for a host
10796 of the same name, and the remaining parameters (database, user, password) are
10802 If it contains any slashes, it is taken as a complete parameter set.
10807 The list of servers is used in exactly the same way as the global list.
10808 Once a connection to a server has happened and a query has been
10809 successfully executed, processing of the lookup ceases.
10812 This feature is intended for use in master/slave situations where updates
10813 are occurring and you want to update the master rather than a slave. If the
10814 master is in the list as a backup for reading, you might have a global setting
10817 <literallayout class="monospaced">
10818 mysql_servers = slave1/db/name/pw:\
10819 slave2/db/name/pw:\
10823 In an updating lookup, you could then write:
10825 <literallayout class="monospaced">
10826 ${lookup mysql{servers=master; UPDATE ...} }
10829 That query would then be sent only to the master server. If, on the other hand,
10830 the master is not to be used for reading, and so is not present in the global
10831 option, you can still update it by a query of this form:
10833 <literallayout class="monospaced">
10834 ${lookup pgsql{servers=master/db/name/pw; UPDATE ...} }
10837 <section id="SECID73">
10838 <title>Special MySQL features</title>
10840 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
10841 causes a connection to the server on the local host by means of a Unix domain
10842 socket. An alternate socket can be specified in parentheses. The full syntax of
10843 each item in <option>mysql_servers</option> is:
10846 <<emphasis>hostname</emphasis>>::<<emphasis>port</emphasis>>(<<emphasis>socket name</emphasis>>)/<<emphasis>database</emphasis>>/<<emphasis>user</emphasis>>/<<emphasis>password</emphasis>>
10849 Any of the three sub-parts of the first field can be omitted. For normal use on
10850 the local host it can be left blank or set to just <quote>localhost</quote>.
10853 No database need be supplied – but if it is absent here, it must be given in
10857 If a MySQL query is issued that does not request any data (an insert, update,
10858 or delete command), the result of the lookup is the number of rows affected.
10861 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
10862 anything (for example, setting a field to the value it already has), the result
10863 is zero because no rows are affected.
10866 <section id="SECID74">
10867 <title>Special PostgreSQL features</title>
10869 PostgreSQL lookups can also use Unix domain socket connections to the database.
10870 This is usually faster and costs less CPU time than a TCP/IP connection.
10871 However it can be used only if the mail server runs on the same machine as the
10872 database server. A configuration line for PostgreSQL via Unix domain sockets
10875 <literallayout class="monospaced">
10876 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
10879 In other words, instead of supplying a host name, a path to the socket is
10880 given. The path name is enclosed in parentheses so that its slashes aren’t
10881 visually confused with the delimiters for the other server parameters.
10884 If a PostgreSQL query is issued that does not request any data (an insert,
10885 update, or delete command), the result of the lookup is the number of rows
10889 <section id="SECTsqlite">
10890 <title>More about SQLite</title>
10892 <indexterm role="concept">
10893 <primary>lookup</primary>
10894 <secondary>SQLite</secondary>
10896 <indexterm role="concept">
10897 <primary>sqlite lookup type</primary>
10899 SQLite is different to the other SQL lookups because a file name is required in
10900 addition to the SQL query. An SQLite database is a single file, and there is no
10901 daemon as in the other SQL databases. The interface to Exim requires the name
10902 of the file, as an absolute path, to be given at the start of the query. It is
10903 separated from the query by white space. This means that the path name cannot
10904 contain white space. Here is a lookup expansion example:
10906 <literallayout class="monospaced">
10907 ${lookup sqlite {/some/thing/sqlitedb \
10908 select name from aliases where id='userx';}}
10911 In a list, the syntax is similar. For example:
10913 <literallayout class="monospaced">
10914 domainlist relay_domains = sqlite;/some/thing/sqlitedb \
10915 select * from relays where ip='$sender_host_address';
10918 The only character affected by the <option>quote_sqlite</option> operator is a single
10919 quote, which it doubles.
10922 The SQLite library handles multiple simultaneous accesses to the database
10923 internally. Multiple readers are permitted, but only one process can
10924 update at once. Attempts to access the database while it is being updated
10925 are rejected after a timeout period, during which the SQLite library
10926 waits for the lock to be released. In Exim, the default timeout is set
10927 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
10929 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
10930 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
10935 <chapter id="CHAPdomhosaddlists">
10936 <title>Domain, host, address, and local part lists</title>
10937 <titleabbrev>Domain, host, and address lists</titleabbrev>
10939 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
10940 <primary>lists of domains; hosts; etc.</primary>
10942 A number of Exim configuration options contain lists of domains, hosts,
10943 email addresses, or local parts. For example, the <option>hold_domains</option> option
10944 contains a list of domains whose delivery is currently suspended. These lists
10945 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
10946 arguments to expansion conditions such as <option>match_domain</option>.
10949 Each item in one of these lists is a pattern to be matched against a domain,
10950 host, email address, or local part, respectively. In the sections below, the
10951 different types of pattern for each case are described, but first we cover some
10952 general facilities that apply to all four kinds of list.
10954 <section id="SECID75">
10955 <title>Expansion of lists</title>
10957 <indexterm role="concept">
10958 <primary>expansion</primary>
10959 <secondary>of lists</secondary>
10961 Each list is expanded as a single string before it is used. The result of
10962 expansion must be a list, possibly containing empty items, which is split up
10963 into separate items for matching. By default, colon is the separator character,
10964 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
10965 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
10966 discusses the way to specify empty list items.
10969 If the string expansion is forced to fail, Exim behaves as if the item it is
10970 testing (domain, host, address, or local part) is not in the list. Other
10971 expansion failures cause temporary errors.
10974 If an item in a list is a regular expression, backslashes, dollars and possibly
10975 other special characters in the expression must be protected against
10976 misinterpretation by the string expander. The easiest way to do this is to use
10977 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
10978 expression should not be expanded. For example, in an ACL you might have:
10980 <literallayout class="monospaced">
10981 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
10982 ${lookup{$domain}lsearch{/badsenders/bydomain}}
10985 The first item is a regular expression that is protected from expansion by
10986 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
10987 senders based on the receiving domain.
10990 <section id="SECID76">
10991 <title>Negated items in lists</title>
10993 <indexterm role="concept">
10994 <primary>list</primary>
10995 <secondary>negation</secondary>
10997 <indexterm role="concept">
10998 <primary>negation</primary>
10999 <secondary>in lists</secondary>
11001 Items in a list may be positive or negative. Negative items are indicated by a
11002 leading exclamation mark, which may be followed by optional white space. A list
11003 defines a set of items (domains, etc). When Exim processes one of these lists,
11004 it is trying to find out whether a domain, host, address, or local part
11005 (respectively) is in the set that is defined by the list. It works like this:
11008 The list is scanned from left to right. If a positive item is matched, the
11009 subject that is being checked is in the set; if a negative item is matched, the
11010 subject is not in the set. If the end of the list is reached without the
11011 subject having matched any of the patterns, it is in the set if the last item
11012 was a negative one, but not if it was a positive one. For example, the list in
11014 <literallayout class="monospaced">
11015 domainlist relay_domains = !a.b.c : *.b.c
11018 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
11019 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
11020 list is positive. However, if the setting were
11022 <literallayout class="monospaced">
11023 domainlist relay_domains = !a.b.c
11026 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
11027 list is negative. In other words, a list that ends with a negative item behaves
11028 as if it had an extra item <literal>:*</literal> on the end.
11031 Another way of thinking about positive and negative items in lists is to read
11032 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
11036 <section id="SECTfilnamlis">
11037 <title>File names in lists</title>
11039 <indexterm role="concept">
11040 <primary>list</primary>
11041 <secondary>file name in</secondary>
11043 If an item in a domain, host, address, or local part list is an absolute file
11044 name (beginning with a slash character), each line of the file is read and
11045 processed as if it were an independent item in the list, except that further
11046 file names are not allowed,
11047 and no expansion of the data from the file takes place.
11048 Empty lines in the file are ignored, and the file may also contain comment
11054 For domain and host lists, if a # character appears anywhere in a line of the
11055 file, it and all following characters are ignored.
11060 Because local parts may legitimately contain # characters, a comment in an
11061 address list or local part list file is recognized only if # is preceded by
11062 white space or the start of the line. For example:
11064 <literallayout class="monospaced">
11065 not#comment@x.y.z # but this is a comment
11070 Putting a file name in a list has the same effect as inserting each line of the
11071 file as an item in the list (blank lines and comments excepted). However, there
11072 is one important difference: the file is read each time the list is processed,
11073 so if its contents vary over time, Exim’s behaviour changes.
11076 If a file name is preceded by an exclamation mark, the sense of any match
11077 within the file is inverted. For example, if
11079 <literallayout class="monospaced">
11080 hold_domains = !/etc/nohold-domains
11083 and the file contains the lines
11085 <literallayout class="monospaced">
11090 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
11091 any domain matching <literal>*.b.c</literal> is not.
11094 <section id="SECID77">
11095 <title>An lsearch file is not an out-of-line list</title>
11097 As will be described in the sections that follow, lookups can be used in lists
11098 to provide indexed methods of checking list membership. There has been some
11099 confusion about the way <command>lsearch</command> lookups work in lists. Because
11100 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
11101 sometimes thought that it is allowed to contain wild cards and other kinds of
11102 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
11103 always fixed strings, just as for any other single-key lookup type.
11106 If you want to use a file to contain wild-card patterns that form part of a
11107 list, just give the file name on its own, without a search type, as described
11108 in the previous section. You could also use the <command>wildlsearch</command> or
11109 <command>nwildlsearch</command>, but there is no advantage in doing this.
11112 <section id="SECTnamedlists">
11113 <title>Named lists</title>
11115 <indexterm role="concept">
11116 <primary>named lists</primary>
11118 <indexterm role="concept">
11119 <primary>list</primary>
11120 <secondary>named</secondary>
11122 A list of domains, hosts, email addresses, or local parts can be given a name
11123 which is then used to refer to the list elsewhere in the configuration. This is
11124 particularly convenient if the same list is required in several different
11125 places. It also allows lists to be given meaningful names, which can improve
11126 the readability of the configuration. For example, it is conventional to define
11127 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
11128 locally on a host, using a configuration line such as
11130 <literallayout class="monospaced">
11131 domainlist local_domains = localhost:my.dom.example
11134 Named lists are referenced by giving their name preceded by a plus sign, so,
11135 for example, a router that is intended to handle local domains would be
11136 configured with the line
11138 <literallayout class="monospaced">
11139 domains = +local_domains
11142 The first router in a configuration is often one that handles all domains
11143 except the local ones, using a configuration with a negated item like this:
11145 <literallayout class="monospaced">
11148 domains = ! +local_domains
11149 transport = remote_smtp
11153 The four kinds of named list are created by configuration lines starting with
11154 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
11155 respectively. Then there follows the name that you are defining, followed by an
11156 equals sign and the list itself. For example:
11158 <literallayout class="monospaced">
11159 hostlist relay_hosts = 192.168.23.0/24 : my.friend.example
11160 addresslist bad_senders = cdb;/etc/badsenders
11163 A named list may refer to other named lists:
11165 <literallayout class="monospaced">
11166 domainlist dom1 = first.example : second.example
11167 domainlist dom2 = +dom1 : third.example
11168 domainlist dom3 = fourth.example : +dom2 : fifth.example
11171 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
11172 effect may not be what you intended, because the negation does not propagate
11173 out to the higher level. For example, consider:
11175 <literallayout class="monospaced">
11176 domainlist dom1 = !a.b
11177 domainlist dom2 = +dom1 : *.b
11180 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
11181 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
11182 means it matches the second list as well. The effect is not the same as
11184 <literallayout class="monospaced">
11185 domainlist dom2 = !a.b : *.b
11188 where <emphasis>x.y</emphasis> does not match. It’s best to avoid negation altogether in
11189 referenced lists if you can.
11192 Named lists may have a performance advantage. When Exim is routing an
11193 address or checking an incoming message, it caches the result of tests on named
11194 lists. So, if you have a setting such as
11196 <literallayout class="monospaced">
11197 domains = +local_domains
11200 on several of your routers
11201 or in several ACL statements,
11202 the actual test is done only for the first one. However, the caching works only
11203 if there are no expansions within the list itself or any sublists that it
11204 references. In other words, caching happens only for lists that are known to be
11205 the same each time they are referenced.
11208 By default, there may be up to 16 named lists of each type. This limit can be
11209 extended by changing a compile-time variable. The use of domain and host lists
11210 is recommended for concepts such as local domains, relay domains, and relay
11211 hosts. The default configuration is set up like this.
11214 <section id="SECID78">
11215 <title>Named lists compared with macros</title>
11217 <indexterm role="concept">
11218 <primary>list</primary>
11219 <secondary>named compared with macro</secondary>
11221 <indexterm role="concept">
11222 <primary>macro</primary>
11223 <secondary>compared with named list</secondary>
11225 At first sight, named lists might seem to be no different from macros in the
11226 configuration file. However, macros are just textual substitutions. If you
11229 <literallayout class="monospaced">
11230 ALIST = host1 : host2
11231 auth_advertise_hosts = !ALIST
11234 it probably won’t do what you want, because that is exactly the same as
11236 <literallayout class="monospaced">
11237 auth_advertise_hosts = !host1 : host2
11240 Notice that the second host name is not negated. However, if you use a host
11243 <literallayout class="monospaced">
11244 hostlist alist = host1 : host2
11245 auth_advertise_hosts = ! +alist
11248 the negation applies to the whole list, and so that is equivalent to
11250 <literallayout class="monospaced">
11251 auth_advertise_hosts = !host1 : !host2
11254 <section id="SECID79">
11255 <title>Named list caching</title>
11257 <indexterm role="concept">
11258 <primary>list</primary>
11259 <secondary>caching of named</secondary>
11261 <indexterm role="concept">
11262 <primary>caching</primary>
11263 <secondary>named lists</secondary>
11265 While processing a message, Exim caches the result of checking a named list if
11266 it is sure that the list is the same each time. In practice, this means that
11267 the cache operates only if the list contains no $ characters, which guarantees
11268 that it will not change when it is expanded. Sometimes, however, you may have
11269 an expanded list that you know will be the same each time within a given
11270 message. For example:
11272 <literallayout class="monospaced">
11273 domainlist special_domains = \
11274 ${lookup{$sender_host_address}cdb{/some/file}}
11277 This provides a list of domains that depends only on the sending host’s IP
11278 address. If this domain list is referenced a number of times (for example,
11279 in several ACL lines, or in several routers) the result of the check is not
11280 cached by default, because Exim does not know that it is going to be the
11281 same list each time.
11284 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
11285 cache the result anyway. For example:
11287 <literallayout class="monospaced">
11288 domainlist_cache special_domains = ${lookup{...
11291 If you do this, you should be absolutely sure that caching is going to do
11292 the right thing in all cases. When in doubt, leave it out.
11295 <section id="SECTdomainlist">
11296 <title>Domain lists</title>
11298 <indexterm role="concept">
11299 <primary>domain list</primary>
11300 <secondary>patterns for</secondary>
11302 <indexterm role="concept">
11303 <primary>list</primary>
11304 <secondary>domain list</secondary>
11306 Domain lists contain patterns that are to be matched against a mail domain.
11307 The following types of item may appear in domain lists:
11312 <indexterm role="concept">
11313 <primary>primary host name</primary>
11315 <indexterm role="concept">
11316 <primary>host name</primary>
11317 <secondary>matched in domain list</secondary>
11319 <indexterm role="option">
11320 <primary><option>primary_hostname</option></primary>
11322 <indexterm role="concept">
11323 <primary>domain list</primary>
11324 <secondary>matching primary host name</secondary>
11326 <indexterm role="concept">
11327 <primary>@ in a domain list</primary>
11329 If a pattern consists of a single @ character, it matches the local host name,
11330 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
11331 possible to use the same configuration file on several different hosts that
11332 differ only in their names.
11337 <indexterm role="concept">
11338 <primary>@[] in a domain list</primary>
11340 <indexterm role="concept">
11341 <primary>domain list</primary>
11342 <secondary>matching local IP interfaces</secondary>
11344 <indexterm role="concept">
11345 <primary>domain literal</primary>
11347 If a pattern consists of the string <literal>@[]</literal> it matches an IP address enclosed
11348 in square brackets (as in an email address that contains a domain literal), but
11349 only if that IP address is recognized as local for email routing purposes. The
11350 <option>local_interfaces</option> and <option>extra_local_interfaces</option> options can be used to
11351 control which of a host’s several IP addresses are treated as local.
11352 In today’s Internet, the use of domain literals is controversial.
11357 <indexterm role="concept">
11358 <primary>@mx_any</primary>
11360 <indexterm role="concept">
11361 <primary>@mx_primary</primary>
11363 <indexterm role="concept">
11364 <primary>@mx_secondary</primary>
11366 <indexterm role="concept">
11367 <primary>domain list</primary>
11368 <secondary>matching MX pointers to local host</secondary>
11370 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
11371 has an MX record pointing to the local host or to any host that is listed in
11372 <indexterm role="option">
11373 <primary><option>hosts_treat_as_local</option></primary>
11375 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
11376 are similar, except that the first matches only when a primary MX target is the
11377 local host, and the second only when no primary MX target is the local host,
11378 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
11379 preference value – there may of course be more than one of them.
11382 The MX lookup that takes place when matching a pattern of this type is
11383 performed with the resolver options for widening names turned off. Thus, for
11384 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
11385 resolver’s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
11386 options of the <command>dnslookup</command> router for a discussion of domain widening.
11389 Sometimes you may want to ignore certain IP addresses when using one of these
11390 patterns. You can specify this by following the pattern with <literal>/ignore=</literal><<emphasis>ip
11391 list</emphasis>>, where <<emphasis>ip list</emphasis>> is a list of IP addresses. These addresses are
11392 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
11393 on a router). For example:
11395 <literallayout class="monospaced">
11396 domains = @mx_any/ignore=127.0.0.1
11399 This example matches any domain that has an MX record pointing to one of
11400 the local host’s IP addresses other than 127.0.0.1.
11403 The list of IP addresses is in fact processed by the same code that processes
11404 host lists, so it may contain CIDR-coded network specifications and it may also
11405 contain negative items.
11408 Because the list of IP addresses is a sublist within a domain list, you have to
11409 be careful about delimiters if there is more than one address. Like any other
11410 list, the default delimiter can be changed. Thus, you might have:
11412 <literallayout class="monospaced">
11413 domains = @mx_any/ignore=<;127.0.0.1;0.0.0.0 : \
11414 an.other.domain : ...
11417 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
11418 involved, it is easiest to change the delimiter for the main list as well:
11420 <literallayout class="monospaced">
11421 domains = <? @mx_any/ignore=<;127.0.0.1;::1 ? \
11422 an.other.domain ? ...
11427 <indexterm role="concept">
11428 <primary>asterisk</primary>
11429 <secondary>in domain list</secondary>
11431 <indexterm role="concept">
11432 <primary>domain list</primary>
11433 <secondary>asterisk in</secondary>
11435 <indexterm role="concept">
11436 <primary>domain list</primary>
11437 <secondary>matching <quote>ends with</quote></secondary>
11439 If a pattern starts with an asterisk, the remaining characters of the pattern
11440 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
11441 domain lists differs from its use in partial matching lookups. In a domain
11442 list, the character following the asterisk need not be a dot, whereas partial
11443 matching works only in terms of dot-separated components. For example, a domain
11444 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
11445 <emphasis>cipher.key.ex</emphasis>.
11450 <indexterm role="concept">
11451 <primary>regular expressions</primary>
11452 <secondary>in domain list</secondary>
11454 <indexterm role="concept">
11455 <primary>domain list</primary>
11456 <secondary>matching regular expression</secondary>
11458 If a pattern starts with a circumflex character, it is treated as a regular
11459 expression, and matched against the domain using a regular expression matching
11460 function. The circumflex is treated as part of the regular expression.
11461 Email domains are case-independent, so this regular expression match is by
11462 default case-independent, but you can make it case-dependent by starting it
11463 with <literal>(?-i)</literal>. References to descriptions of the syntax of regular expressions
11464 are given in chapter <xref linkend="CHAPregexp"/>.
11467 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
11468 must escape any backslash and dollar characters in the regular expression, or
11469 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
11470 it is not to be expanded (unless you really do want to build a regular
11471 expression by expansion, of course).
11476 <indexterm role="concept">
11477 <primary>lookup</primary>
11478 <secondary>in domain list</secondary>
11480 <indexterm role="concept">
11481 <primary>domain list</primary>
11482 <secondary>matching by lookup</secondary>
11484 If a pattern starts with the name of a single-key lookup type followed by a
11485 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
11486 must be a file name in a suitable format for the lookup type. For example, for
11487 <quote>cdb;</quote> it must be an absolute path:
11489 <literallayout class="monospaced">
11490 domains = cdb;/etc/mail/local_domains.cdb
11493 The appropriate type of lookup is done on the file using the domain name as the
11494 key. In most cases, the data that is looked up is not used; Exim is interested
11495 only in whether or not the key is present in the file. However, when a lookup
11496 is used for the <option>domains</option> option on a router
11497 or a <option>domains</option> condition in an ACL statement, the data is preserved in the
11498 <varname>$domain_data</varname> variable and can be referred to in other router options or
11499 other statements in the same ACL.
11504 Any of the single-key lookup type names may be preceded by
11505 <literal>partial</literal><<emphasis>n</emphasis>><literal>-</literal>, where the <<emphasis>n</emphasis>> is optional, for example,
11507 <literallayout class="monospaced">
11508 domains = partial-dbm;/partial/domains
11511 This causes partial matching logic to be invoked; a description of how this
11512 works is given in section <xref linkend="SECTpartiallookup"/>.
11517 <indexterm role="concept">
11518 <primary>asterisk</primary>
11519 <secondary>in lookup type</secondary>
11521 Any of the single-key lookup types may be followed by an asterisk. This causes
11522 a default lookup for a key consisting of a single asterisk to be done if the
11523 original lookup fails. This is not a useful feature when using a domain list to
11524 select particular domains (because any domain would match), but it might have
11525 value if the result of the lookup is being used via the <varname>$domain_data</varname>
11526 expansion variable.
11531 If the pattern starts with the name of a query-style lookup type followed by a
11532 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
11533 pattern must be an appropriate query for the lookup type, as described in
11534 chapter <xref linkend="CHAPfdlookup"/>. For example:
11536 <literallayout class="monospaced">
11537 hold_domains = mysql;select domain from holdlist \
11538 where domain = '$domain';
11541 In most cases, the data that is looked up is not used (so for an SQL query, for
11542 example, it doesn’t matter what field you select). Exim is interested only in
11543 whether or not the query succeeds. However, when a lookup is used for the
11544 <option>domains</option> option on a router, the data is preserved in the <varname>$domain_data</varname>
11545 variable and can be referred to in other options.
11550 <indexterm role="concept">
11551 <primary>domain list</primary>
11552 <secondary>matching literal domain name</secondary>
11554 If none of the above cases apply, a caseless textual comparison is made
11555 between the pattern and the domain.
11560 Here is an example that uses several different kinds of pattern:
11562 <literallayout class="monospaced">
11563 domainlist funny_domains = \
11566 *.foundation.fict.example : \
11567 \N^[1-2]\d{3}\.fict\.example$\N : \
11568 partial-dbm;/opt/data/penguin/book : \
11569 nis;domains.byname : \
11570 nisplus;[name=$domain,status=local],domains.org_dir
11573 There are obvious processing trade-offs among the various matching modes. Using
11574 an asterisk is faster than a regular expression, and listing a few names
11575 explicitly probably is too. The use of a file or database lookup is expensive,
11576 but may be the only option if hundreds of names are required. Because the
11577 patterns are tested in order, it makes sense to put the most commonly matched
11581 <section id="SECThostlist">
11582 <title>Host lists</title>
11584 <indexterm role="concept">
11585 <primary>host list</primary>
11586 <secondary>patterns in</secondary>
11588 <indexterm role="concept">
11589 <primary>list</primary>
11590 <secondary>host list</secondary>
11592 Host lists are used to control what remote hosts are allowed to do. For
11593 example, some hosts may be allowed to use the local host as a relay, and some
11594 may be permitted to use the SMTP ETRN command. Hosts can be identified in
11595 two different ways, by name or by IP address. In a host list, some types of
11596 pattern are matched to a host name, and some are matched to an IP address.
11597 You need to be particularly careful with this when single-key lookups are
11598 involved, to ensure that the right value is being used as the key.
11601 <section id="SECID80">
11602 <title>Special host list patterns</title>
11604 <indexterm role="concept">
11605 <primary>empty item in hosts list</primary>
11607 <indexterm role="concept">
11608 <primary>host list</primary>
11609 <secondary>empty string in</secondary>
11611 If a host list item is the empty string, it matches only when no remote host is
11612 involved. This is the case when a message is being received from a local
11613 process using SMTP on the standard input, that is, when a TCP/IP connection is
11617 <indexterm role="concept">
11618 <primary>asterisk</primary>
11619 <secondary>in host list</secondary>
11621 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
11622 the IP address nor the name is actually inspected.
11625 <section id="SECThoslispatip">
11626 <title>Host list patterns that match by IP address</title>
11628 <indexterm role="concept">
11629 <primary>host list</primary>
11630 <secondary>matching IP addresses</secondary>
11632 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
11633 the incoming address actually appears in the IPv6 host as
11634 <literal>::ffff:</literal><<emphasis>v4address</emphasis>>. When such an address is tested against a host
11635 list, it is converted into a traditional IPv4 address first. (Not all operating
11636 systems accept IPv4 calls on IPv6 sockets, as there have been some security
11640 The following types of pattern in a host list check the remote host by
11641 inspecting its IP address:
11646 If the pattern is a plain domain name (not a regular expression, not starting
11647 with *, not a lookup of any kind), Exim calls the operating system function
11648 to find the associated IP address(es). Exim uses the newer
11649 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
11650 This typically causes a forward DNS lookup of the name. The result is compared
11651 with the IP address of the subject host.
11654 If there is a temporary problem (such as a DNS timeout) with the host name
11655 lookup, a temporary error occurs. For example, if the list is being used in an
11656 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
11657 temporary SMTP error code. If no IP address can be found for the host name,
11658 what happens is described in section <xref linkend="SECTbehipnot"/> below.
11663 <indexterm role="concept">
11664 <primary>@ in a host list</primary>
11666 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
11667 domain name, as just described.
11672 If the pattern is an IP address, it is matched against the IP address of the
11673 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
11674 IPv6 addresses can be given in colon-separated format, but the colons have to
11675 be doubled so as not to be taken as item separators when the default list
11676 separator is used. IPv6 addresses are recognized even when Exim is compiled
11677 without IPv6 support. This means that if they appear in a host list on an
11678 IPv4-only host, Exim will not treat them as host names. They are just addresses
11679 that can never match a client host.
11684 <indexterm role="concept">
11685 <primary>@[] in a host list</primary>
11687 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
11688 the local host. For example, if the local host is an IPv4 host with one
11689 interface address 10.45.23.56, these two ACL statements have the same effect:
11691 <literallayout class="monospaced">
11692 accept hosts = 127.0.0.1 : 10.45.23.56
11698 <indexterm role="concept">
11699 <primary>CIDR notation</primary>
11701 If the pattern is an IP address followed by a slash and a mask length (for
11702 example 10.11.42.0/24), it is matched against the IP address of the subject
11703 host under the given mask. This allows, an entire network of hosts to be
11704 included (or excluded) by a single item. The mask uses CIDR notation; it
11705 specifies the number of address bits that must match, starting from the most
11706 significant end of the address.
11709 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
11710 of a range of addresses. It is the number of bits in the network portion of the
11711 address. The above example specifies a 24-bit netmask, so it matches all 256
11712 addresses in the 10.11.42.0 network. An item such as
11714 <literallayout class="monospaced">
11718 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
11719 32 for an IPv4 address is the same as no mask at all; just a single address
11723 Here is another example which shows an IPv4 and an IPv6 network:
11725 <literallayout class="monospaced">
11726 recipient_unqualified_hosts = 192.168.0.0/16: \
11727 3ffe::ffff::836f::::/48
11730 The doubling of list separator characters applies only when these items
11731 appear inline in a host list. It is not required when indirecting via a file.
11734 <literallayout class="monospaced">
11735 recipient_unqualified_hosts = /opt/exim/unqualnets
11738 could make use of a file containing
11740 <literallayout class="monospaced">
11742 3ffe:ffff:836f::/48
11745 to have exactly the same effect as the previous example. When listing IPv6
11746 addresses inline, it is usually more convenient to use the facility for
11747 changing separator characters. This list contains the same two networks:
11749 <literallayout class="monospaced">
11750 recipient_unqualified_hosts = <; 172.16.0.0/12; \
11751 3ffe:ffff:836f::/48
11754 The separator is changed to semicolon by the leading <quote><;</quote> at the start of the
11760 <section id="SECThoslispatsikey">
11761 <title>Host list patterns for single-key lookups by host address</title>
11763 <indexterm role="concept">
11764 <primary>host list</primary>
11765 <secondary>lookup of IP address</secondary>
11767 When a host is to be identified by a single-key lookup of its complete IP
11768 address, the pattern takes this form:
11771 <literal>net-<</literal><emphasis>single-key-search-type</emphasis><literal>>;<</literal><emphasis>search-data</emphasis><literal>></literal>
11776 <literallayout class="monospaced">
11777 hosts_lookup = net-cdb;/hosts-by-ip.db
11780 The text form of the IP address of the subject host is used as the lookup key.
11781 IPv6 addresses are converted to an unabbreviated form, using lower case
11782 letters, with dots as separators because colon is the key terminator in
11783 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
11784 quoting the keys, but this is a facility that was added later.] The data
11785 returned by the lookup is not used.
11788 <indexterm role="concept">
11789 <primary>IP address</primary>
11790 <secondary>masking</secondary>
11792 <indexterm role="concept">
11793 <primary>host list</primary>
11794 <secondary>masked IP address</secondary>
11796 Single-key lookups can also be performed using masked IP addresses, using
11797 patterns of this form:
11800 <literal>net<</literal><emphasis>number</emphasis><literal>>-<</literal><emphasis>single-key-search-type</emphasis><literal>>;<</literal><emphasis>search-data</emphasis><literal>></literal>
11805 <literallayout class="monospaced">
11806 net24-dbm;/networks.db
11809 The IP address of the subject host is masked using <<emphasis>number</emphasis>> as the mask
11810 length. A textual string is constructed from the masked value, followed by the
11811 mask, and this is used as the lookup key. For example, if the host’s IP address
11812 is 192.168.34.6, the key that is looked up for the above example is
11813 <quote>192.168.34.0/24</quote>.
11816 When an IPv6 address is converted to a string, dots are normally used instead
11817 of colons, so that keys in <command>lsearch</command> files need not contain colons (which
11818 terminate <command>lsearch</command> keys). This was implemented some time before the ability
11819 to quote keys was made available in <command>lsearch</command> files. However, the more
11820 recently implemented <command>iplsearch</command> files do require colons in IPv6 keys
11821 (notated using the quoting facility) so as to distinguish them from IPv4 keys.
11822 For this reason, when the lookup type is <command>iplsearch</command>, IPv6 addresses are
11823 converted using colons and not dots. In all cases, full, unabbreviated IPv6
11824 addresses are always used.
11827 Ideally, it would be nice to tidy up this anomalous situation by changing to
11828 colons in all cases, given that quoting is now available for <command>lsearch</command>.
11829 However, this would be an incompatible change that might break some existing
11833 <emphasis role="bold">Warning</emphasis>: Specifying <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
11834 IPv6 address) is not the same as specifying just <option>net-</option> without a number. In
11835 the former case the key strings include the mask value, whereas in the latter
11836 case the IP address is used on its own.
11839 <section id="SECThoslispatnam">
11840 <title>Host list patterns that match by host name</title>
11842 <indexterm role="concept">
11843 <primary>host</primary>
11844 <secondary>lookup failures</secondary>
11846 <indexterm role="concept">
11847 <primary>unknown host name</primary>
11849 <indexterm role="concept">
11850 <primary>host list</primary>
11851 <secondary>matching host name</secondary>
11853 There are several types of pattern that require Exim to know the name of the
11854 remote host. These are either wildcard patterns or lookups by name. (If a
11855 complete hostname is given without any wildcarding, it is used to find an IP
11856 address to match against, as described in the section <xref linkend="SECThoslispatip"/>
11860 If the remote host name is not already known when Exim encounters one of these
11861 patterns, it has to be found from the IP address.
11862 Although many sites on the Internet are conscientious about maintaining reverse
11863 DNS data for their hosts, there are also many that do not do this.
11864 Consequently, a name cannot always be found, and this may lead to unwanted
11865 effects. Take care when configuring host lists with wildcarded name patterns.
11866 Consider what will happen if a name cannot be found.
11869 Because of the problems of determining host names from IP addresses, matching
11870 against host names is not as common as matching against IP addresses.
11873 By default, in order to find a host name, Exim first does a reverse DNS lookup;
11874 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
11875 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
11876 are done can be changed by setting the <option>host_lookup_order</option> option. For
11877 security, once Exim has found one or more names, it looks up the IP addresses
11878 for these names and compares them with the IP address that it started with.
11879 Only those names whose IP addresses match are accepted. Any other names are
11880 discarded. If no names are left, Exim behaves as if the host name cannot be
11881 found. In the most common case there is only one name and one IP address.
11884 There are some options that control what happens if a host name cannot be
11885 found. These are described in section <xref linkend="SECTbehipnot"/> below.
11888 <indexterm role="concept">
11889 <primary>host</primary>
11890 <secondary>alias for</secondary>
11892 <indexterm role="concept">
11893 <primary>alias for host</primary>
11895 As a result of aliasing, hosts may have more than one name. When processing any
11896 of the following types of pattern, all the host’s names are checked:
11901 <indexterm role="concept">
11902 <primary>asterisk</primary>
11903 <secondary>in host list</secondary>
11905 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
11906 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
11907 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
11908 requirement. Other kinds of wildcarding require the use of a regular
11914 <indexterm role="concept">
11915 <primary>regular expressions</primary>
11916 <secondary>in host list</secondary>
11918 <indexterm role="concept">
11919 <primary>host list</primary>
11920 <secondary>regular expression in</secondary>
11922 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
11923 matched against the host name. Host names are case-independent, so this regular
11924 expression match is by default case-independent, but you can make it
11925 case-dependent by starting it with <literal>(?-i)</literal>. References to descriptions of the
11926 syntax of regular expressions are given in chapter <xref linkend="CHAPregexp"/>. For
11929 <literallayout class="monospaced">
11933 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
11934 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
11935 that backslash and dollar characters are not misinterpreted as part of the
11936 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
11937 part of the string as non-expandable. For example:
11939 <literallayout class="monospaced">
11940 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
11943 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
11944 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
11945 example. Without it, a match at the start of the host name is all that is
11951 <section id="SECTbehipnot">
11952 <title>Behaviour when an IP address or name cannot be found</title>
11954 <indexterm role="concept">
11955 <primary>host</primary>
11956 <secondary>lookup failures, permanent</secondary>
11958 While processing a host list, Exim may need to look up an IP address from a
11959 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
11960 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
11961 behaviour when it fails to find the information it is seeking is the same.
11964 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
11965 apply to temporary DNS errors, whose handling is described in the next section.
11968 <indexterm role="concept">
11969 <primary><literal>+include_unknown</literal></primary>
11971 <indexterm role="concept">
11972 <primary><literal>+ignore_unknown</literal></primary>
11974 By default, Exim behaves as if the host does not match the list. This may not
11975 always be what you want to happen. To change Exim’s behaviour, the special
11976 items <literal>+include_unknown</literal> or <literal>+ignore_unknown</literal> may appear in the list (at
11977 top level – they are not recognized in an indirected file).
11982 If any item that follows <literal>+include_unknown</literal> requires information that
11983 cannot found, Exim behaves as if the host does match the list. For example,
11985 <literallayout class="monospaced">
11986 host_reject_connection = +include_unknown:*.enemy.ex
11989 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
11990 any hosts whose name it cannot find.
11995 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
11996 be found, Exim ignores that item and proceeds to the rest of the list. For
11999 <literallayout class="monospaced">
12000 accept hosts = +ignore_unknown : friend.example : \
12004 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
12005 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
12006 name can be found for 192.168.4.5, it is rejected.
12011 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
12012 list. The effect of each one lasts until the next, or until the end of the
12016 <section id="SECTtemdnserr">
12017 <title>Temporary DNS errors when looking up host information</title>
12019 <indexterm role="concept">
12020 <primary>host</primary>
12021 <secondary>lookup failures, temporary</secondary>
12023 <indexterm role="concept">
12024 <primary><literal>+include_defer</literal></primary>
12026 <indexterm role="concept">
12027 <primary><literal>+ignore_defer</literal></primary>
12029 A temporary DNS lookup failure normally causes a defer action (except when
12030 <option>dns_again_means_nonexist</option> converts it into a permanent error). However,
12031 host lists can include <literal>+ignore_defer</literal> and <literal>+include_defer</literal>, analagous to
12032 <literal>+ignore_unknown</literal> and <literal>+include_unknown</literal>, as described in the previous
12033 section. These options should be used with care, probably only in non-critical
12034 host lists such as whitelists.
12037 <section id="SECThoslispatnamsk">
12038 <title>Host list patterns for single-key lookups by host name</title>
12040 <indexterm role="concept">
12041 <primary>unknown host name</primary>
12043 <indexterm role="concept">
12044 <primary>host list</primary>
12045 <secondary>matching host name</secondary>
12047 If a pattern is of the form
12050 <<emphasis>single-key-search-type</emphasis>>;<<emphasis>search-data</emphasis>>
12055 <literallayout class="monospaced">
12056 dbm;/host/accept/list
12059 a single-key lookup is performed, using the host name as its key. If the
12060 lookup succeeds, the host matches the item. The actual data that is looked up
12064 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
12065 keys in the file, not IP addresses. If you want to do lookups based on IP
12066 addresses, you must precede the search type with <quote>net-</quote> (see section
12067 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
12068 two items in the same list, one doing an address lookup and one doing a name
12069 lookup, both using the same file.
12072 <section id="SECID81">
12073 <title>Host list patterns for query-style lookups</title>
12075 If a pattern is of the form
12078 <<emphasis>query-style-search-type</emphasis>>;<<emphasis>query</emphasis>>
12081 the query is obeyed, and if it succeeds, the host matches the item. The actual
12082 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
12083 <varname>$sender_host_name</varname> can be used in the query. For example:
12085 <literallayout class="monospaced">
12086 hosts_lookup = pgsql;\
12087 select ip from hostlist where ip='$sender_host_address'
12090 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
12091 can use the <option>sg</option> expansion item to change this if you need to. If you want to
12092 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
12096 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
12097 looks up the host name if has not already done so. (See section
12098 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
12101 Historical note: prior to release 4.30, Exim would always attempt to find a
12102 host name before running the query, unless the search type was preceded by
12103 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
12104 still recognized for query-style lookups, but its presence or absence has no
12105 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
12106 See section <xref linkend="SECThoslispatsikey"/>.)
12109 <section id="SECTmixwilhos">
12110 <title>Mixing wildcarded host names and addresses in host lists</title>
12112 <indexterm role="concept">
12113 <primary>host list</primary>
12114 <secondary>mixing names and addresses in</secondary>
12116 If you have name lookups or wildcarded host names and IP addresses in the same
12117 host list, you should normally put the IP addresses first. For example, in an
12118 ACL you could have:
12120 <literallayout class="monospaced">
12121 accept hosts = 10.9.8.7 : *.friend.example
12124 The reason for this lies in the left-to-right way that Exim processes lists.
12125 It can test IP addresses without doing any DNS lookups, but when it reaches an
12126 item that requires a host name, it fails if it cannot find a host name to
12127 compare with the pattern. If the above list is given in the opposite order, the
12128 <option>accept</option> statement fails for a host whose name cannot be found, even if its
12129 IP address is 10.9.8.7.
12132 If you really do want to do the name check first, and still recognize the IP
12133 address, you can rewrite the ACL like this:
12135 <literallayout class="monospaced">
12136 accept hosts = *.friend.example
12137 accept hosts = 10.9.8.7
12140 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
12141 <xref linkend="CHAPACL"/> for details of ACLs.
12144 <section id="SECTaddresslist">
12145 <title>Address lists</title>
12147 <indexterm role="concept">
12148 <primary>list</primary>
12149 <secondary>address list</secondary>
12151 <indexterm role="concept">
12152 <primary>address list</primary>
12153 <secondary>empty item</secondary>
12155 <indexterm role="concept">
12156 <primary>address list</primary>
12157 <secondary>patterns</secondary>
12159 Address lists contain patterns that are matched against mail addresses. There
12160 is one special case to be considered: the sender address of a bounce message is
12161 always empty. You can test for this by providing an empty item in an address
12162 list. For example, you can set up a router to process bounce messages by
12163 using this option setting:
12165 <literallayout class="monospaced">
12169 The presence of the colon creates an empty item. If you do not provide any
12170 data, the list is empty and matches nothing. The empty sender can also be
12171 detected by a regular expression that matches an empty string,
12172 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
12175 Non-empty items in an address list can be straightforward email addresses. For
12178 <literallayout class="monospaced">
12179 senders = jbc@askone.example : hs@anacreon.example
12182 A certain amount of wildcarding is permitted. If a pattern contains an @
12183 character, but is not a regular expression and does not begin with a
12184 semicolon-terminated lookup type (described below), the local part of the
12185 subject address is compared with the local part of the pattern, which may start
12186 with an asterisk. If the local parts match, the domain is checked in exactly
12187 the same way as for a pattern in a domain list. For example, the domain can be
12188 wildcarded, refer to a named list, or be a lookup:
12190 <literallayout class="monospaced">
12191 deny senders = *@*.spamming.site:\
12192 *@+hostile_domains:\
12193 bozo@partial-lsearch;/list/of/dodgy/sites:\
12194 *@dbm;/bad/domains.db
12197 <indexterm role="concept">
12198 <primary>local part</primary>
12199 <secondary>starting with !</secondary>
12201 <indexterm role="concept">
12202 <primary>address list</primary>
12203 <secondary>local part starting with !</secondary>
12205 If a local part that begins with an exclamation mark is required, it has to be
12206 specified using a regular expression, because otherwise the exclamation mark is
12207 treated as a sign of negation, as is standard in lists.
12210 If a non-empty pattern that is not a regular expression or a lookup does not
12211 contain an @ character, it is matched against the domain part of the subject
12212 address. The only two formats that are recognized this way are a literal
12213 domain, or a domain pattern that starts with *. In both these cases, the effect
12214 is the same as if <literal>*@</literal> preceded the pattern. For example:
12216 <literallayout class="monospaced">
12217 deny senders = enemy.domain : *.enemy.domain
12220 The following kinds of more complicated address list pattern can match any
12221 address, including the empty address that is characteristic of bounce message
12227 <indexterm role="concept">
12228 <primary>regular expressions</primary>
12229 <secondary>in address list</secondary>
12231 <indexterm role="concept">
12232 <primary>address list</primary>
12233 <secondary>regular expression in</secondary>
12235 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
12236 done against the complete address, with the pattern as the regular expression.
12237 You must take care that backslash and dollar characters are not misinterpreted
12238 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
12239 to mark that part of the string as non-expandable. For example:
12241 <literallayout class="monospaced">
12242 deny senders = \N^.*this.*@example\.com$\N : \
12243 \N^\d{8}.+@spamhaus.example$\N : ...
12246 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
12247 start with <quote>^</quote> by the time they are being interpreted as address patterns.
12252 <indexterm role="concept">
12253 <primary>address list</primary>
12254 <secondary>lookup for complete address</secondary>
12256 Complete addresses can be looked up by using a pattern that starts with a
12257 lookup type terminated by a semicolon, followed by the data for the lookup. For
12260 <literallayout class="monospaced">
12261 deny senders = cdb;/etc/blocked.senders : \
12262 mysql;select address from blocked where \
12263 address='${quote_mysql:$sender_address}'
12266 Both query-style and single-key lookup types can be used. For a single-key
12267 lookup type, Exim uses the complete address as the key. However, empty keys are
12268 not supported for single-key lookups, so a match against the empty address
12269 always fails. This restriction does not apply to query-style lookups.
12272 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
12273 cannot be used, and is ignored if specified, with an entry being written to the
12275 <indexterm role="concept">
12276 <primary>*@ with single-key lookup</primary>
12278 However, you can configure lookup defaults, as described in section
12279 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
12280 default. For example, with this lookup:
12282 <literallayout class="monospaced">
12283 accept senders = lsearch*@;/some/file
12286 the file could contains lines like this:
12288 <literallayout class="monospaced">
12289 user1@domain1.example
12293 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
12296 <literallayout class="monospaced">
12297 nimrod@jaeger.example
12302 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
12303 would mean that every address matches, thus rendering the test useless.
12306 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
12308 <literallayout class="monospaced">
12309 deny recipients = dbm*@;/some/file
12310 deny recipients = *@dbm;/some/file
12313 The first does a whole address lookup, with defaulting, as just described,
12314 because it starts with a lookup type. The second matches the local part and
12315 domain independently, as described in a bullet point below.
12320 The following kinds of address list pattern can match only non-empty addresses.
12321 If the subject address is empty, a match against any of these pattern types
12327 <indexterm role="concept">
12328 <primary>@@ with single-key lookup</primary>
12330 <indexterm role="concept">
12331 <primary>address list</primary>
12332 <secondary>@@ lookup type</secondary>
12334 <indexterm role="concept">
12335 <primary>address list</primary>
12336 <secondary>split local part and domain</secondary>
12338 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
12339 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
12340 split into a local part and a domain. The domain is looked up in the file. If
12341 it is not found, there is no match. If it is found, the data that is looked up
12342 from the file is treated as a colon-separated list of local part patterns, each
12343 of which is matched against the subject local part in turn.
12346 <indexterm role="concept">
12347 <primary>asterisk</primary>
12348 <secondary>in address list</secondary>
12350 The lookup may be a partial one, and/or one involving a search for a default
12351 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
12352 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
12353 even be further lookups. They may also be independently negated. For example,
12356 <literallayout class="monospaced">
12357 deny senders = @@dbm;/etc/reject-by-domain
12360 the data from which the DBM file is built could contain lines like
12362 <literallayout class="monospaced">
12363 baddomain.com: !postmaster : *
12366 to reject all senders except <option>postmaster</option> from that domain.
12369 <indexterm role="concept">
12370 <primary>local part</primary>
12371 <secondary>starting with !</secondary>
12373 If a local part that actually begins with an exclamation mark is required, it
12374 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
12375 may be split over several lines by indenting the second and subsequent lines,
12376 but the separating colon must still be included at line breaks. White space
12377 surrounding the colons is ignored. For example:
12379 <literallayout class="monospaced">
12380 aol.com: spammer1 : spammer2 : ^[0-9]+$ :
12381 spammer3 : spammer4
12384 As in all colon-separated lists in Exim, a colon can be included in an item by
12388 If the last item in the list starts with a right angle-bracket, the remainder
12389 of the item is taken as a new key to look up in order to obtain a continuation
12390 list of local parts. The new key can be any sequence of characters. Thus one
12391 might have entries like
12393 <literallayout class="monospaced">
12394 aol.com: spammer1 : spammer 2 : >*
12395 xyz.com: spammer3 : >*
12399 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
12400 local parts for all domains, in addition to the specific local parts listed for
12401 each domain. Of course, using this feature costs another lookup each time a
12402 chain is followed, but the effort needed to maintain the data is reduced.
12405 <indexterm role="concept">
12406 <primary>loop</primary>
12407 <secondary>in lookups</secondary>
12409 It is possible to construct loops using this facility, and in order to catch
12410 them, the chains may be no more than fifty items long.
12415 The @@<<emphasis>lookup</emphasis>> style of item can also be used with a query-style
12416 lookup, but in this case, the chaining facility is not available. The lookup
12417 can only return a single list of local parts.
12422 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
12423 in these two examples:
12425 <literallayout class="monospaced">
12427 senders = *@+my_list
12430 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
12431 example it is a named domain list.
12434 <section id="SECTcasletadd">
12435 <title>Case of letters in address lists</title>
12437 <indexterm role="concept">
12438 <primary>case of local parts</primary>
12440 <indexterm role="concept">
12441 <primary>address list</primary>
12442 <secondary>case forcing</secondary>
12444 <indexterm role="concept">
12445 <primary>case forcing in address lists</primary>
12447 Domains in email addresses are always handled caselessly, but for local parts
12448 case may be significant on some systems (see <option>caseful_local_part</option> for how
12449 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
12450 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
12451 blocking lists should be done in a case-independent manner. Since most address
12452 lists in Exim are used for this kind of control, Exim attempts to do this by
12456 The domain portion of an address is always lowercased before matching it to an
12457 address list. The local part is lowercased by default, and any string
12458 comparisons that take place are done caselessly. This means that the data in
12459 the address list itself, in files included as plain file names, and in any file
12460 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
12461 keys in files that are looked up by a search type other than <command>lsearch</command> (which
12462 works caselessly) must be in lower case, because these lookups are not
12466 <indexterm role="concept">
12467 <primary><literal>+caseful</literal></primary>
12469 To allow for the possibility of caseful address list matching, if an item in
12470 an address list is the string <quote>+caseful</quote>, the original case of the local
12471 part is restored for any comparisons that follow, and string comparisons are no
12472 longer case-independent. This does not affect the domain, which remains in
12473 lower case. However, although independent matches on the domain alone are still
12474 performed caselessly, regular expressions that match against an entire address
12475 become case-sensitive after <quote>+caseful</quote> has been seen.
12478 <section id="SECTlocparlis">
12479 <title>Local part lists</title>
12481 <indexterm role="concept">
12482 <primary>list</primary>
12483 <secondary>local part list</secondary>
12485 <indexterm role="concept">
12486 <primary>local part</primary>
12487 <secondary>list</secondary>
12489 Case-sensitivity in local part lists is handled in the same way as for address
12490 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
12491 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
12492 set false, the subject is lowercased and the matching is initially
12493 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
12494 matching in the local part list, but not elsewhere in the router. If
12495 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
12496 option is case-sensitive from the start.
12499 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
12500 comments are handled in the same way as address lists – they are recognized
12501 only if the # is preceded by white space or the start of the line.
12502 Otherwise, local part lists are matched in the same way as domain lists, except
12503 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
12504 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
12505 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
12507 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
12512 <chapter id="CHAPexpand">
12513 <title>String expansions</title>
12515 <indexterm role="concept" id="IIDstrexp" class="startofrange">
12516 <primary>expansion</primary>
12517 <secondary>of strings</secondary>
12519 Many strings in Exim’s run time configuration are expanded before use. Some of
12520 them are expanded every time they are used; others are expanded only once.
12523 When a string is being expanded it is copied verbatim from left to right except
12524 when a dollar or backslash character is encountered. A dollar specifies the
12525 start of a portion of the string that is interpreted and replaced as described
12526 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
12527 escape character, as described in the following section.
12529 <section id="SECTlittext">
12530 <title>Literal text in expanded strings</title>
12532 <indexterm role="concept">
12533 <primary>expansion</primary>
12534 <secondary>including literal text</secondary>
12536 An uninterpreted dollar can be included in an expanded string by putting a
12537 backslash in front of it. A backslash can be used to prevent any special
12538 character being treated specially in an expansion, including backslash itself.
12539 If the string appears in quotes in the configuration file, two backslashes are
12540 required because the quotes themselves cause interpretation of backslashes when
12541 the string is read in (see section <xref linkend="SECTstrings"/>).
12544 <indexterm role="concept">
12545 <primary>expansion</primary>
12546 <secondary>non-expandable substrings</secondary>
12548 A portion of the string can specified as non-expandable by placing it between
12549 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
12550 expressions, which often contain backslashes and dollar signs. For example:
12552 <literallayout class="monospaced">
12553 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
12556 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
12557 without interpretation until it reaches the next <literal>\N</literal> or the end of the
12561 <section id="SECID82">
12562 <title>Character escape sequences in expanded strings</title>
12564 <indexterm role="concept">
12565 <primary>expansion</primary>
12566 <secondary>escape sequences</secondary>
12568 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
12569 expanded string is recognized as an escape sequence for the character newline,
12570 carriage return, or tab, respectively. A backslash followed by up to three
12571 octal digits is recognized as an octal encoding for a single character, and a
12572 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
12576 These escape sequences are also recognized in quoted strings when they are read
12577 in. Their interpretation in expansions as well is useful for unquoted strings,
12578 and for other cases such as looked-up strings that are then expanded.
12581 <section id="SECID83">
12582 <title>Testing string expansions</title>
12584 <indexterm role="concept">
12585 <primary>expansion</primary>
12586 <secondary>testing</secondary>
12588 <indexterm role="concept">
12589 <primary>testing</primary>
12590 <secondary>string expansion</secondary>
12592 <indexterm role="option">
12593 <primary><option>-be</option></primary>
12595 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
12596 takes the command arguments, or lines from the standard input if there are no
12597 arguments, runs them through the string expansion code, and writes the results
12598 to the standard output. Variables based on configuration values are set up, but
12599 since no message is being processed, variables such as <varname>$local_part</varname> have no
12600 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
12601 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
12602 and <option>nhash</option>.
12605 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
12606 instead runs under the uid and gid it was called with, to prevent users from
12607 using <option>-be</option> for reading files to which they do not have access.
12610 <indexterm role="option">
12611 <primary><option>-bem</option></primary>
12613 If you want to test expansions that include variables whose values are taken
12614 from a message, there are two other options that can be used. The <option>-bem</option>
12615 option is like <option>-be</option> except that it is followed by a file name. The file is
12616 read as a message before doing the test expansions. For example:
12618 <literallayout class="monospaced">
12619 exim -bem /tmp/test.message '$h_subject:'
12622 The <option>-Mset</option> option is used in conjunction with <option>-be</option> and is followed by an
12623 Exim message identifier. For example:
12625 <literallayout class="monospaced">
12626 exim -be -Mset 1GrA8W-0004WS-LQ '$recipients'
12629 This loads the message from Exim’s spool before doing the test expansions, and
12630 is therefore restricted to admin users.
12633 <section id="SECTforexpfai">
12634 <title>Forced expansion failure</title>
12636 <indexterm role="concept">
12637 <primary>expansion</primary>
12638 <secondary>forced failure</secondary>
12640 A number of expansions that are described in the following section have
12641 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
12642 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
12643 used depends on some condition that is evaluated as part of the expansion. If,
12644 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
12645 the entire string expansion fails in a way that can be detected by the code
12646 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
12647 its consequences depend on the circumstances. In some cases it is no different
12648 from any other expansion failure, but in others a different action may be
12649 taken. Such variations are mentioned in the documentation of the option that is
12653 <section id="SECTexpansionitems">
12654 <title>Expansion items</title>
12656 The following items are recognized in expanded strings. White space may be used
12657 between sub-items that are keywords or substrings enclosed in braces inside an
12658 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
12659 white space is significant.
12663 <term><emphasis role="bold">$</emphasis><<emphasis>variable name</emphasis>> or <emphasis role="bold">${</emphasis><<emphasis>variable name</emphasis>><emphasis role="bold">}</emphasis></term>
12666 <indexterm role="concept">
12667 <primary>expansion</primary>
12668 <secondary>variables</secondary>
12670 Substitute the contents of the named variable, for example:
12672 <literallayout class="monospaced">
12677 The second form can be used to separate the name from subsequent alphanumeric
12678 characters. This form (using braces) is available only for variables; it does
12679 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
12680 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
12681 given, the expansion fails.
12683 </listitem></varlistentry>
12685 <term><emphasis role="bold">${</emphasis><<emphasis>op</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
12688 <indexterm role="concept">
12689 <primary>expansion</primary>
12690 <secondary>operators</secondary>
12692 The string is first itself expanded, and then the operation specified by
12693 <<emphasis>op</emphasis>> is applied to it. For example:
12695 <literallayout class="monospaced">
12699 The string starts with the first character after the colon, which may be
12700 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
12701 below. The operator notation is used for simple expansion items that have just
12702 one argument, because it reduces the number of braces and therefore makes the
12703 string easier to understand.
12705 </listitem></varlistentry>
12707 <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>
12710 This item inserts <quote>basic</quote> header lines. It is described with the <option>header</option>
12711 expansion item below.
12713 </listitem></varlistentry>
12715 <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>
12718 <indexterm role="concept">
12719 <primary><option>dlfunc</option></primary>
12721 This expansion dynamically loads and then calls a locally-written C function.
12722 This functionality is available only if Exim is compiled with
12724 <literallayout class="monospaced">
12728 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
12729 object so that it doesn’t reload the same object file in the same Exim process
12730 (but of course Exim does start new processes frequently).
12733 There may be from zero to eight arguments to the function. When compiling
12734 a local function that is to be called in this way, <filename>local_scan.h</filename> should be
12735 included. The Exim variables and functions that are defined by that API
12736 are also available for dynamically loaded functions. The function itself
12737 must have the following type:
12739 <literallayout class="monospaced">
12740 int dlfunction(uschar **yield, int argc, uschar *argv[])
12743 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
12744 function should return one of the following values:
12747 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
12748 into the expanded string that is being built.
12751 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
12752 from <emphasis>yield</emphasis>, if it is set.
12755 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
12756 taken from <emphasis>yield</emphasis> if it is set.
12759 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
12762 When compiling a function that is to be used in this way with gcc,
12763 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
12764 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
12766 </listitem></varlistentry>
12768 <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>
12771 <indexterm role="concept">
12772 <primary>expansion</primary>
12773 <secondary>extracting substrings by key</secondary>
12775 <indexterm role="concept">
12776 <primary><option>extract</option></primary>
12777 <secondary>substrings by key</secondary>
12779 The key and <<emphasis>string1</emphasis>> are first expanded separately. Leading and trailing
12780 white space is removed from the key (but not from any of the strings). The key
12781 must not consist entirely of digits. The expanded <<emphasis>string1</emphasis>> must be of the
12785 <<emphasis>key1</emphasis>> = <<emphasis>value1</emphasis>> <<emphasis>key2</emphasis>> = <<emphasis>value2</emphasis>> ...
12788 <indexterm role="variable">
12789 <primary><varname>$value</varname></primary>
12791 where the equals signs and spaces (but not both) are optional. If any of the
12792 values contain white space, they must be enclosed in double quotes, and any
12793 values that are enclosed in double quotes are subject to escape processing as
12794 described in section <xref linkend="SECTstrings"/>. The expanded <<emphasis>string1</emphasis>> is searched
12795 for the value that corresponds to the key. The search is case-insensitive. If
12796 the key is found, <<emphasis>string2</emphasis>> is expanded, and replaces the whole item;
12797 otherwise <<emphasis>string3</emphasis>> is used. During the expansion of <<emphasis>string2</emphasis>> the
12798 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
12799 is restored to any previous value it might have had.
12802 If {<<emphasis>string3</emphasis>>} is omitted, the item is replaced by an empty string if the
12803 key is not found. If {<<emphasis>string2</emphasis>>} is also omitted, the value that was
12804 extracted is used. Thus, for example, these two expansions are identical, and
12805 yield <quote>2001</quote>:
12807 <literallayout class="monospaced">
12808 ${extract{gid}{uid=1984 gid=2001}}
12809 ${extract{gid}{uid=1984 gid=2001}{$value}}
12812 Instead of {<<emphasis>string3</emphasis>>} the word <quote>fail</quote> (not in curly brackets) can
12813 appear, for example:
12815 <literallayout class="monospaced">
12816 ${extract{Z}{A=... B=...}{$value} fail }
12819 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
12820 {<<emphasis>string2</emphasis>>} must be present for <quote>fail</quote> to be recognized.
12822 </listitem></varlistentry>
12824 <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>
12827 <indexterm role="concept">
12828 <primary>expansion</primary>
12829 <secondary>extracting substrings by number</secondary>
12831 <indexterm role="concept">
12832 <primary><option>extract</option></primary>
12833 <secondary>substrings by number</secondary>
12835 The <<emphasis>number</emphasis>> argument must consist entirely of decimal digits,
12836 apart from leading and trailing white space, which is ignored.
12837 This is what distinguishes this form of <option>extract</option> from the previous kind. It
12838 behaves in the same way, except that, instead of extracting a named field, it
12839 extracts from <<emphasis>string1</emphasis>> the field whose number is given as the first
12840 argument. You can use <varname>$value</varname> in <<emphasis>string2</emphasis>> or <literal>fail</literal> instead of
12841 <<emphasis>string3</emphasis>> as before.
12844 The fields in the string are separated by any one of the characters in the
12845 separator string. These may include space or tab characters.
12846 The first field is numbered one. If the number is negative, the fields are
12847 counted from the end of the string, with the rightmost one numbered -1. If the
12848 number given is zero, the entire string is returned. If the modulus of the
12849 number is greater than the number of fields in the string, the result is the
12850 expansion of <<emphasis>string3</emphasis>>, or the empty string if <<emphasis>string3</emphasis>> is not
12851 provided. For example:
12853 <literallayout class="monospaced">
12854 ${extract{2}{:}{x:42:99:& Mailer::/bin/bash}}
12857 yields <quote>42</quote>, and
12859 <literallayout class="monospaced">
12860 ${extract{-4}{:}{x:42:99:& Mailer::/bin/bash}}
12863 yields <quote>99</quote>. Two successive separators mean that the field between them is
12864 empty (for example, the fifth field above).
12866 </listitem></varlistentry>
12868 <term><emphasis role="bold">${filter{</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>condition</emphasis>><emphasis role="bold">}}</emphasis></term>
12871 <indexterm role="concept">
12872 <primary>list</primary>
12873 <secondary>selecting by condition</secondary>
12875 <indexterm role="concept">
12876 <primary>expansion</primary>
12877 <secondary>selecting from list by condition</secondary>
12879 <indexterm role="variable">
12880 <primary><varname>$item</varname></primary>
12882 After expansion, <<emphasis>string</emphasis>> is interpreted as a list, colon-separated by
12883 default, but the separator can be changed in the usual way. For each item
12884 in this list, its value is place in <varname>$item</varname>, and then the condition is
12885 evaluated. If the condition is true, <varname>$item</varname> is added to the output as an
12886 item in a new list; if the condition is false, the item is discarded. The
12887 separator used for the output list is the same as the one used for the
12888 input, but a separator setting is not included in the output. For example:
12890 <literallayout class="monospaced">
12891 ${filter{a:b:c}{!eq{$item}{b}}
12894 yields <literal>a:c</literal>. At the end of the expansion, the value of <varname>$item</varname> is restored
12895 to what it was before. See also the <emphasis role="bold">map</emphasis> and <emphasis role="bold">reduce</emphasis> expansion items.
12897 </listitem></varlistentry>
12899 <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>
12902 <indexterm role="concept">
12903 <primary>hash function</primary>
12904 <secondary>textual</secondary>
12906 <indexterm role="concept">
12907 <primary>expansion</primary>
12908 <secondary>textual hash</secondary>
12910 This is a textual hashing function, and was the first to be implemented in
12911 early versions of Exim. In current releases, there are other hashing functions
12912 (numeric, MD5, and SHA-1), which are described below.
12915 The first two strings, after expansion, must be numbers. Call them <<emphasis>m</emphasis>> and
12916 <<emphasis>n</emphasis>>. If you are using fixed values for these numbers, that is, if
12917 <<emphasis>string1</emphasis>> and <<emphasis>string2</emphasis>> do not change when they are expanded, you can
12918 use the simpler operator notation that avoids some of the braces:
12920 <literallayout class="monospaced">
12921 ${hash_<n>_<m>:<string>}
12924 The second number is optional (in both notations). If <<emphasis>n</emphasis>> is greater than
12925 or equal to the length of the string, the expansion item returns the string.
12926 Otherwise it computes a new string of length <<emphasis>n</emphasis>> by applying a hashing
12927 function to the string. The new string consists of characters taken from the
12928 first <<emphasis>m</emphasis>> characters of the string
12930 <literallayout class="monospaced">
12931 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
12934 If <<emphasis>m</emphasis>> is not present the value 26 is used, so that only lower case
12935 letters appear. For example:
12938 <literal>$hash{3}{monty}} </literal> yields <literal>jmg</literal>
12939 <literal>$hash{5}{monty}} </literal> yields <literal>monty</literal>
12940 <literal>$hash{4}{62}{monty python}}</literal> yields <literal>fbWx</literal>
12942 </listitem></varlistentry>
12944 <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>
12945 <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>
12946 <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>
12949 <indexterm role="concept">
12950 <primary>expansion</primary>
12951 <secondary>header insertion</secondary>
12953 <indexterm role="variable">
12954 <primary><varname>$header_</varname></primary>
12956 <indexterm role="variable">
12957 <primary><varname>$bheader_</varname></primary>
12959 <indexterm role="variable">
12960 <primary><varname>$rheader_</varname></primary>
12962 <indexterm role="concept">
12963 <primary>header lines</primary>
12964 <secondary>in expansion strings</secondary>
12966 <indexterm role="concept">
12967 <primary>header lines</primary>
12968 <secondary>character sets</secondary>
12970 <indexterm role="concept">
12971 <primary>header lines</primary>
12972 <secondary>decoding</secondary>
12974 Substitute the contents of the named message header line, for example
12976 <literallayout class="monospaced">
12980 The newline that terminates a header line is not included in the expansion, but
12981 internal newlines (caused by splitting the header line over several physical
12982 lines) may be present.
12985 The difference between <option>rheader</option>, <option>bheader</option>, and <option>header</option> is in the way
12986 the data in the header line is interpreted.
12991 <indexterm role="concept">
12992 <primary>white space</primary>
12993 <secondary>in header lines</secondary>
12995 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
12996 processing at all, and without the removal of leading and trailing white space.
13001 <indexterm role="concept">
13002 <primary>base64 encoding</primary>
13003 <secondary>in header lines</secondary>
13005 <option>bheader</option> removes leading and trailing white space, and then decodes base64
13006 or quoted-printable MIME <quote>words</quote> within the header text, but does no
13007 character set translation. If decoding of what looks superficially like a MIME
13008 <quote>word</quote> fails, the raw string is returned. If decoding
13009 <indexterm role="concept">
13010 <primary>binary zero</primary>
13011 <secondary>in header line</secondary>
13013 produces a binary zero character, it is replaced by a question mark – this is
13014 what Exim does for binary zeros that are actually received in header lines.
13019 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
13020 standard character set. This is an attempt to produce the same string as would
13021 be displayed on a user’s MUA. If translation fails, the <option>bheader</option> string is
13022 returned. Translation is attempted only on operating systems that support the
13023 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
13024 a system Makefile or in <filename>Local/Makefile</filename>.
13029 In a filter file, the target character set for <option>header</option> can be specified by a
13030 command of the following form:
13032 <literallayout class="monospaced">
13033 headers charset "UTF-8"
13036 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
13037 subsequently obeyed filter commands. In the absence of this command, the target
13038 character set in a filter is taken from the setting of the <option>headers_charset</option>
13039 option in the runtime configuration. The value of this option defaults to the
13040 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
13044 Header names follow the syntax of RFC 2822, which states that they may contain
13045 any printing characters except space and colon. Consequently, curly brackets
13046 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
13047 if they were variables. Attempting to do so causes a syntax error.
13050 Only header lines that are common to all copies of a message are visible to
13051 this mechanism. These are the original header lines that are received with the
13052 message, and any that are added by an ACL statement or by a system
13053 filter. Header lines that are added to a particular copy of a message by a
13054 router or transport are not accessible.
13057 For incoming SMTP messages, no header lines are visible in ACLs that are obeyed
13058 before the DATA ACL, because the header structure is not set up until the
13059 message is received. Header lines that are added in a RCPT ACL (for example)
13060 are saved until the message’s incoming header lines are available, at which
13061 point they are added. When a DATA ACL is running, however, header lines added
13062 by earlier ACLs are visible.
13065 Upper case and lower case letters are synonymous in header names. If the
13066 following character is white space, the terminating colon may be omitted, but
13067 this is not recommended, because you may then forget it when it is needed. When
13068 white space terminates the header name, it is included in the expanded string.
13069 If the message does not contain the given header, the expansion item is
13070 replaced by an empty string. (See the <option>def</option> condition in section
13071 <xref linkend="SECTexpcond"/> for a means of testing for the existence of a header.)
13074 If there is more than one header with the same name, they are all concatenated
13075 to form the substitution string, up to a maximum length of 64K. Unless
13076 <option>rheader</option> is being used, leading and trailing white space is removed from
13077 each header before concatenation, and a completely empty header is ignored. A
13078 newline character is then inserted between non-empty headers, but there is no
13079 newline at the very end. For the <option>header</option> and <option>bheader</option> expansion, for
13080 those headers that contain lists of addresses, a comma is also inserted at the
13081 junctions between headers. This does not happen for the <option>rheader</option> expansion.
13083 </listitem></varlistentry>
13085 <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>
13088 <indexterm role="concept">
13089 <primary>expansion</primary>
13090 <secondary>hmac hashing</secondary>
13092 <indexterm role="concept">
13093 <primary><option>hmac</option></primary>
13095 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
13096 shared secret and some text into a message authentication code, as specified in
13097 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
13098 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
13099 cryptographic hash, allowing for authentication that is not possible with MD5
13100 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
13101 present. For example:
13103 <literallayout class="monospaced">
13104 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
13107 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
13110 <literallayout class="monospaced">
13111 dd97e3ba5d1a61b5006108f8c8252953
13114 As an example of how this might be used, you might put in the main part of
13115 an Exim configuration:
13117 <literallayout class="monospaced">
13118 SPAMSCAN_SECRET=cohgheeLei2thahw
13121 In a router or a transport you could then have:
13123 <literallayout class="monospaced">
13125 X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
13126 ${hmac{md5}{SPAMSCAN_SECRET}\
13127 {${primary_hostname},${message_exim_id},$h_message-id:}}
13130 Then given a message, you can check where it was scanned by looking at the
13131 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
13132 this header line is authentic by recomputing the authentication code from the
13133 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
13134 using Exim’s <option>-be</option> option, or by other means, for example by using the
13135 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
13137 </listitem></varlistentry>
13139 <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>
13142 <indexterm role="concept">
13143 <primary>expansion</primary>
13144 <secondary>conditional</secondary>
13146 <indexterm role="concept">
13147 <primary><option>if</option>, expansion item</primary>
13149 If <<emphasis>condition</emphasis>> is true, <<emphasis>string1</emphasis>> is expanded and replaces the whole
13150 item; otherwise <<emphasis>string2</emphasis>> is used. The available conditions are described
13151 in section <xref linkend="SECTexpcond"/> below. For example:
13153 <literallayout class="monospaced">
13154 ${if eq {$local_part}{postmaster} {yes}{no} }
13157 The second string need not be present; if it is not and the condition is not
13158 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
13159 be present instead of the second string (without any curly brackets). In this
13160 case, the expansion is forced to fail if the condition is not true (see section
13161 <xref linkend="SECTforexpfai"/>).
13164 If both strings are omitted, the result is the string <literal>true</literal> if the condition
13165 is true, and the empty string if the condition is false. This makes it less
13166 cumbersome to write custom ACL and router conditions. For example, instead of
13168 <literallayout class="monospaced">
13169 condition = ${if >{$acl_m4}{3}{true}{false}}
13174 <literallayout class="monospaced">
13175 condition = ${if >{$acl_m4}{3}}
13177 </listitem></varlistentry>
13179 <term><emphasis role="bold">${length{</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}}</emphasis></term>
13182 <indexterm role="concept">
13183 <primary>expansion</primary>
13184 <secondary>string truncation</secondary>
13186 <indexterm role="concept">
13187 <primary><option>length</option> expansion item</primary>
13189 The <option>length</option> item is used to extract the initial portion of a string. Both
13190 strings are expanded, and the first one must yield a number, <<emphasis>n</emphasis>>, say. If
13191 you are using a fixed value for the number, that is, if <<emphasis>string1</emphasis>> does not
13192 change when expanded, you can use the simpler operator notation that avoids
13193 some of the braces:
13195 <literallayout class="monospaced">
13196 ${length_<n>:<string>}
13199 The result of this item is either the first <<emphasis>n</emphasis>> characters or the whole
13200 of <<emphasis>string2</emphasis>>, whichever is the shorter. Do not confuse <option>length</option> with
13201 <option>strlen</option>, which gives the length of a string.
13203 </listitem></varlistentry>
13205 <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>
13208 This is the first of one of two different types of lookup item, which are both
13209 described in the next item.
13211 </listitem></varlistentry>
13213 <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>
13216 <indexterm role="concept">
13217 <primary>expansion</primary>
13218 <secondary>lookup in</secondary>
13220 <indexterm role="concept">
13221 <primary>file</primary>
13222 <secondary>lookups</secondary>
13224 <indexterm role="concept">
13225 <primary>lookup</primary>
13226 <secondary>in expanded string</secondary>
13228 The two forms of lookup item specify data lookups in files and databases, as
13229 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
13230 lookups, and the second is used for query-style lookups. The <<emphasis>key</emphasis>>,
13231 <<emphasis>file</emphasis>>, and <<emphasis>query</emphasis>> strings are expanded before use.
13234 If there is any white space in a lookup item which is part of a filter command,
13235 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
13236 other place where white space is significant, the lookup item must be enclosed
13237 in double quotes. The use of data lookups in users’ filter files may be locked
13238 out by the system administrator.
13241 <indexterm role="variable">
13242 <primary><varname>$value</varname></primary>
13244 If the lookup succeeds, <<emphasis>string1</emphasis>> is expanded and replaces the entire item.
13245 During its expansion, the variable <varname>$value</varname> contains the data returned by the
13246 lookup. Afterwards it reverts to the value it had previously (at the outer
13247 level it is empty). If the lookup fails, <<emphasis>string2</emphasis>> is expanded and replaces
13248 the entire item. If {<<emphasis>string2</emphasis>>} is omitted, the replacement is the empty
13249 string on failure. If <<emphasis>string2</emphasis>> is provided, it can itself be a nested
13250 lookup, thus providing a mechanism for looking up a default value when the
13251 original lookup fails.
13254 If a nested lookup is used as part of <<emphasis>string1</emphasis>>, <varname>$value</varname> contains the
13255 data for the outer lookup while the parameters of the second lookup are
13256 expanded, and also while <<emphasis>string2</emphasis>> of the second lookup is expanded, should
13257 the second lookup fail. Instead of {<<emphasis>string2</emphasis>>} the word <quote>fail</quote> can
13258 appear, and in this case, if the lookup fails, the entire expansion is forced
13259 to fail (see section <xref linkend="SECTforexpfai"/>). If both {<<emphasis>string1</emphasis>>} and
13260 {<<emphasis>string2</emphasis>>} are omitted, the result is the looked up value in the case of a
13261 successful lookup, and nothing in the case of failure.
13264 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
13265 search type in order to do partial matching, and * or *@ may follow a search
13266 type to request default lookups if the key does not match (see sections
13267 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
13270 <indexterm role="concept">
13271 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
13272 <secondary>in lookup expansion</secondary>
13274 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
13275 and non-wild parts of the key during the expansion of the replacement text.
13276 They return to their previous values at the end of the lookup item.
13279 This example looks up the postmaster alias in the conventional alias file:
13281 <literallayout class="monospaced">
13282 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
13285 This example uses NIS+ to look up the full name of the user corresponding to
13286 the local part of an address, forcing the expansion to fail if it is not found:
13288 <literallayout class="monospaced">
13289 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
13292 </listitem></varlistentry>
13294 <term><emphasis role="bold">${map{</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}}</emphasis></term>
13297 <indexterm role="concept">
13298 <primary>expansion</primary>
13299 <secondary>list creation</secondary>
13301 <indexterm role="variable">
13302 <primary><varname>$item</varname></primary>
13304 After expansion, <<emphasis>string1</emphasis>> is interpreted as a list, colon-separated by
13305 default, but the separator can be changed in the usual way. For each item
13306 in this list, its value is place in <varname>$item</varname>, and then <<emphasis>string2</emphasis>> is
13307 expanded and added to the output as an item in a new list. The separator used
13308 for the output list is the same as the one used for the input, but a separator
13309 setting is not included in the output. For example:
13311 <literallayout class="monospaced">
13312 ${map{a:b:c}{[$item]}} ${map{<- x-y-z}{($item)}}
13315 expands to <literal>[a]:[b]:[c] (x)-(y)-(z)</literal>. At the end of the expansion, the
13316 value of <varname>$item</varname> is restored to what it was before. See also the <emphasis role="bold">filter</emphasis>
13317 and <emphasis role="bold">reduce</emphasis> expansion items.
13319 </listitem></varlistentry>
13321 <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>
13324 <indexterm role="concept">
13325 <primary>expansion</primary>
13326 <secondary>numeric hash</secondary>
13328 <indexterm role="concept">
13329 <primary>hash function</primary>
13330 <secondary>numeric</secondary>
13332 The three strings are expanded; the first two must yield numbers. Call them
13333 <<emphasis>n</emphasis>> and <<emphasis>m</emphasis>>. If you are using fixed values for these numbers, that is,
13334 if <<emphasis>string1</emphasis>> and <<emphasis>string2</emphasis>> do not change when they are expanded, you
13335 can use the simpler operator notation that avoids some of the braces:
13337 <literallayout class="monospaced">
13338 ${nhash_<n>_<m>:<string>}
13341 The second number is optional (in both notations). If there is only one number,
13342 the result is a number in the range 0–<<emphasis>n</emphasis>>-1. Otherwise, the string is
13343 processed by a div/mod hash function that returns two numbers, separated by a
13344 slash, in the ranges 0 to <<emphasis>n</emphasis>>-1 and 0 to <<emphasis>m</emphasis>>-1, respectively. For
13347 <literallayout class="monospaced">
13348 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
13351 returns the string <quote>6/33</quote>.
13353 </listitem></varlistentry>
13355 <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>
13358 <indexterm role="concept">
13359 <primary>Perl</primary>
13360 <secondary>use in expanded string</secondary>
13362 <indexterm role="concept">
13363 <primary>expansion</primary>
13364 <secondary>calling Perl from</secondary>
13366 This item is available only if Exim has been built to include an embedded Perl
13367 interpreter. The subroutine name and the arguments are first separately
13368 expanded, and then the Perl subroutine is called with those arguments. No
13369 additional arguments need be given; the maximum number permitted, including the
13370 name of the subroutine, is nine.
13373 The return value of the subroutine is inserted into the expanded string, unless
13374 the return value is <option>undef</option>. In that case, the expansion fails in the same
13375 way as an explicit <quote>fail</quote> on a lookup item. The return value is a scalar.
13376 Whatever you return is evaluated in a scalar context. For example, if you
13377 return the name of a Perl vector, the return value is the size of the vector,
13381 If the subroutine exits by calling Perl’s <option>die</option> function, the expansion fails
13382 with the error message that was passed to <option>die</option>. More details of the embedded
13383 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
13386 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
13387 out the use of this expansion item in filter files.
13389 </listitem></varlistentry>
13391 <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>
13394 <indexterm role="concept">
13395 <primary><option>prvs</option> expansion item</primary>
13397 The first argument is a complete email address and the second is secret
13398 keystring. The third argument, specifying a key number, is optional. If absent,
13399 it defaults to 0. The result of the expansion is a prvs-signed email address,
13400 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
13401 as part of a bounce address tag validation (BATV) scheme. For more discussion
13402 and an example, see section <xref linkend="SECTverifyPRVS"/>.
13404 </listitem></varlistentry>
13406 <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>
13409 <indexterm role="concept">
13410 <primary><option>prvscheck</option> expansion item</primary>
13412 This expansion item is the complement of the <option>prvs</option> item. It is used for
13413 checking prvs-signed addresses. If the expansion of the first argument does not
13414 yield a syntactically valid prvs-signed address, the whole item expands to the
13415 empty string. When the first argument does expand to a syntactically valid
13416 prvs-signed address, the second argument is expanded, with the prvs-decoded
13417 version of the address and the key number extracted from the address in the
13418 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
13421 These two variables can be used in the expansion of the second argument to
13422 retrieve the secret. The validity of the prvs-signed address is then checked
13423 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
13424 which is empty for failure or <quote>1</quote> for success.
13427 The third argument is optional; if it is missing, it defaults to an empty
13428 string. This argument is now expanded. If the result is an empty string, the
13429 result of the expansion is the decoded version of the address. This is the case
13430 whether or not the signature was valid. Otherwise, the result of the expansion
13431 is the expansion of the third argument.
13434 All three variables can be used in the expansion of the third argument.
13435 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
13436 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
13438 </listitem></varlistentry>
13440 <term><emphasis role="bold">${readfile{</emphasis><<emphasis>file name</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>eol string</emphasis>><emphasis role="bold">}}</emphasis></term>
13443 <indexterm role="concept">
13444 <primary>expansion</primary>
13445 <secondary>inserting an entire file</secondary>
13447 <indexterm role="concept">
13448 <primary>file</primary>
13449 <secondary>inserting into expansion</secondary>
13451 <indexterm role="concept">
13452 <primary><option>readfile</option> expansion item</primary>
13454 The file name and end-of-line string are first expanded separately. The file is
13455 then read, and its contents replace the entire item. All newline characters in
13456 the file are replaced by the end-of-line string if it is present. Otherwise,
13457 newlines are left in the string.
13458 String expansion is not applied to the contents of the file. If you want this,
13459 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
13460 the string expansion fails.
13463 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
13464 locks out the use of this expansion item in filter files.
13466 </listitem></varlistentry>
13468 <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>
13471 <indexterm role="concept">
13472 <primary>expansion</primary>
13473 <secondary>inserting from a socket</secondary>
13475 <indexterm role="concept">
13476 <primary>socket, use of in expansion</primary>
13478 <indexterm role="concept">
13479 <primary><option>readsocket</option> expansion item</primary>
13481 This item inserts data from a Unix domain or Internet socket into the expanded
13482 string. The minimal way of using it uses just two arguments, as in these
13485 <literallayout class="monospaced">
13486 ${readsocket{/socket/name}{request string}}
13487 ${readsocket{inet:some.host:1234}{request string}}
13490 For a Unix domain socket, the first substring must be the path to the socket.
13491 For an Internet socket, the first substring must contain <literal>inet:</literal> followed by
13492 a host name or IP address, followed by a colon and a port, which can be a
13493 number or the name of a TCP port in <filename>/etc/services</filename>. An IP address may
13494 optionally be enclosed in square brackets. This is best for IPv6 addresses. For
13497 <literallayout class="monospaced">
13498 ${readsocket{inet:[::1]:1234}{request string}}
13501 Only a single host name may be given, but if looking it up yields more than
13502 one IP address, they are each tried in turn until a connection is made. For
13503 both kinds of socket, Exim makes a connection, writes the request string
13504 (unless it is an empty string) and reads from the socket until an end-of-file
13505 is read. A timeout of 5 seconds is applied. Additional, optional arguments
13506 extend what can be done. Firstly, you can vary the timeout. For example:
13508 <literallayout class="monospaced">
13509 ${readsocket{/socket/name}{request string}{3s}}
13512 A fourth argument allows you to change any newlines that are in the data
13513 that is read, in the same way as for <option>readfile</option> (see above). This example
13514 turns them into spaces:
13516 <literallayout class="monospaced">
13517 ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }}
13520 As with all expansions, the substrings are expanded before the processing
13521 happens. Errors in these sub-expansions cause the expansion to fail. In
13522 addition, the following errors can occur:
13527 Failure to create a socket file descriptor;
13532 Failure to connect the socket;
13537 Failure to write the request string;
13542 Timeout on reading from the socket.
13547 By default, any of these errors causes the expansion to fail. However, if
13548 you supply a fifth substring, it is expanded and used when any of the above
13549 errors occurs. For example:
13551 <literallayout class="monospaced">
13552 ${readsocket{/socket/name}{request string}{3s}{\n}\
13556 You can test for the existence of a Unix domain socket by wrapping this
13557 expansion in <literal>${if exists</literal>, but there is a race condition between that test
13558 and the actual opening of the socket, so it is safer to use the fifth argument
13559 if you want to be absolutely sure of avoiding an expansion error for a
13560 non-existent Unix domain socket, or a failure to connect to an Internet socket.
13563 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
13564 locks out the use of this expansion item in filter files.
13566 </listitem></varlistentry>
13568 <term><emphasis role="bold">${reduce{</emphasis><<emphasis>string1</emphasis>>}{<<emphasis>string2</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string3</emphasis>><emphasis role="bold">}}</emphasis></term>
13571 <indexterm role="concept">
13572 <primary>expansion</primary>
13573 <secondary>reducing a list to a scalar</secondary>
13575 <indexterm role="concept">
13576 <primary>list</primary>
13577 <secondary>reducing to a scalar</secondary>
13579 <indexterm role="variable">
13580 <primary><varname>$value</varname></primary>
13582 <indexterm role="variable">
13583 <primary><varname>$item</varname></primary>
13585 This operation reduces a list to a single, scalar string. After expansion,
13586 <<emphasis>string1</emphasis>> is interpreted as a list, colon-separated by default, but the
13587 separator can be changed in the usual way. Then <<emphasis>string2</emphasis>> is expanded and
13588 assigned to the <varname>$value</varname> variable. After this, each item in the <<emphasis>string1</emphasis>>
13589 list is assigned to <varname>$item</varname> in turn, and <<emphasis>string3</emphasis>> is expanded for each of
13590 them. The result of that expansion is assigned to <varname>$value</varname> before the next
13591 iteration. When the end of the list is reached, the final value of <varname>$value</varname> is
13592 added to the expansion output. The <emphasis role="bold">reduce</emphasis> expansion item can be used in a
13593 number of ways. For example, to add up a list of numbers:
13595 <literallayout class="monospaced">
13596 ${reduce {<, 1,2,3}{0}{${eval:$value+$item}}}
13599 The result of that expansion would be <literal>6</literal>. The maximum of a list of numbers
13602 <literallayout class="monospaced">
13603 ${reduce {3:0:9:4:6}{0}{${if >{$item}{$value}{$item}{$value}}}}
13606 At the end of a <emphasis role="bold">reduce</emphasis> expansion, the values of <varname>$item</varname> and <varname>$value</varname> are
13607 restored to what they were before. See also the <emphasis role="bold">filter</emphasis> and <emphasis role="bold">map</emphasis>
13610 </listitem></varlistentry>
13612 <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>
13615 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
13616 expansion item above.
13618 </listitem></varlistentry>
13620 <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>
13623 <indexterm role="concept">
13624 <primary>expansion</primary>
13625 <secondary>running a command</secondary>
13627 <indexterm role="concept">
13628 <primary><option>run</option> expansion item</primary>
13630 The command and its arguments are first expanded separately, and then the
13631 command is run in a separate process, but under the same uid and gid. As in
13632 other command executions from Exim, a shell is not used by default. If you want
13633 a shell, you must explicitly code it.
13636 The standard input for the command exists, but is empty. The standard output
13637 and standard error are set to the same file descriptor.
13638 <indexterm role="concept">
13639 <primary>return code</primary>
13640 <secondary>from <option>run</option> expansion</secondary>
13642 <indexterm role="variable">
13643 <primary><varname>$value</varname></primary>
13645 If the command succeeds (gives a zero return code) <<emphasis>string1</emphasis>> is expanded
13646 and replaces the entire item; during this expansion, the standard output/error
13647 from the command is in the variable <varname>$value</varname>. If the command fails,
13648 <<emphasis>string2</emphasis>>, if present, is expanded and used. Once again, during the
13649 expansion, the standard output/error from the command is in the variable
13650 <varname>$value</varname>.
13653 If <<emphasis>string2</emphasis>> is absent, the result is empty. Alternatively, <<emphasis>string2</emphasis>>
13654 can be the word <quote>fail</quote> (not in braces) to force expansion failure if the
13655 command does not succeed. If both strings are omitted, the result is contents
13656 of the standard output/error on success, and nothing on failure.
13659 <indexterm role="variable">
13660 <primary><varname>$runrc</varname></primary>
13662 The return code from the command is put in the variable <varname>$runrc</varname>, and this
13663 remains set afterwards, so in a filter file you can do things like this:
13665 <literallayout class="monospaced">
13666 if "${run{x y z}{}}$runrc" is 1 then ...
13667 elif $runrc is 2 then ...
13672 If execution of the command fails (for example, the command does not exist),
13673 the return code is 127 – the same code that shells use for non-existent
13677 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
13678 option values are expanded, except for those preconditions whose order of
13679 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
13680 by the expansion of one option, and use it in another.
13683 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
13684 out the use of this expansion item in filter files.
13686 </listitem></varlistentry>
13688 <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>
13691 <indexterm role="concept">
13692 <primary>expansion</primary>
13693 <secondary>string substitution</secondary>
13695 <indexterm role="concept">
13696 <primary><option>sg</option> expansion item</primary>
13698 This item works like Perl’s substitution operator (s) with the global (/g)
13699 option; hence its name. However, unlike the Perl equivalent, Exim does not
13700 modify the subject string; instead it returns the modified string for insertion
13701 into the overall expansion. The item takes three arguments: the subject string,
13702 a regular expression, and a substitution string. For example:
13704 <literallayout class="monospaced">
13705 ${sg{abcdefabcdef}{abc}{xyz}}
13708 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
13709 if any $ or \ characters are required in the regular expression or in the
13710 substitution string, they have to be escaped. For example:
13712 <literallayout class="monospaced">
13713 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
13716 yields <quote>defabc</quote>, and
13718 <literallayout class="monospaced">
13719 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
13722 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
13723 the regular expression from string expansion.
13725 </listitem></varlistentry>
13727 <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>
13730 <indexterm role="concept">
13731 <primary><option>substr</option> expansion item</primary>
13733 <indexterm role="concept">
13734 <primary>substring extraction</primary>
13736 <indexterm role="concept">
13737 <primary>expansion</primary>
13738 <secondary>substring extraction</secondary>
13740 The three strings are expanded; the first two must yield numbers. Call them
13741 <<emphasis>n</emphasis>> and <<emphasis>m</emphasis>>. If you are using fixed values for these numbers, that is,
13742 if <<emphasis>string1</emphasis>> and <<emphasis>string2</emphasis>> do not change when they are expanded, you
13743 can use the simpler operator notation that avoids some of the braces:
13745 <literallayout class="monospaced">
13746 ${substr_<n>_<m>:<string>}
13749 The second number is optional (in both notations).
13750 If it is absent in the simpler format, the preceding underscore must also be
13754 The <option>substr</option> item can be used to extract more general substrings than
13755 <option>length</option>. The first number, <<emphasis>n</emphasis>>, is a starting offset, and <<emphasis>m</emphasis>> is the
13756 length required. For example
13758 <literallayout class="monospaced">
13759 ${substr{3}{2}{$local_part}}
13762 If the starting offset is greater than the string length the result is the
13763 null string; if the length plus starting offset is greater than the string
13764 length, the result is the right-hand part of the string, starting from the
13765 given offset. The first character in the string has offset zero.
13768 The <option>substr</option> expansion item can take negative offset values to count
13769 from the right-hand end of its operand. The last character is offset -1, the
13770 second-last is offset -2, and so on. Thus, for example,
13772 <literallayout class="monospaced">
13773 ${substr{-5}{2}{1234567}}
13776 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
13777 length of the string, the substring starts at the beginning of the string, and
13778 the length is reduced by the amount of overshoot. Thus, for example,
13780 <literallayout class="monospaced">
13781 ${substr{-5}{2}{12}}
13784 yields an empty string, but
13786 <literallayout class="monospaced">
13787 ${substr{-3}{2}{12}}
13790 yields <quote>1</quote>.
13793 When the second number is omitted from <option>substr</option>, the remainder of the string
13794 is taken if the offset is positive. If it is negative, all characters in the
13795 string preceding the offset point are taken. For example, an offset of -1 and
13796 no length, as in these semantically identical examples:
13798 <literallayout class="monospaced">
13800 ${substr{-1}{abcde}}
13803 yields all but the last character of the string, that is, <quote>abcd</quote>.
13805 </listitem></varlistentry>
13807 <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>
13810 <indexterm role="concept">
13811 <primary>expansion</primary>
13812 <secondary>character translation</secondary>
13814 <indexterm role="concept">
13815 <primary><option>tr</option> expansion item</primary>
13817 This item does single-character translation on its subject string. The second
13818 argument is a list of characters to be translated in the subject string. Each
13819 matching character is replaced by the corresponding character from the
13820 replacement list. For example
13822 <literallayout class="monospaced">
13823 ${tr{abcdea}{ac}{13}}
13826 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
13827 last occurrence is used. If the third string is shorter than the second, its
13828 last character is replicated. However, if it is empty, no translation takes
13831 </listitem></varlistentry>
13834 <section id="SECTexpop">
13835 <title>Expansion operators</title>
13837 <indexterm role="concept">
13838 <primary>expansion</primary>
13839 <secondary>operators</secondary>
13841 For expansion items that perform transformations on a single argument string,
13842 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
13843 The substring is first expanded before the operation is applied to it. The
13844 following operations can be performed:
13848 <term><emphasis role="bold">${address:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13851 <indexterm role="concept">
13852 <primary>expansion</primary>
13853 <secondary>RFC 2822 address handling</secondary>
13855 <indexterm role="concept">
13856 <primary><option>address</option> expansion item</primary>
13858 The string is interpreted as an RFC 2822 address, as it might appear in a
13859 header line, and the effective address is extracted from it. If the string does
13860 not parse successfully, the result is empty.
13862 </listitem></varlistentry>
13864 <term><emphasis role="bold">${addresses:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13867 <indexterm role="concept">
13868 <primary>expansion</primary>
13869 <secondary>RFC 2822 address handling</secondary>
13871 <indexterm role="concept">
13872 <primary><option>addresses</option> expansion item</primary>
13874 The string (after expansion) is interpreted as a list of addresses in RFC
13875 2822 format, such as can be found in a <emphasis>To:</emphasis> or <emphasis>Cc:</emphasis> header line. The
13876 operative address (<emphasis>local-part@domain</emphasis>) is extracted from each item, and the
13877 result of the expansion is a colon-separated list, with appropriate
13878 doubling of colons should any happen to be present in the email addresses.
13879 Syntactically invalid RFC2822 address items are omitted from the output.
13882 It is possible to specify a character other than colon for the output
13883 separator by starting the string with > followed by the new separator
13884 character. For example:
13886 <literallayout class="monospaced">
13887 ${addresses:>& Chief <ceo@up.stairs>, sec@base.ment (dogsbody)}
13890 expands to <literal>ceo@up.stairs&sec@base.ment</literal>. Compare the <emphasis role="bold">address</emphasis> (singular)
13891 expansion item, which extracts the working address from a single RFC2822
13892 address. See the <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and <emphasis role="bold">reduce</emphasis> items for ways of
13895 </listitem></varlistentry>
13897 <term><emphasis role="bold">${base62:</emphasis><<emphasis>digits</emphasis>><emphasis role="bold">}</emphasis></term>
13900 <indexterm role="concept">
13901 <primary><option>base62</option> expansion item</primary>
13903 <indexterm role="concept">
13904 <primary>expansion</primary>
13905 <secondary>conversion to base 62</secondary>
13907 The string must consist entirely of decimal digits. The number is converted to
13908 base 62 and output as a string of six characters, including leading zeros. In
13909 the few operating environments where Exim uses base 36 instead of base 62 for
13910 its message identifiers (because those systems do not have case-sensitive file
13911 names), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just to
13912 be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
13914 </listitem></varlistentry>
13916 <term><emphasis role="bold">${base62d:</emphasis><<emphasis>base-62 digits</emphasis>><emphasis role="bold">}</emphasis></term>
13919 <indexterm role="concept">
13920 <primary><option>base62d</option> expansion item</primary>
13922 <indexterm role="concept">
13923 <primary>expansion</primary>
13924 <secondary>conversion to base 62</secondary>
13926 The string must consist entirely of base-62 digits, or, in operating
13927 environments where Exim uses base 36 instead of base 62 for its message
13928 identifiers, base-36 digits. The number is converted to decimal and output as a
13931 </listitem></varlistentry>
13933 <term><emphasis role="bold">${domain:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13936 <indexterm role="concept">
13937 <primary>domain</primary>
13938 <secondary>extraction</secondary>
13940 <indexterm role="concept">
13941 <primary>expansion</primary>
13942 <secondary>domain extraction</secondary>
13944 The string is interpreted as an RFC 2822 address and the domain is extracted
13945 from it. If the string does not parse successfully, the result is empty.
13947 </listitem></varlistentry>
13949 <term><emphasis role="bold">${escape:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13952 <indexterm role="concept">
13953 <primary>expansion</primary>
13954 <secondary>escaping non-printing characters</secondary>
13956 <indexterm role="concept">
13957 <primary><option>escape</option> expansion item</primary>
13959 If the string contains any non-printing characters, they are converted to
13960 escape sequences starting with a backslash. Whether characters with the most
13961 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
13962 is controlled by the <option>print_topbitchars</option> option.
13964 </listitem></varlistentry>
13966 <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>
13969 <indexterm role="concept">
13970 <primary>expansion</primary>
13971 <secondary>expression evaluation</secondary>
13973 <indexterm role="concept">
13974 <primary>expansion</primary>
13975 <secondary>arithmetic expression</secondary>
13977 <indexterm role="concept">
13978 <primary><option>eval</option> expansion item</primary>
13980 These items supports simple arithmetic and bitwise logical operations in
13981 expansion strings. The string (after expansion) must be a conventional
13982 arithmetic expression, but it is limited to basic arithmetic operators, bitwise
13983 logical operators, and parentheses. All operations are carried out using
13984 integer arithmetic. The operator priorities are as follows (the same as in the
13985 C programming language):
13987 <informaltable frame="none">
13988 <tgroup cols="2" colsep="0" rowsep="0">
13989 <colspec colwidth="70pt" align="left"/>
13990 <colspec colwidth="300pt" align="left"/>
13993 <entry> <emphasis>highest:</emphasis></entry>
13994 <entry>not (~), negate (-)</entry>
13997 <entry> </entry>
13998 <entry>multiply (*), divide (/), remainder (%)</entry>
14001 <entry> </entry>
14002 <entry>plus (+), minus (-)</entry>
14005 <entry> </entry>
14006 <entry>shift-left (<<), shift-right (>>)</entry>
14009 <entry> </entry>
14010 <entry>and (&)</entry>
14013 <entry> </entry>
14014 <entry>xor (^)</entry>
14017 <entry> <emphasis>lowest:</emphasis></entry>
14018 <entry>or (|)</entry>
14024 Binary operators with the same priority are evaluated from left to right. White
14025 space is permitted before or after operators.
14028 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
14029 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
14030 decimal, even if they start with a leading zero; hexadecimal numbers are not
14031 permitted. This can be useful when processing numbers extracted from dates or
14032 times, which often do have leading zeros.
14035 A number may be followed by <quote>K</quote> or <quote>M</quote> to multiply it by 1024 or 1024*1024,
14036 respectively. Negative numbers are supported. The result of the computation is
14037 a decimal representation of the answer (without <quote>K</quote> or <quote>M</quote>). For example:
14040 <literal>${eval:1+1} </literal> yields 2
14041 <literal>${eval:1+2*3} </literal> yields 7
14042 <literal>${eval:(1+2)*3} </literal> yields 9
14043 <literal>${eval:2+42%5} </literal> yields 4
14044 <literal>${eval:0xc&5} </literal> yields 4
14045 <literal>${eval:0xc|5} </literal> yields 13
14046 <literal>${eval:0xc^5} </literal> yields 9
14047 <literal>${eval:0xc>>1} </literal> yields 6
14048 <literal>${eval:0xc<<1} </literal> yields 24
14049 <literal>${eval:~255&0x1234} </literal> yields 4608
14050 <literal>${eval:-(~255&0x1234)} </literal> yields -4608
14053 As a more realistic example, in an ACL you might have
14055 <literallayout class="monospaced">
14056 deny message = Too many bad recipients
14059 {>{$rcpt_count}{10}} \
14062 {$recipients_count} \
14063 {${eval:$rcpt_count/2}} \
14068 The condition is true if there have been more than 10 RCPT commands and
14069 fewer than half of them have resulted in a valid recipient.
14071 </listitem></varlistentry>
14073 <term><emphasis role="bold">${expand:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14076 <indexterm role="concept">
14077 <primary>expansion</primary>
14078 <secondary>re-expansion of substring</secondary>
14080 The <option>expand</option> operator causes a string to be expanded for a second time. For
14083 <literallayout class="monospaced">
14084 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
14087 first looks up a string in a file while expanding the operand for <option>expand</option>,
14088 and then re-expands what it has found.
14090 </listitem></varlistentry>
14092 <term><emphasis role="bold">${from_utf8:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14095 <indexterm role="concept">
14096 <primary>Unicode</primary>
14098 <indexterm role="concept">
14099 <primary>UTF-8</primary>
14100 <secondary>conversion from</secondary>
14102 <indexterm role="concept">
14103 <primary>expansion</primary>
14104 <secondary>UTF-8 conversion</secondary>
14106 <indexterm role="concept">
14107 <primary><option>from_utf8</option> expansion item</primary>
14109 The world is slowly moving towards Unicode, although there are no standards for
14110 email yet. However, other applications (including some databases) are starting
14111 to store data in Unicode, using UTF-8 encoding. This operator converts from a
14112 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
14113 converted to underscores. The input must be a valid UTF-8 string. If it is not,
14114 the result is an undefined sequence of bytes.
14117 Unicode code points with values less than 256 are compatible with ASCII and
14118 ISO-8859-1 (also known as Latin-1).
14119 For example, character 169 is the copyright symbol in both cases, though the
14120 way it is encoded is different. In UTF-8, more than one byte is needed for
14121 characters with code values greater than 127, whereas ISO-8859-1 is a
14122 single-byte encoding (but thereby limited to 256 characters). This makes
14123 translation from UTF-8 to ISO-8859-1 straightforward.
14125 </listitem></varlistentry>
14127 <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>
14130 <indexterm role="concept">
14131 <primary>hash function</primary>
14132 <secondary>textual</secondary>
14134 <indexterm role="concept">
14135 <primary>expansion</primary>
14136 <secondary>textual hash</secondary>
14138 The <option>hash</option> operator is a simpler interface to the hashing function that can
14139 be used when the two parameters are fixed numbers (as opposed to strings that
14140 change when expanded). The effect is the same as
14142 <literallayout class="monospaced">
14143 ${hash{<n>}{<m>}{<string>}}
14146 See the description of the general <option>hash</option> item above for details. The
14147 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
14149 </listitem></varlistentry>
14151 <term><emphasis role="bold">${hex2b64:</emphasis><<emphasis>hexstring</emphasis>><emphasis role="bold">}</emphasis></term>
14154 <indexterm role="concept">
14155 <primary>base64 encoding</primary>
14156 <secondary>conversion from hex</secondary>
14158 <indexterm role="concept">
14159 <primary>expansion</primary>
14160 <secondary>hex to base64</secondary>
14162 <indexterm role="concept">
14163 <primary><option>hex2b64</option> expansion item</primary>
14165 This operator converts a hex string into one that is base64 encoded. This can
14166 be useful for processing the output of the MD5 and SHA-1 hashing functions.
14168 </listitem></varlistentry>
14170 <term><emphasis role="bold">${lc:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14173 <indexterm role="concept">
14174 <primary>case forcing in strings</primary>
14176 <indexterm role="concept">
14177 <primary>string</primary>
14178 <secondary>case forcing</secondary>
14180 <indexterm role="concept">
14181 <primary>lower casing</primary>
14183 <indexterm role="concept">
14184 <primary>expansion</primary>
14185 <secondary>case forcing</secondary>
14187 <indexterm role="concept">
14188 <primary><option>lc</option> expansion item</primary>
14190 This forces the letters in the string into lower-case, for example:
14192 <literallayout class="monospaced">
14195 </listitem></varlistentry>
14197 <term><emphasis role="bold">${length_</emphasis><<emphasis>number</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14200 <indexterm role="concept">
14201 <primary>expansion</primary>
14202 <secondary>string truncation</secondary>
14204 <indexterm role="concept">
14205 <primary><option>length</option> expansion item</primary>
14207 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
14208 can be used when the parameter is a fixed number (as opposed to a string that
14209 changes when expanded). The effect is the same as
14211 <literallayout class="monospaced">
14212 ${length{<number>}{<string>}}
14215 See the description of the general <option>length</option> item above for details. Note that
14216 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
14217 when <option>length</option> is used as an operator.
14219 </listitem></varlistentry>
14221 <term><emphasis role="bold">${local_part:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14224 <indexterm role="concept">
14225 <primary>expansion</primary>
14226 <secondary>local part extraction</secondary>
14228 <indexterm role="concept">
14229 <primary><option>local_part</option> expansion item</primary>
14231 The string is interpreted as an RFC 2822 address and the local part is
14232 extracted from it. If the string does not parse successfully, the result is
14235 </listitem></varlistentry>
14237 <term><emphasis role="bold">${mask:</emphasis><<emphasis>IP address</emphasis>><emphasis role="bold">/</emphasis><<emphasis>bit count</emphasis>><emphasis role="bold">}</emphasis></term>
14240 <indexterm role="concept">
14241 <primary>masked IP address</primary>
14243 <indexterm role="concept">
14244 <primary>IP address</primary>
14245 <secondary>masking</secondary>
14247 <indexterm role="concept">
14248 <primary>CIDR notation</primary>
14250 <indexterm role="concept">
14251 <primary>expansion</primary>
14252 <secondary>IP address masking</secondary>
14254 <indexterm role="concept">
14255 <primary><option>mask</option> expansion item</primary>
14257 If the form of the string to be operated on is not an IP address followed by a
14258 slash and an integer (that is, a network address in CIDR notation), the
14259 expansion fails. Otherwise, this operator converts the IP address to binary,
14260 masks off the least significant bits according to the bit count, and converts
14261 the result back to text, with mask appended. For example,
14263 <literallayout class="monospaced">
14264 ${mask:10.111.131.206/28}
14267 returns the string <quote>10.111.131.192/28</quote>. Since this operation is expected to
14268 be mostly used for looking up masked addresses in files, the result for an IPv6
14269 address uses dots to separate components instead of colons, because colon
14270 terminates a key string in lsearch files. So, for example,
14272 <literallayout class="monospaced">
14273 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
14278 <literallayout class="monospaced">
14279 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
14282 Letters in IPv6 addresses are always output in lower case.
14284 </listitem></varlistentry>
14286 <term><emphasis role="bold">${md5:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14289 <indexterm role="concept">
14290 <primary>MD5 hash</primary>
14292 <indexterm role="concept">
14293 <primary>expansion</primary>
14294 <secondary>MD5 hash</secondary>
14296 <indexterm role="concept">
14297 <primary><option>md5</option> expansion item</primary>
14299 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
14300 as a 32-digit hexadecimal number, in which any letters are in lower case.
14302 </listitem></varlistentry>
14304 <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>
14307 <indexterm role="concept">
14308 <primary>expansion</primary>
14309 <secondary>numeric hash</secondary>
14311 <indexterm role="concept">
14312 <primary>hash function</primary>
14313 <secondary>numeric</secondary>
14315 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
14316 that can be used when the two parameters are fixed numbers (as opposed to
14317 strings that change when expanded). The effect is the same as
14319 <literallayout class="monospaced">
14320 ${nhash{<n>}{<m>}{<string>}}
14323 See the description of the general <option>nhash</option> item above for details.
14325 </listitem></varlistentry>
14327 <term><emphasis role="bold">${quote:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14330 <indexterm role="concept">
14331 <primary>quoting</primary>
14332 <secondary>in string expansions</secondary>
14334 <indexterm role="concept">
14335 <primary>expansion</primary>
14336 <secondary>quoting</secondary>
14338 <indexterm role="concept">
14339 <primary><option>quote</option> expansion item</primary>
14341 The <option>quote</option> operator puts its argument into double quotes if it
14342 is an empty string or
14343 contains anything other than letters, digits, underscores, dots, and hyphens.
14344 Any occurrences of double quotes and backslashes are escaped with a backslash.
14345 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
14346 respectively For example,
14348 <literallayout class="monospaced">
14354 <literallayout class="monospaced">
14358 The place where this is useful is when the argument is a substitution from a
14359 variable or a message header.
14361 </listitem></varlistentry>
14363 <term><emphasis role="bold">${quote_local_part:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14366 <indexterm role="concept">
14367 <primary><option>quote_local_part</option> expansion item</primary>
14369 This operator is like <option>quote</option>, except that it quotes the string only if
14370 required to do so by the rules of RFC 2822 for quoting local parts. For
14371 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
14372 If you are creating a new email address from the contents of <varname>$local_part</varname>
14373 (or any other unknown data), you should always use this operator.
14375 </listitem></varlistentry>
14377 <term><emphasis role="bold">${quote_</emphasis><<emphasis>lookup-type</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14380 <indexterm role="concept">
14381 <primary>quoting</primary>
14382 <secondary>lookup-specific</secondary>
14384 This operator applies lookup-specific quoting rules to the string. Each
14385 query-style lookup type has its own quoting rules which are described with
14386 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
14388 <literallayout class="monospaced">
14389 ${quote_ldap:two * two}
14394 <literallayout class="monospaced">
14398 For single-key lookup types, no quoting is ever necessary and this operator
14399 yields an unchanged string.
14401 </listitem></varlistentry>
14403 <term><emphasis role="bold">${randint:</emphasis><<emphasis>n</emphasis>><emphasis role="bold">}</emphasis></term>
14406 <indexterm role="concept">
14407 <primary>random number</primary>
14409 This operator returns a somewhat random number which is less than the
14410 supplied number and is at least 0. The quality of this randomness depends
14411 on how Exim was built; the values are not suitable for keying material.
14412 If Exim is linked against OpenSSL then RAND_pseudo_bytes() is used.
14413 Otherwise, the implementation may be arc4random(), random() seeded by
14414 srandomdev() or srandom(), or a custom implementation even weaker than
14417 </listitem></varlistentry>
14419 <term><emphasis role="bold">${rfc2047:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14422 <indexterm role="concept">
14423 <primary>expansion</primary>
14424 <secondary>RFC 2047</secondary>
14426 <indexterm role="concept">
14427 <primary>RFC 2047</primary>
14428 <secondary>expansion operator</secondary>
14430 <indexterm role="concept">
14431 <primary><option>rfc2047</option> expansion item</primary>
14433 This operator encodes text according to the rules of RFC 2047. This is an
14434 encoding that is used in header lines to encode non-ASCII characters. It is
14435 assumed that the input string is in the encoding specified by the
14436 <option>headers_charset</option> option, which defaults to ISO-8859-1. If the string
14437 contains only characters in the range 33–126, and no instances of the
14440 <literallayout class="monospaced">
14441 ? = ( ) < > @ , ; : \ " . [ ] _
14444 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
14445 string, using as many <quote>encoded words</quote> as necessary to encode all the
14448 </listitem></varlistentry>
14450 <term><emphasis role="bold">${rfc2047d:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14453 <indexterm role="concept">
14454 <primary>expansion</primary>
14455 <secondary>RFC 2047</secondary>
14457 <indexterm role="concept">
14458 <primary>RFC 2047</primary>
14459 <secondary>decoding</secondary>
14461 <indexterm role="concept">
14462 <primary><option>rfc2047d</option> expansion item</primary>
14464 This operator decodes strings that are encoded as per RFC 2047. Binary zero
14465 bytes are replaced by question marks. Characters are converted into the
14466 character set defined by <option>headers_charset</option>. Overlong RFC 2047 <quote>words</quote> are
14467 not recognized unless <option>check_rfc2047_length</option> is set false.
14470 <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
14471 access a header line, RFC 2047 decoding is done automatically. You do not need
14472 to use this operator as well.
14474 </listitem></varlistentry>
14476 <term><emphasis role="bold">${rxquote:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14479 <indexterm role="concept">
14480 <primary>quoting</primary>
14481 <secondary>in regular expressions</secondary>
14483 <indexterm role="concept">
14484 <primary>regular expressions</primary>
14485 <secondary>quoting</secondary>
14487 <indexterm role="concept">
14488 <primary><option>rxquote</option> expansion item</primary>
14490 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
14491 characters in its argument. This is useful when substituting the values of
14492 variables or headers inside regular expressions.
14494 </listitem></varlistentry>
14496 <term><emphasis role="bold">${sha1:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14499 <indexterm role="concept">
14500 <primary>SHA-1 hash</primary>
14502 <indexterm role="concept">
14503 <primary>expansion</primary>
14504 <secondary>SHA-1 hashing</secondary>
14506 <indexterm role="concept">
14507 <primary><option>sha2</option> expansion item</primary>
14509 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
14510 it as a 40-digit hexadecimal number, in which any letters are in upper case.
14512 </listitem></varlistentry>
14514 <term><emphasis role="bold">${stat:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14517 <indexterm role="concept">
14518 <primary>expansion</primary>
14519 <secondary>statting a file</secondary>
14521 <indexterm role="concept">
14522 <primary>file</primary>
14523 <secondary>extracting characteristics</secondary>
14525 <indexterm role="concept">
14526 <primary><option>stat</option> expansion item</primary>
14528 The string, after expansion, must be a file path. A call to the <function>stat()</function>
14529 function is made for this path. If <function>stat()</function> fails, an error occurs and the
14530 expansion fails. If it succeeds, the data from the stat replaces the item, as a
14531 series of <<emphasis>name</emphasis>>=<<emphasis>value</emphasis>> pairs, where the values are all numerical,
14532 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
14533 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
14534 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
14535 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
14536 can extract individual fields using the <option>extract</option> expansion item.
14539 The use of the <option>stat</option> expansion in users’ filter files can be locked out by
14540 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
14541 systems for files larger than 2GB.
14543 </listitem></varlistentry>
14545 <term><emphasis role="bold">${str2b64:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14548 <indexterm role="concept">
14549 <primary>expansion</primary>
14550 <secondary>base64 encoding</secondary>
14552 <indexterm role="concept">
14553 <primary>base64 encoding</primary>
14554 <secondary>in string expansion</secondary>
14556 <indexterm role="concept">
14557 <primary><option>str2b64</option> expansion item</primary>
14559 This operator converts a string into one that is base64 encoded.
14561 </listitem></varlistentry>
14563 <term><emphasis role="bold">${strlen:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14566 <indexterm role="concept">
14567 <primary>expansion</primary>
14568 <secondary>string length</secondary>
14570 <indexterm role="concept">
14571 <primary>string</primary>
14572 <secondary>length in expansion</secondary>
14574 <indexterm role="concept">
14575 <primary><option>strlen</option> expansion item</primary>
14577 The item is replace by the length of the expanded string, expressed as a
14578 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
14580 </listitem></varlistentry>
14582 <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>
14585 <indexterm role="concept">
14586 <primary><option>substr</option> expansion item</primary>
14588 <indexterm role="concept">
14589 <primary>substring extraction</primary>
14591 <indexterm role="concept">
14592 <primary>expansion</primary>
14593 <secondary>substring expansion</secondary>
14595 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
14596 can be used when the two parameters are fixed numbers (as opposed to strings
14597 that change when expanded). The effect is the same as
14599 <literallayout class="monospaced">
14600 ${substr{<start>}{<length>}{<string>}}
14603 See the description of the general <option>substr</option> item above for details. The
14604 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
14606 </listitem></varlistentry>
14608 <term><emphasis role="bold">${time_eval:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14611 <indexterm role="concept">
14612 <primary><option>time_eval</option> expansion item</primary>
14614 <indexterm role="concept">
14615 <primary>time interval</primary>
14616 <secondary>decoding</secondary>
14618 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
14621 </listitem></varlistentry>
14623 <term><emphasis role="bold">${time_interval:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14626 <indexterm role="concept">
14627 <primary><option>time_interval</option> expansion item</primary>
14629 <indexterm role="concept">
14630 <primary>time interval</primary>
14631 <secondary>formatting</secondary>
14633 The argument (after sub-expansion) must be a sequence of decimal digits that
14634 represents an interval of time as a number of seconds. It is converted into a
14635 number of larger units and output in Exim’s normal time format, for example,
14636 <literal>1w3d4h2m6s</literal>.
14638 </listitem></varlistentry>
14640 <term><emphasis role="bold">${uc:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14643 <indexterm role="concept">
14644 <primary>case forcing in strings</primary>
14646 <indexterm role="concept">
14647 <primary>string</primary>
14648 <secondary>case forcing</secondary>
14650 <indexterm role="concept">
14651 <primary>upper casing</primary>
14653 <indexterm role="concept">
14654 <primary>expansion</primary>
14655 <secondary>case forcing</secondary>
14657 <indexterm role="concept">
14658 <primary><option>uc</option> expansion item</primary>
14660 This forces the letters in the string into upper-case.
14662 </listitem></varlistentry>
14665 <section id="SECTexpcond">
14666 <title>Expansion conditions</title>
14668 <indexterm role="concept" id="IIDexpcond" class="startofrange">
14669 <primary>expansion</primary>
14670 <secondary>conditions</secondary>
14672 The following conditions are available for testing by the <option>${if</option> construct
14673 while expanding strings:
14677 <term><emphasis role="bold">!</emphasis><<emphasis>condition</emphasis>></term>
14680 <indexterm role="concept">
14681 <primary>expansion</primary>
14682 <secondary>negating a condition</secondary>
14684 <indexterm role="concept">
14685 <primary>negation</primary>
14686 <secondary>in expansion condition</secondary>
14688 Preceding any condition with an exclamation mark negates the result of the
14691 </listitem></varlistentry>
14693 <term><<emphasis>symbolic operator</emphasis>> <emphasis role="bold">{</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14696 <indexterm role="concept">
14697 <primary>numeric comparison</primary>
14699 <indexterm role="concept">
14700 <primary>expansion</primary>
14701 <secondary>numeric comparison</secondary>
14703 There are a number of symbolic operators for doing numeric comparisons. They
14707 <literal>= </literal> equal
14708 <literal>== </literal> equal
14709 <literal>> </literal> greater
14710 <literal>>= </literal> greater or equal
14711 <literal>< </literal> less
14712 <literal><= </literal> less or equal
14717 <literallayout class="monospaced">
14718 ${if >{$message_size}{10M} ...
14721 Note that the general negation operator provides for inequality testing. The
14722 two strings must take the form of optionally signed decimal integers,
14723 optionally followed by one of the letters <quote>K</quote> or <quote>M</quote> (in either upper or
14724 lower case), signifying multiplication by 1024 or 1024*1024, respectively.
14725 As a special case, the numerical value of an empty string is taken as
14728 </listitem></varlistentry>
14729 <varlistentry revisionflag="changed">
14730 <term><emphasis role="bold">bool {</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14732 <para revisionflag="changed">
14733 <indexterm role="concept">
14734 <primary>expansion</primary>
14735 <secondary>boolean parsing</secondary>
14737 <indexterm role="concept">
14738 <primary><option>bool</option> expansion condition</primary>
14740 This condition turns a string holding a true or false representation into
14741 a boolean state. It parses <quote>true</quote>, <quote>false</quote>, <quote>yes</quote> and <quote>no</quote>
14742 (case-insensitively); also positive integer numbers map to true if non-zero,
14743 false if zero. Leading whitespace is ignored.
14744 All other string values will result in expansion failure.
14746 <para revisionflag="changed">
14747 When combined with ACL variables, this expansion condition will let you
14748 make decisions in one place and act on those decisions in another place.
14751 <literallayout class="monospaced" revisionflag="changed">
14752 ${if bool{$acl_m_privileged_sender} ...
14754 </listitem></varlistentry>
14756 <term><emphasis role="bold">crypteq {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14759 <indexterm role="concept">
14760 <primary>expansion</primary>
14761 <secondary>encrypted comparison</secondary>
14763 <indexterm role="concept">
14764 <primary>encrypted strings, comparing</primary>
14766 <indexterm role="concept">
14767 <primary><option>crypteq</option> expansion condition</primary>
14769 This condition is included in the Exim binary if it is built to support any
14770 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
14771 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
14772 included in the binary.
14775 The <option>crypteq</option> condition has two arguments. The first is encrypted and
14776 compared against the second, which is already encrypted. The second string may
14777 be in the LDAP form for storing encrypted strings, which starts with the
14778 encryption type in curly brackets, followed by the data. If the second string
14779 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
14780 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
14781 Typically this will be a field from a password file. An example of an encrypted
14782 string in LDAP form is:
14784 <literallayout class="monospaced">
14785 {md5}CY9rzUYh03PK3k6DJie09g==
14788 If such a string appears directly in an expansion, the curly brackets have to
14789 be quoted, because they are part of the expansion syntax. For example:
14791 <literallayout class="monospaced">
14792 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
14795 The following encryption types (whose names are matched case-independently) are
14801 <indexterm role="concept">
14802 <primary>MD5 hash</primary>
14804 <indexterm role="concept">
14805 <primary>base64 encoding</primary>
14806 <secondary>in encrypted password</secondary>
14808 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
14809 printable characters to compare with the remainder of the second string. If the
14810 length of the comparison string is 24, Exim assumes that it is base64 encoded
14811 (as in the above example). If the length is 32, Exim assumes that it is a
14812 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
14818 <indexterm role="concept">
14819 <primary>SHA-1 hash</primary>
14821 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
14822 printable characters to compare with the remainder of the second string. If the
14823 length of the comparison string is 28, Exim assumes that it is base64 encoded.
14824 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
14825 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
14830 <indexterm role="concept">
14831 <primary><function>crypt()</function></primary>
14833 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
14834 only the first eight characters of the password. However, in modern operating
14835 systems this is no longer true, and in many cases the entire password is used,
14836 whatever its length.
14841 <indexterm role="concept">
14842 <primary><function>crypt16()</function></primary>
14844 <option>{crypt16}</option> calls the <function>crypt16()</function> function, which was originally created to
14845 use up to 16 characters of the password in some operating systems. Again, in
14846 modern operating systems, more characters may be used.
14851 Exim has its own version of <function>crypt16()</function>, which is just a double call to
14852 <function>crypt()</function>. For operating systems that have their own version, setting
14853 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
14854 operating system version instead of its own. This option is set by default in
14855 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
14856 support <function>crypt16()</function>.
14859 Some years after Exim’s <function>crypt16()</function> was implemented, a user discovered that
14860 it was not using the same algorithm as some operating systems’ versions. It
14861 turns out that as well as <function>crypt16()</function> there is a function called
14862 <function>bigcrypt()</function> in some operating systems. This may or may not use the same
14863 algorithm, and both of them may be different to Exim’s built-in <function>crypt16()</function>.
14866 However, since there is now a move away from the traditional <function>crypt()</function>
14867 functions towards using SHA1 and other algorithms, tidying up this area of
14868 Exim is seen as very low priority.
14871 If you do not put a encryption type (in curly brackets) in a <option>crypteq</option>
14872 comparison, the default is usually either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as
14873 determined by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default
14874 default is <literal>{crypt}</literal>. Whatever the default, you can always use either
14875 function by specifying it explicitly in curly brackets.
14877 </listitem></varlistentry>
14879 <term><emphasis role="bold">def:</emphasis><<emphasis>variable name</emphasis>></term>
14882 <indexterm role="concept">
14883 <primary>expansion</primary>
14884 <secondary>checking for empty variable</secondary>
14886 <indexterm role="concept">
14887 <primary><option>def</option> expansion condition</primary>
14889 The <option>def</option> condition must be followed by the name of one of the expansion
14890 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
14891 variable does not contain the empty string. For example:
14893 <literallayout class="monospaced">
14894 ${if def:sender_ident {from $sender_ident}}
14897 Note that the variable name is given without a leading <option>$</option> character. If the
14898 variable does not exist, the expansion fails.
14900 </listitem></varlistentry>
14902 <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>
14905 <indexterm role="concept">
14906 <primary>expansion</primary>
14907 <secondary>checking header line existence</secondary>
14909 This condition is true if a message is being processed and the named header
14910 exists in the message. For example,
14912 <literallayout class="monospaced">
14913 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
14916 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
14917 the header name must be terminated by a colon if white space does not follow.
14919 </listitem></varlistentry>
14921 <term><emphasis role="bold">eq {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14922 <term><emphasis role="bold">eqi {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14925 <indexterm role="concept">
14926 <primary>string</primary>
14927 <secondary>comparison</secondary>
14929 <indexterm role="concept">
14930 <primary>expansion</primary>
14931 <secondary>string comparison</secondary>
14933 <indexterm role="concept">
14934 <primary><option>eq</option> expansion condition</primary>
14936 <indexterm role="concept">
14937 <primary><option>eqi</option> expansion condition</primary>
14939 The two substrings are first expanded. The condition is true if the two
14940 resulting strings are identical. For <option>eq</option> the comparison includes the case of
14941 letters, whereas for <option>eqi</option> the comparison is case-independent.
14943 </listitem></varlistentry>
14945 <term><emphasis role="bold">exists {</emphasis><<emphasis>file name</emphasis>><emphasis role="bold">}</emphasis></term>
14948 <indexterm role="concept">
14949 <primary>expansion</primary>
14950 <secondary>file existence test</secondary>
14952 <indexterm role="concept">
14953 <primary>file</primary>
14954 <secondary>existence test</secondary>
14956 <indexterm role="concept">
14957 <primary><option>exists</option>, expansion condition</primary>
14959 The substring is first expanded and then interpreted as an absolute path. The
14960 condition is true if the named file (or directory) exists. The existence test
14961 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
14962 users’ filter files may be locked out by the system administrator.
14964 </listitem></varlistentry>
14966 <term><emphasis role="bold">first_delivery</emphasis></term>
14969 <indexterm role="concept">
14970 <primary>delivery</primary>
14971 <secondary>first</secondary>
14973 <indexterm role="concept">
14974 <primary>first delivery</primary>
14976 <indexterm role="concept">
14977 <primary>expansion</primary>
14978 <secondary>first delivery test</secondary>
14980 <indexterm role="concept">
14981 <primary><option>first_delivery</option> expansion condition</primary>
14983 This condition, which has no data, is true during a message’s first delivery
14984 attempt. It is false during any subsequent delivery attempts.
14986 </listitem></varlistentry>
14988 <term><emphasis role="bold">forall{</emphasis><<emphasis>a list</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>a condition</emphasis>><emphasis role="bold">}</emphasis></term>
14989 <term><emphasis role="bold">forany{</emphasis><<emphasis>a list</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>a condition</emphasis>><emphasis role="bold">}</emphasis></term>
14992 <indexterm role="concept">
14993 <primary>list</primary>
14994 <secondary>iterative conditions</secondary>
14996 <indexterm role="concept">
14997 <primary>expansion</primary>
14998 <secondary><emphasis role="bold">forall</emphasis> condition</secondary>
15000 <indexterm role="concept">
15001 <primary>expansion</primary>
15002 <secondary><emphasis role="bold">forany</emphasis> condition</secondary>
15004 <indexterm role="variable">
15005 <primary><varname>$item</varname></primary>
15007 These conditions iterate over a list. The first argument is expanded to form
15008 the list. By default, the list separator is a colon, but it can be changed by
15009 the normal method. The second argument is interpreted as a condition that is to
15010 be applied to each item in the list in turn. During the interpretation of the
15011 condition, the current list item is placed in a variable called <varname>$item</varname>.
15016 For <emphasis role="bold">forany</emphasis>, interpretation stops if the condition is true for any item, and
15017 the result of the whole condition is true. If the condition is false for all
15018 items in the list, the overall condition is false.
15023 For <emphasis role="bold">forall</emphasis>, interpretation stops if the condition is false for any item,
15024 and the result of the whole condition is false. If the condition is true for
15025 all items in the list, the overall condition is true.
15030 Note that negation of <emphasis role="bold">forany</emphasis> means that the condition must be false for all
15031 items for the overall condition to succeed, and negation of <emphasis role="bold">forall</emphasis> means
15032 that the condition must be false for at least one item. In this example, the
15033 list separator is changed to a comma:
15035 <literallayout class="monospaced">
15036 ${if forany{<, $recipients}{match{$item}{^user3@}}{yes}{no}}
15039 The value of <varname>$item</varname> is saved and restored while <emphasis role="bold">forany</emphasis> or <emphasis role="bold">forall</emphasis> is
15040 being processed, to enable these expansion items to be nested.
15042 </listitem></varlistentry>
15044 <term><emphasis role="bold">ge {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15045 <term><emphasis role="bold">gei {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15048 <indexterm role="concept">
15049 <primary>string</primary>
15050 <secondary>comparison</secondary>
15052 <indexterm role="concept">
15053 <primary>expansion</primary>
15054 <secondary>string comparison</secondary>
15056 <indexterm role="concept">
15057 <primary><option>ge</option> expansion condition</primary>
15059 <indexterm role="concept">
15060 <primary><option>gei</option> expansion condition</primary>
15062 The two substrings are first expanded. The condition is true if the first
15063 string is lexically greater than or equal to the second string. For <option>ge</option> the
15064 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
15067 </listitem></varlistentry>
15069 <term><emphasis role="bold">gt {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15070 <term><emphasis role="bold">gti {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15073 <indexterm role="concept">
15074 <primary>string</primary>
15075 <secondary>comparison</secondary>
15077 <indexterm role="concept">
15078 <primary>expansion</primary>
15079 <secondary>string comparison</secondary>
15081 <indexterm role="concept">
15082 <primary><option>gt</option> expansion condition</primary>
15084 <indexterm role="concept">
15085 <primary><option>gti</option> expansion condition</primary>
15087 The two substrings are first expanded. The condition is true if the first
15088 string is lexically greater than the second string. For <option>gt</option> the comparison
15089 includes the case of letters, whereas for <option>gti</option> the comparison is
15092 </listitem></varlistentry>
15094 <term><emphasis role="bold">isip {</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
15095 <term><emphasis role="bold">isip4 {</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
15096 <term><emphasis role="bold">isip6 {</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
15099 <indexterm role="concept">
15100 <primary>IP address</primary>
15101 <secondary>testing string format</secondary>
15103 <indexterm role="concept">
15104 <primary>string</primary>
15105 <secondary>testing for IP address</secondary>
15107 <indexterm role="concept">
15108 <primary><option>isip</option> expansion condition</primary>
15110 <indexterm role="concept">
15111 <primary><option>isip4</option> expansion condition</primary>
15113 <indexterm role="concept">
15114 <primary><option>isip6</option> expansion condition</primary>
15116 The substring is first expanded, and then tested to see if it has the form of
15117 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
15118 <option>isip4</option> and <option>isip6</option> test specifically for IPv4 or IPv6 addresses.
15121 For an IPv4 address, the test is for four dot-separated components, each of
15122 which consists of from one to three digits. For an IPv6 address, up to eight
15123 colon-separated components are permitted, each containing from one to four
15124 hexadecimal digits. There may be fewer than eight components if an empty
15125 component (adjacent colons) is present. Only one empty component is permitted.
15128 <emphasis role="bold">Note</emphasis>: The checks are just on the form of the address; actual numerical
15129 values are not considered. Thus, for example, 999.999.999.999 passes the IPv4
15130 check. The main use of these tests is to distinguish between IP addresses and
15131 host names, or between IPv4 and IPv6 addresses. For example, you could use
15133 <literallayout class="monospaced">
15134 ${if isip4{$sender_host_address}...
15137 to test which IP version an incoming SMTP connection is using.
15139 </listitem></varlistentry>
15141 <term><emphasis role="bold">ldapauth {</emphasis><<emphasis>ldap query</emphasis>><emphasis role="bold">}</emphasis></term>
15144 <indexterm role="concept">
15145 <primary>LDAP</primary>
15146 <secondary>use for authentication</secondary>
15148 <indexterm role="concept">
15149 <primary>expansion</primary>
15150 <secondary>LDAP authentication test</secondary>
15152 <indexterm role="concept">
15153 <primary><option>ldapauth</option> expansion condition</primary>
15155 This condition supports user authentication using LDAP. See section
15156 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
15157 queries. For this use, the query must contain a user name and password. The
15158 query itself is not used, and can be empty. The condition is true if the
15159 password is not empty, and the user name and password are accepted by the LDAP
15160 server. An empty password is rejected without calling LDAP because LDAP binds
15161 with an empty password are considered anonymous regardless of the username, and
15162 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
15163 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
15166 </listitem></varlistentry>
15168 <term><emphasis role="bold">le {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15169 <term><emphasis role="bold">lei {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15172 <indexterm role="concept">
15173 <primary>string</primary>
15174 <secondary>comparison</secondary>
15176 <indexterm role="concept">
15177 <primary>expansion</primary>
15178 <secondary>string comparison</secondary>
15180 <indexterm role="concept">
15181 <primary><option>le</option> expansion condition</primary>
15183 <indexterm role="concept">
15184 <primary><option>lei</option> expansion condition</primary>
15186 The two substrings are first expanded. The condition is true if the first
15187 string is lexically less than or equal to the second string. For <option>le</option> the
15188 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
15191 </listitem></varlistentry>
15193 <term><emphasis role="bold">lt {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15194 <term><emphasis role="bold">lti {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15197 <indexterm role="concept">
15198 <primary>string</primary>
15199 <secondary>comparison</secondary>
15201 <indexterm role="concept">
15202 <primary>expansion</primary>
15203 <secondary>string comparison</secondary>
15205 <indexterm role="concept">
15206 <primary><option>lt</option> expansion condition</primary>
15208 <indexterm role="concept">
15209 <primary><option>lti</option> expansion condition</primary>
15211 The two substrings are first expanded. The condition is true if the first
15212 string is lexically less than the second string. For <option>lt</option> the comparison
15213 includes the case of letters, whereas for <option>lti</option> the comparison is
15216 </listitem></varlistentry>
15218 <term><emphasis role="bold">match {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15221 <indexterm role="concept">
15222 <primary>expansion</primary>
15223 <secondary>regular expression comparison</secondary>
15225 <indexterm role="concept">
15226 <primary>regular expressions</primary>
15227 <secondary>match in expanded string</secondary>
15229 <indexterm role="concept">
15230 <primary><option>match</option> expansion condition</primary>
15232 The two substrings are first expanded. The second is then treated as a regular
15233 expression and applied to the first. Because of the pre-expansion, if the
15234 regular expression contains dollar, or backslash characters, they must be
15235 escaped. Care must also be taken if the regular expression contains braces
15236 (curly brackets). A closing brace must be escaped so that it is not taken as a
15237 premature termination of <<emphasis>string2</emphasis>>. The easiest approach is to use the
15238 <literal>\N</literal> feature to disable expansion of the regular expression.
15241 <literallayout class="monospaced">
15242 ${if match {$local_part}{\N^\d{3}\N} ...
15245 If the whole expansion string is in double quotes, further escaping of
15246 backslashes is also required.
15249 The condition is true if the regular expression match succeeds.
15250 The regular expression is not required to begin with a circumflex
15251 metacharacter, but if there is no circumflex, the expression is not anchored,
15252 and it may match anywhere in the subject, not just at the start. If you want
15253 the pattern to match at the end of the subject, you must include the <literal>$</literal>
15254 metacharacter at an appropriate point.
15257 <indexterm role="concept">
15258 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
15259 <secondary>in <option>if</option> expansion</secondary>
15261 At the start of an <option>if</option> expansion the values of the numeric variable
15262 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
15263 succeeds causes them to be reset to the substrings of that condition and they
15264 will have these values during the expansion of the success string. At the end
15265 of the <option>if</option> expansion, the previous values are restored. After testing a
15266 combination of conditions using <option>or</option>, the subsequent values of the numeric
15267 variables are those of the condition that succeeded.
15269 </listitem></varlistentry>
15271 <term><emphasis role="bold">match_address {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15274 <indexterm role="concept">
15275 <primary><option>match_address</option> expansion condition</primary>
15277 See <emphasis role="bold">match_local_part</emphasis>.
15279 </listitem></varlistentry>
15281 <term><emphasis role="bold">match_domain {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15284 <indexterm role="concept">
15285 <primary><option>match_domain</option> expansion condition</primary>
15287 See <emphasis role="bold">match_local_part</emphasis>.
15289 </listitem></varlistentry>
15291 <term><emphasis role="bold">match_ip {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15294 <indexterm role="concept">
15295 <primary><option>match_ip</option> expansion condition</primary>
15297 This condition matches an IP address to a list of IP address patterns. It must
15298 be followed by two argument strings. The first (after expansion) must be an IP
15299 address or an empty string. The second (after expansion) is a restricted host
15300 list that can match only an IP address, not a host name. For example:
15302 <literallayout class="monospaced">
15303 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
15306 The specific types of host list item that are permitted in the list are:
15311 An IP address, optionally with a CIDR mask.
15316 A single asterisk, which matches any IP address.
15321 An empty item, which matches only if the IP address is empty. This could be
15322 useful for testing for a locally submitted message or one from specific hosts
15323 in a single test such as
15325 <literallayout class="monospaced">
15326 ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
15329 where the first item in the list is the empty string.
15334 The item @[] matches any of the local host’s interface addresses.
15339 Single-key lookups are assumed to be like <quote>net-</quote> style lookups in host lists,
15340 even if <literal>net-</literal> is not specified. There is never any attempt to turn the IP
15341 address into a host name. The most common type of linear search for
15342 <emphasis role="bold">match_ip</emphasis> is likely to be <emphasis role="bold">iplsearch</emphasis>, in which the file can contain CIDR
15343 masks. For example:
15345 <literallayout class="monospaced">
15346 ${if match_ip{$sender_host_address}{iplsearch;/some/file}...
15349 It is of course possible to use other kinds of lookup, and in such a case, you
15350 do need to specify the <literal>net-</literal> prefix if you want to specify a specific
15351 address mask, for example:
15353 <literallayout class="monospaced">
15354 ${if match_ip{$sender_host_address}{net24-dbm;/some/file}...
15357 However, unless you are combining a <option>match_ip</option> condition with others, it is
15358 just as easy to use the fact that a lookup is itself a condition, and write:
15360 <literallayout class="monospaced">
15361 ${lookup{${mask:$sender_host_address/24}}dbm{/a/file}...
15366 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
15368 </listitem></varlistentry>
15370 <term><emphasis role="bold">match_local_part {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15373 <indexterm role="concept">
15374 <primary>domain list</primary>
15375 <secondary>in expansion condition</secondary>
15377 <indexterm role="concept">
15378 <primary>address list</primary>
15379 <secondary>in expansion condition</secondary>
15381 <indexterm role="concept">
15382 <primary>local part</primary>
15383 <secondary>list, in expansion condition</secondary>
15385 <indexterm role="concept">
15386 <primary><option>match_local_part</option> expansion condition</primary>
15388 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
15389 possible to test domain, address, and local part lists within expansions. Each
15390 condition requires two arguments: an item and a list to match. A trivial
15393 <literallayout class="monospaced">
15394 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
15397 In each case, the second argument may contain any of the allowable items for a
15398 list of the appropriate type. Also, because the second argument (after
15399 expansion) is a standard form of list, it is possible to refer to a named list.
15400 Thus, you can use conditions like this:
15402 <literallayout class="monospaced">
15403 ${if match_domain{$domain}{+local_domains}{...
15406 <indexterm role="concept">
15407 <primary><literal>+caseful</literal></primary>
15409 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
15410 item can be used, as in all address lists, to cause subsequent items to
15411 have their local parts matched casefully. Domains are always matched
15415 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
15416 hosts have two identities: a name and an IP address, and it is not clear
15417 how to specify cleanly how such a test would work. However, IP addresses can be
15418 matched using <option>match_ip</option>.
15420 </listitem></varlistentry>
15422 <term><emphasis role="bold">pam {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">:...}</emphasis></term>
15425 <indexterm role="concept">
15426 <primary>PAM authentication</primary>
15428 <indexterm role="concept">
15429 <primary>AUTH</primary>
15430 <secondary>with PAM</secondary>
15432 <indexterm role="concept">
15433 <primary>Solaris</primary>
15434 <secondary>PAM support</secondary>
15436 <indexterm role="concept">
15437 <primary>expansion</primary>
15438 <secondary>PAM authentication test</secondary>
15440 <indexterm role="concept">
15441 <primary><option>pam</option> expansion condition</primary>
15443 <emphasis>Pluggable Authentication Modules</emphasis>
15444 (<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
15445 available in the latest releases of Solaris and in some GNU/Linux
15446 distributions. The Exim support, which is intended for use in conjunction with
15447 the SMTP AUTH command, is available only if Exim is compiled with
15449 <literallayout class="monospaced">
15453 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
15454 in some releases of GNU/Linux <option>-ldl</option> is also needed.
15457 The argument string is first expanded, and the result must be a
15458 colon-separated list of strings. Leading and trailing white space is ignored.
15459 The PAM module is initialized with the service name <quote>exim</quote> and the user name
15460 taken from the first item in the colon-separated data string (<<emphasis>string1</emphasis>>).
15461 The remaining items in the data string are passed over in response to requests
15462 from the authentication function. In the simple case there will only be one
15463 request, for a password, so the data consists of just two strings.
15466 There can be problems if any of the strings are permitted to contain colon
15467 characters. In the usual way, these have to be doubled to avoid being taken as
15468 separators. If the data is being inserted from a variable, the <option>sg</option> expansion
15469 item can be used to double any existing colons. For example, the configuration
15470 of a LOGIN authenticator might contain this setting:
15472 <literallayout class="monospaced">
15473 server_condition = ${if pam{$auth1:${sg{$auth2}{:}{::}}}}
15476 For a PLAIN authenticator you could use:
15478 <literallayout class="monospaced">
15479 server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}}
15482 In some operating systems, PAM authentication can be done only from a process
15483 running as root. Since Exim is running as the Exim user when receiving
15484 messages, this means that PAM cannot be used directly in those systems.
15485 A patched version of the <emphasis>pam_unix</emphasis> module that comes with the
15486 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>.
15487 The patched module allows one special uid/gid combination, in addition to root,
15488 to authenticate. If you build the patched module to allow the Exim user and
15489 group, PAM can then be used from an Exim authenticator.
15491 </listitem></varlistentry>
15493 <term><emphasis role="bold">pwcheck {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15496 <indexterm role="concept">
15497 <primary><emphasis>pwcheck</emphasis> daemon</primary>
15499 <indexterm role="concept">
15500 <primary>Cyrus</primary>
15502 <indexterm role="concept">
15503 <primary>expansion</primary>
15504 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
15506 <indexterm role="concept">
15507 <primary><option>pwcheck</option> expansion condition</primary>
15509 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
15510 This is one way of making it possible for passwords to be checked by a process
15511 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
15512 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
15515 The pwcheck support is not included in Exim by default. You need to specify
15516 the location of the pwcheck daemon’s socket in <filename>Local/Makefile</filename> before
15517 building Exim. For example:
15519 <literallayout class="monospaced">
15520 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
15523 You do not need to install the full Cyrus software suite in order to use
15524 the pwcheck daemon. You can compile and install just the daemon alone
15525 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
15526 access to the <filename>/var/pwcheck</filename> directory.
15529 The <option>pwcheck</option> condition takes one argument, which must be the user name and
15530 password, separated by a colon. For example, in a LOGIN authenticator
15531 configuration, you might have this:
15533 <literallayout class="monospaced">
15534 server_condition = ${if pwcheck{$auth1:$auth2}}
15536 <para revisionflag="changed">
15537 Again, for a PLAIN authenticator configuration, this would be:
15539 <literallayout class="monospaced" revisionflag="changed">
15540 server_condition = ${if pwcheck{$auth2:$auth3}}
15542 </listitem></varlistentry>
15544 <term><emphasis role="bold">queue_running</emphasis></term>
15547 <indexterm role="concept">
15548 <primary>queue runner</primary>
15549 <secondary>detecting when delivering from</secondary>
15551 <indexterm role="concept">
15552 <primary>expansion</primary>
15553 <secondary>queue runner test</secondary>
15555 <indexterm role="concept">
15556 <primary><option>queue_running</option> expansion condition</primary>
15558 This condition, which has no data, is true during delivery attempts that are
15559 initiated by queue runner processes, and false otherwise.
15561 </listitem></varlistentry>
15563 <term><emphasis role="bold">radius {</emphasis><<emphasis>authentication string</emphasis>><emphasis role="bold">}</emphasis></term>
15566 <indexterm role="concept">
15567 <primary>Radius</primary>
15569 <indexterm role="concept">
15570 <primary>expansion</primary>
15571 <secondary>Radius authentication</secondary>
15573 <indexterm role="concept">
15574 <primary><option>radius</option> expansion condition</primary>
15576 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
15577 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
15578 the Radius client configuration file in order to build Exim with Radius
15582 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
15583 library, using the original API. If you are using release 0.4.0 or later of
15584 this library, you need to set
15586 <literallayout class="monospaced">
15587 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
15590 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
15591 <option>libradius</option> library that comes with FreeBSD. To do this, set
15593 <literallayout class="monospaced">
15594 RADIUS_LIB_TYPE=RADLIB
15597 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
15598 You may also have to supply a suitable setting in EXTRALIBS so that the
15599 Radius library can be found when Exim is linked.
15602 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
15603 Radius client library, which calls the Radius server. The condition is true if
15604 the authentication is successful. For example:
15606 <literallayout class="monospaced">
15607 server_condition = ${if radius{<arguments>}}
15609 </listitem></varlistentry>
15611 <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>
15614 <indexterm role="concept">
15615 <primary><emphasis>saslauthd</emphasis> daemon</primary>
15617 <indexterm role="concept">
15618 <primary>Cyrus</primary>
15620 <indexterm role="concept">
15621 <primary>expansion</primary>
15622 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
15624 <indexterm role="concept">
15625 <primary><option>saslauthd</option> expansion condition</primary>
15627 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
15628 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
15629 Using this daemon is one way of making it possible for passwords to be checked
15630 by a process that is not running as root.
15633 The saslauthd support is not included in Exim by default. You need to specify
15634 the location of the saslauthd daemon’s socket in <filename>Local/Makefile</filename> before
15635 building Exim. For example:
15637 <literallayout class="monospaced">
15638 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
15641 You do not need to install the full Cyrus software suite in order to use
15642 the saslauthd daemon. You can compile and install just the daemon alone
15643 from the Cyrus SASL library.
15646 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
15647 two are mandatory. For example:
15649 <literallayout class="monospaced">
15650 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
15653 The service and the realm are optional (which is why the arguments are enclosed
15654 in their own set of braces). For details of the meaning of the service and
15655 realm, and how to run the daemon, consult the Cyrus documentation.
15657 </listitem></varlistentry>
15660 <section id="SECID84">
15661 <title>Combining expansion conditions</title>
15663 <indexterm role="concept">
15664 <primary>expansion</primary>
15665 <secondary>combining conditions</secondary>
15667 Several conditions can be tested at once by combining them using the <option>and</option>
15668 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
15669 conditions on their own, and precede their lists of sub-conditions. Each
15670 sub-condition must be enclosed in braces within the overall braces that contain
15671 the list. No repetition of <option>if</option> is used.
15675 <term><emphasis role="bold">or {{</emphasis><<emphasis>cond1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>cond2</emphasis>><emphasis role="bold">}...}</emphasis></term>
15678 <indexterm role="concept">
15679 <primary><quote>or</quote> expansion condition</primary>
15681 <indexterm role="concept">
15682 <primary>expansion</primary>
15683 <secondary><quote>or</quote> of conditions</secondary>
15685 The sub-conditions are evaluated from left to right. The condition is true if
15686 any one of the sub-conditions is true.
15689 <literallayout class="monospaced">
15690 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
15693 When a true sub-condition is found, the following ones are parsed but not
15694 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
15695 numeric variables afterwards are taken from the first one that succeeds.
15697 </listitem></varlistentry>
15699 <term><emphasis role="bold">and {{</emphasis><<emphasis>cond1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>cond2</emphasis>><emphasis role="bold">}...}</emphasis></term>
15702 <indexterm role="concept">
15703 <primary><quote>and</quote> expansion condition</primary>
15705 <indexterm role="concept">
15706 <primary>expansion</primary>
15707 <secondary><quote>and</quote> of conditions</secondary>
15709 The sub-conditions are evaluated from left to right. The condition is true if
15710 all of the sub-conditions are true. If there are several <quote>match</quote>
15711 sub-conditions, the values of the numeric variables afterwards are taken from
15712 the last one. When a false sub-condition is found, the following ones are
15713 parsed but not evaluated.
15715 </listitem></varlistentry>
15718 <indexterm role="concept" startref="IIDexpcond" class="endofrange"/>
15721 <section id="SECTexpvar">
15722 <title>Expansion variables</title>
15724 <indexterm role="concept">
15725 <primary>expansion</primary>
15726 <secondary>variables, list of</secondary>
15728 This section contains an alphabetical list of all the expansion variables. Some
15729 of them are available only when Exim is compiled with specific options such as
15730 support for TLS or the content scanning extension.
15734 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
15737 <indexterm role="concept">
15738 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
15740 When a <option>match</option> expansion condition succeeds, these variables contain the
15741 captured substrings identified by the regular expression during subsequent
15742 processing of the success string of the containing <option>if</option> expansion item.
15743 However, they do not retain their values afterwards; in fact, their previous
15744 values are restored at the end of processing an <option>if</option> item. The numerical
15745 variables may also be set externally by some other matching process which
15746 precedes the expansion of the string. For example, the commands available in
15747 Exim filter files include an <option>if</option> command with its own regular expression
15748 matching condition.
15750 </listitem></varlistentry>
15752 <term><varname>$acl_c...</varname></term>
15755 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
15756 can be given any name that starts with <varname>$acl_c</varname> and is at least six characters
15757 long, but the sixth character must be either a digit or an underscore. For
15758 example: <varname>$acl_c5</varname>, <varname>$acl_c_mycount</varname>. The values of the <varname>$acl_c...</varname>
15759 variables persist throughout the lifetime of an SMTP connection. They can be
15760 used to pass information between ACLs and between different invocations of the
15761 same ACL. When a message is received, the values of these variables are saved
15762 with the message, and can be accessed by filters, routers, and transports
15763 during subsequent delivery.
15765 </listitem></varlistentry>
15767 <term><varname>$acl_m...</varname></term>
15770 These variables are like the <varname>$acl_c...</varname> variables, except that their values
15771 are reset after a message has been received. Thus, if several messages are
15772 received in one SMTP connection, <varname>$acl_m...</varname> values are not passed on from one
15773 message to the next, as <varname>$acl_c...</varname> values are. The <varname>$acl_m...</varname> variables are
15774 also reset by MAIL, RSET, EHLO, HELO, and after starting a TLS session. When a
15775 message is received, the values of these variables are saved with the message,
15776 and can be accessed by filters, routers, and transports during subsequent
15779 </listitem></varlistentry>
15781 <term><varname>$acl_verify_message</varname></term>
15784 <indexterm role="variable">
15785 <primary><varname>$acl_verify_message</varname></primary>
15787 After an address verification has failed, this variable contains the failure
15788 message. It retains its value for use in subsequent modifiers. The message can
15789 be preserved by coding like this:
15791 <literallayout class="monospaced">
15792 warn !verify = sender
15793 set acl_m0 = $acl_verify_message
15796 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
15797 <option>log_message</option> modifiers, to include information about the verification
15800 </listitem></varlistentry>
15802 <term><varname>$address_data</varname></term>
15805 <indexterm role="variable">
15806 <primary><varname>$address_data</varname></primary>
15808 This variable is set by means of the <option>address_data</option> option in routers. The
15809 value then remains with the address while it is processed by subsequent routers
15810 and eventually a transport. If the transport is handling multiple addresses,
15811 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
15812 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
15816 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
15817 a recipient address, the final value is still in the variable for subsequent
15818 conditions and modifiers of the ACL statement. If routing the address caused it
15819 to be redirected to just one address, the child address is also routed as part
15820 of the verification, and in this case the final value of <varname>$address_data</varname> is
15821 from the child’s routing.
15824 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
15825 sender address, the final value is also preserved, but this time in
15826 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
15830 In both cases (recipient and sender verification), the value does not persist
15831 after the end of the current ACL statement. If you want to preserve
15832 these values for longer, you can save them in ACL variables.
15834 </listitem></varlistentry>
15836 <term><varname>$address_file</varname></term>
15839 <indexterm role="variable">
15840 <primary><varname>$address_file</varname></primary>
15842 When, as a result of aliasing, forwarding, or filtering, a message is directed
15843 to a specific file, this variable holds the name of the file when the transport
15844 is running. At other times, the variable is empty. For example, using the
15845 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
15847 <literallayout class="monospaced">
15848 /home/r2d2/savemail
15851 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
15852 contains the text string <literal>/home/r2d2/savemail</literal>.
15853 <indexterm role="concept">
15854 <primary>Sieve filter</primary>
15855 <secondary>value of <varname>$address_file</varname></secondary>
15857 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
15858 then up to the transport configuration to generate an appropriate absolute path
15859 to the relevant file.
15861 </listitem></varlistentry>
15863 <term><varname>$address_pipe</varname></term>
15866 <indexterm role="variable">
15867 <primary><varname>$address_pipe</varname></primary>
15869 When, as a result of aliasing or forwarding, a message is directed to a pipe,
15870 this variable holds the pipe command when the transport is running.
15872 </listitem></varlistentry>
15874 <term><varname>$auth1</varname> – <varname>$auth3</varname></term>
15877 <indexterm role="variable">
15878 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
15880 These variables are used in SMTP authenticators (see chapters
15881 <xref linkend="CHAPplaintext"/>–<xref linkend="CHAPspa"/>). Elsewhere, they are empty.
15883 </listitem></varlistentry>
15885 <term><varname>$authenticated_id</varname></term>
15888 <indexterm role="concept">
15889 <primary>authentication</primary>
15890 <secondary>id</secondary>
15892 <indexterm role="variable">
15893 <primary><varname>$authenticated_id</varname></primary>
15895 When a server successfully authenticates a client it may be configured to
15896 preserve some of the authentication information in the variable
15897 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
15898 user/password authenticator configuration might preserve the user name for use
15899 in the routers. Note that this is not the same information that is saved in
15900 <varname>$sender_host_authenticated</varname>.
15901 When a message is submitted locally (that is, not over a TCP connection)
15902 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
15903 process. However, a trusted user can override this by means of the <option>-oMai</option>
15904 command line option.
15906 </listitem></varlistentry>
15908 <term><varname>$authenticated_sender</varname></term>
15911 <indexterm role="concept">
15912 <primary>sender</primary>
15913 <secondary>authenticated</secondary>
15915 <indexterm role="concept">
15916 <primary>authentication</primary>
15917 <secondary>sender</secondary>
15919 <indexterm role="concept">
15920 <primary>AUTH</primary>
15921 <secondary>on MAIL command</secondary>
15923 <indexterm role="variable">
15924 <primary><varname>$authenticated_sender</varname></primary>
15926 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
15927 SMTP MAIL command if it believes the sender is sufficiently trusted, as
15928 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
15929 <quote><></quote>, it is set as the authenticated sender of the message, and the value is
15930 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
15931 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
15934 <indexterm role="variable">
15935 <primary><varname>$qualify_domain</varname></primary>
15937 When a message is submitted locally (that is, not over a TCP connection), the
15938 value of <varname>$authenticated_sender</varname> is an address constructed from the login
15939 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
15940 can override this by means of the <option>-oMas</option> command line option.
15942 </listitem></varlistentry>
15944 <term><varname>$authentication_failed</varname></term>
15947 <indexterm role="concept">
15948 <primary>authentication</primary>
15949 <secondary>failure</secondary>
15951 <indexterm role="variable">
15952 <primary><varname>$authentication_failed</varname></primary>
15954 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
15955 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
15956 possible to distinguish between <quote>did not try to authenticate</quote>
15957 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
15958 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
15959 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>). Failure includes any
15960 negative response to an AUTH command, including (for example) an attempt to use
15961 an undefined mechanism.
15963 </listitem></varlistentry>
15965 <term><varname>$body_linecount</varname></term>
15968 <indexterm role="concept">
15969 <primary>message body</primary>
15970 <secondary>line count</secondary>
15972 <indexterm role="concept">
15973 <primary>body of message</primary>
15974 <secondary>line count</secondary>
15976 <indexterm role="variable">
15977 <primary><varname>$body_linecount</varname></primary>
15979 When a message is being received or delivered, this variable contains the
15980 number of lines in the message’s body. See also <varname>$message_linecount</varname>.
15982 </listitem></varlistentry>
15984 <term><varname>$body_zerocount</varname></term>
15987 <indexterm role="concept">
15988 <primary>message body</primary>
15989 <secondary>binary zero count</secondary>
15991 <indexterm role="concept">
15992 <primary>body of message</primary>
15993 <secondary>binary zero count</secondary>
15995 <indexterm role="concept">
15996 <primary>binary zero</primary>
15997 <secondary>in message body</secondary>
15999 <indexterm role="variable">
16000 <primary><varname>$body_zerocount</varname></primary>
16002 When a message is being received or delivered, this variable contains the
16003 number of binary zero bytes in the message’s body.
16005 </listitem></varlistentry>
16007 <term><varname>$bounce_recipient</varname></term>
16010 <indexterm role="variable">
16011 <primary><varname>$bounce_recipient</varname></primary>
16013 This is set to the recipient address of a bounce message while Exim is creating
16014 it. It is useful if a customized bounce message text file is in use (see
16015 chapter <xref linkend="CHAPemsgcust"/>).
16017 </listitem></varlistentry>
16019 <term><varname>$bounce_return_size_limit</varname></term>
16022 <indexterm role="variable">
16023 <primary><varname>$bounce_return_size_limit</varname></primary>
16025 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
16026 up to a multiple of 1000. It is useful when a customized error message text
16027 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
16029 </listitem></varlistentry>
16031 <term><varname>$caller_gid</varname></term>
16034 <indexterm role="concept">
16035 <primary>gid (group id)</primary>
16036 <secondary>caller</secondary>
16038 <indexterm role="variable">
16039 <primary><varname>$caller_gid</varname></primary>
16041 The real group id under which the process that called Exim was running. This is
16042 not the same as the group id of the originator of a message (see
16043 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
16044 incarnation normally contains the Exim gid.
16046 </listitem></varlistentry>
16048 <term><varname>$caller_uid</varname></term>
16051 <indexterm role="concept">
16052 <primary>uid (user id)</primary>
16053 <secondary>caller</secondary>
16055 <indexterm role="variable">
16056 <primary><varname>$caller_uid</varname></primary>
16058 The real user id under which the process that called Exim was running. This is
16059 not the same as the user id of the originator of a message (see
16060 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
16061 incarnation normally contains the Exim uid.
16063 </listitem></varlistentry>
16065 <term><varname>$compile_date</varname></term>
16068 <indexterm role="variable">
16069 <primary><varname>$compile_date</varname></primary>
16071 The date on which the Exim binary was compiled.
16073 </listitem></varlistentry>
16075 <term><varname>$compile_number</varname></term>
16078 <indexterm role="variable">
16079 <primary><varname>$compile_number</varname></primary>
16081 The building process for Exim keeps a count of the number
16082 of times it has been compiled. This serves to distinguish different
16083 compilations of the same version of the program.
16085 </listitem></varlistentry>
16087 <term><varname>$demime_errorlevel</varname></term>
16090 <indexterm role="variable">
16091 <primary><varname>$demime_errorlevel</varname></primary>
16093 This variable is available when Exim is compiled with
16094 the content-scanning extension and the obsolete <option>demime</option> condition. For
16095 details, see section <xref linkend="SECTdemimecond"/>.
16097 </listitem></varlistentry>
16099 <term><varname>$demime_reason</varname></term>
16102 <indexterm role="variable">
16103 <primary><varname>$demime_reason</varname></primary>
16105 This variable is available when Exim is compiled with the
16106 content-scanning extension and the obsolete <option>demime</option> condition. For details,
16107 see section <xref linkend="SECTdemimecond"/>.
16109 </listitem></varlistentry>
16111 <term><varname>$dnslist_domain</varname></term>
16112 <term><varname>$dnslist_matched</varname></term>
16113 <term><varname>$dnslist_text</varname></term>
16114 <term><varname>$dnslist_value</varname></term>
16117 <indexterm role="variable">
16118 <primary><varname>$dnslist_domain</varname></primary>
16120 <indexterm role="variable">
16121 <primary><varname>$dnslist_matched</varname></primary>
16123 <indexterm role="variable">
16124 <primary><varname>$dnslist_text</varname></primary>
16126 <indexterm role="variable">
16127 <primary><varname>$dnslist_value</varname></primary>
16129 <indexterm role="concept">
16130 <primary>black list (DNS)</primary>
16132 When a DNS (black) list lookup succeeds, these variables are set to contain
16133 the following data from the lookup: the list’s domain name, the key that was
16134 looked up, the contents of any associated TXT record, and the value from the
16135 main A record. See section <xref linkend="SECID204"/> for more details.
16137 </listitem></varlistentry>
16139 <term><varname>$domain</varname></term>
16142 <indexterm role="variable">
16143 <primary><varname>$domain</varname></primary>
16145 When an address is being routed, or delivered on its own, this variable
16146 contains the domain. Uppercase letters in the domain are converted into lower
16147 case for <varname>$domain</varname>.
16150 Global address rewriting happens when a message is received, so the value of
16151 <varname>$domain</varname> during routing and delivery is the value after rewriting. <varname>$domain</varname>
16152 is set during user filtering, but not during system filtering, because a
16153 message may have many recipients and the system filter is called just once.
16156 When more than one address is being delivered at once (for example, several
16157 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
16158 have the same domain. Transports can be restricted to handling only one domain
16159 at a time if the value of <varname>$domain</varname> is required at transport time – this is
16160 the default for local transports. For further details of the environment in
16161 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
16164 <indexterm role="option">
16165 <primary><option>delay_warning_condition</option></primary>
16167 At the end of a delivery, if all deferred addresses have the same domain, it is
16168 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
16171 The <varname>$domain</varname> variable is also used in some other circumstances:
16176 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
16177 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
16178 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
16179 normally set during the running of the MAIL ACL. However, if the sender address
16180 is verified with a callout during the MAIL ACL, the sender domain is placed in
16181 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
16182 the <command>smtp</command> transport.
16187 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
16188 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
16189 it can be used in the expansion of the replacement address, for example, to
16190 rewrite domains by file lookup.
16195 With one important exception, whenever a domain list is being scanned,
16196 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
16197 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
16198 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
16199 that, in a RCPT ACL, the sender domain list can be dependent on the
16200 recipient domain (which is what is in <varname>$domain</varname> at this time).
16205 <indexterm role="concept">
16206 <primary>ETRN</primary>
16207 <secondary>value of <varname>$domain</varname></secondary>
16209 <indexterm role="option">
16210 <primary><option>smtp_etrn_command</option></primary>
16212 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
16213 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
16217 </listitem></varlistentry>
16219 <term><varname>$domain_data</varname></term>
16222 <indexterm role="variable">
16223 <primary><varname>$domain_data</varname></primary>
16225 When the <option>domains</option> option on a router matches a domain by
16226 means of a lookup, the data read by the lookup is available during the running
16227 of the router as <varname>$domain_data</varname>. In addition, if the driver routes the
16228 address to a transport, the value is available in that transport. If the
16229 transport is handling multiple addresses, the value from the first address is
16233 <varname>$domain_data</varname> is also set when the <option>domains</option> condition in an ACL matches a
16234 domain by means of a lookup. The data read by the lookup is available during
16235 the rest of the ACL statement. In all other situations, this variable expands
16238 </listitem></varlistentry>
16240 <term><varname>$exim_gid</varname></term>
16243 <indexterm role="variable">
16244 <primary><varname>$exim_gid</varname></primary>
16246 This variable contains the numerical value of the Exim group id.
16248 </listitem></varlistentry>
16250 <term><varname>$exim_path</varname></term>
16253 <indexterm role="variable">
16254 <primary><varname>$exim_path</varname></primary>
16256 This variable contains the path to the Exim binary.
16258 </listitem></varlistentry>
16260 <term><varname>$exim_uid</varname></term>
16263 <indexterm role="variable">
16264 <primary><varname>$exim_uid</varname></primary>
16266 This variable contains the numerical value of the Exim user id.
16268 </listitem></varlistentry>
16270 <term><varname>$found_extension</varname></term>
16273 <indexterm role="variable">
16274 <primary><varname>$found_extension</varname></primary>
16276 This variable is available when Exim is compiled with the
16277 content-scanning extension and the obsolete <option>demime</option> condition. For details,
16278 see section <xref linkend="SECTdemimecond"/>.
16280 </listitem></varlistentry>
16282 <term><varname>$header_</varname><<emphasis>name</emphasis>></term>
16285 This is not strictly an expansion variable. It is expansion syntax for
16286 inserting the message header line with the given name. Note that the name must
16287 be terminated by colon or white space, because it may contain a wide variety of
16288 characters. Note also that braces must <emphasis>not</emphasis> be used.
16290 </listitem></varlistentry>
16292 <term><varname>$home</varname></term>
16295 <indexterm role="variable">
16296 <primary><varname>$home</varname></primary>
16298 When the <option>check_local_user</option> option is set for a router, the user’s home
16299 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
16300 means it is set during the running of users’ filter files. A router may also
16301 explicitly set a home directory for use by a transport; this can be overridden
16302 by a setting on the transport itself.
16305 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
16306 of the environment variable HOME.
16308 </listitem></varlistentry>
16310 <term><varname>$host</varname></term>
16313 <indexterm role="variable">
16314 <primary><varname>$host</varname></primary>
16316 If a router assigns an address to a transport (any transport), and passes a
16317 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
16318 to run is the name of the first host on the list. Note that this applies both
16319 to local and remote transports.
16322 <indexterm role="concept">
16323 <primary>transport</primary>
16324 <secondary>filter</secondary>
16326 <indexterm role="concept">
16327 <primary>filter</primary>
16328 <secondary>transport filter</secondary>
16330 For the <command>smtp</command> transport, if there is more than one host, the value of
16331 <varname>$host</varname> changes as the transport works its way through the list. In
16332 particular, when the <command>smtp</command> transport is expanding its options for encryption
16333 using TLS, or for specifying a transport filter (see chapter
16334 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
16338 When used in the client part of an authenticator configuration (see chapter
16339 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
16340 client is connected.
16342 </listitem></varlistentry>
16344 <term><varname>$host_address</varname></term>
16347 <indexterm role="variable">
16348 <primary><varname>$host_address</varname></primary>
16350 This variable is set to the remote host’s IP address whenever <varname>$host</varname> is set
16351 for a remote connection. It is also set to the IP address that is being checked
16352 when the <option>ignore_target_hosts</option> option is being processed.
16354 </listitem></varlistentry>
16356 <term><varname>$host_data</varname></term>
16359 <indexterm role="variable">
16360 <primary><varname>$host_data</varname></primary>
16362 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
16363 result of the lookup is made available in the <varname>$host_data</varname> variable. This
16364 allows you, for example, to do things like this:
16366 <literallayout class="monospaced">
16367 deny hosts = net-lsearch;/some/file
16368 message = $host_data
16370 </listitem></varlistentry>
16372 <term><varname>$host_lookup_deferred</varname></term>
16375 <indexterm role="concept">
16376 <primary>host name</primary>
16377 <secondary>lookup, failure of</secondary>
16379 <indexterm role="variable">
16380 <primary><varname>$host_lookup_deferred</varname></primary>
16382 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
16383 message comes from a remote host and there is an attempt to look up the host’s
16384 name from its IP address, and the attempt is not successful, one of these
16385 variables is set to <quote>1</quote>.
16390 If the lookup receives a definite negative response (for example, a DNS lookup
16391 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
16396 If there is any kind of problem during the lookup, such that Exim cannot
16397 tell whether or not the host name is defined (for example, a timeout for a DNS
16398 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
16403 Looking up a host’s name from its IP address consists of more than just a
16404 single reverse lookup. Exim checks that a forward lookup of at least one of the
16405 names it receives from a reverse lookup yields the original IP address. If this
16406 is not the case, Exim does not accept the looked up name(s), and
16407 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
16408 IP address (for example, the existence of a PTR record in the DNS) is not
16409 sufficient on its own for the success of a host name lookup. If the reverse
16410 lookup succeeds, but there is a lookup problem such as a timeout when checking
16411 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
16412 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
16414 </listitem></varlistentry>
16416 <term><varname>$host_lookup_failed</varname></term>
16419 <indexterm role="variable">
16420 <primary><varname>$host_lookup_failed</varname></primary>
16422 See <varname>$host_lookup_deferred</varname>.
16424 </listitem></varlistentry>
16426 <term><varname>$inode</varname></term>
16429 <indexterm role="variable">
16430 <primary><varname>$inode</varname></primary>
16432 The only time this variable is set is while expanding the <option>directory_file</option>
16433 option in the <command>appendfile</command> transport. The variable contains the inode number
16434 of the temporary file which is about to be renamed. It can be used to construct
16435 a unique name for the file.
16437 </listitem></varlistentry>
16439 <term><varname>$interface_address</varname></term>
16442 <indexterm role="variable">
16443 <primary><varname>$interface_address</varname></primary>
16445 This is an obsolete name for <varname>$received_ip_address</varname>.
16447 </listitem></varlistentry>
16449 <term><varname>$interface_port</varname></term>
16452 <indexterm role="variable">
16453 <primary><varname>$interface_port</varname></primary>
16455 This is an obsolete name for <varname>$received_port</varname>.
16457 </listitem></varlistentry>
16459 <term><varname>$item</varname></term>
16462 <indexterm role="variable">
16463 <primary><varname>$item</varname></primary>
16465 This variable is used during the expansion of <emphasis role="bold">forall</emphasis> and <emphasis role="bold">forany</emphasis>
16466 conditions (see section <xref linkend="SECTexpcond"/>), and <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and
16467 <emphasis role="bold">reduce</emphasis> items (see section <xref linkend="SECTexpcond"/>). In other circumstances, it is
16470 </listitem></varlistentry>
16472 <term><varname>$ldap_dn</varname></term>
16475 <indexterm role="variable">
16476 <primary><varname>$ldap_dn</varname></primary>
16478 This variable, which is available only when Exim is compiled with LDAP support,
16479 contains the DN from the last entry in the most recently successful LDAP
16482 </listitem></varlistentry>
16484 <term><varname>$load_average</varname></term>
16487 <indexterm role="variable">
16488 <primary><varname>$load_average</varname></primary>
16490 This variable contains the system load average, multiplied by 1000 so that it
16491 is an integer. For example, if the load average is 0.21, the value of the
16492 variable is 210. The value is recomputed every time the variable is referenced.
16494 </listitem></varlistentry>
16496 <term><varname>$local_part</varname></term>
16499 <indexterm role="variable">
16500 <primary><varname>$local_part</varname></primary>
16502 When an address is being routed, or delivered on its own, this
16503 variable contains the local part. When a number of addresses are being
16504 delivered together (for example, multiple RCPT commands in an SMTP
16505 session), <varname>$local_part</varname> is not set.
16508 Global address rewriting happens when a message is received, so the value of
16509 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
16510 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
16511 because a message may have many recipients and the system filter is called just
16515 <indexterm role="variable">
16516 <primary><varname>$local_part_prefix</varname></primary>
16518 <indexterm role="variable">
16519 <primary><varname>$local_part_suffix</varname></primary>
16521 If a local part prefix or suffix has been recognized, it is not included in the
16522 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
16523 any prefix or suffix are in <varname>$local_part_prefix</varname> and
16524 <varname>$local_part_suffix</varname>, respectively.
16527 When a message is being delivered to a file, pipe, or autoreply transport as a
16528 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
16529 the parent address, not to the file name or command (see <varname>$address_file</varname> and
16530 <varname>$address_pipe</varname>).
16533 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
16534 local part of the recipient address.
16537 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
16538 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
16539 it can be used in the expansion of the replacement address, for example.
16542 In all cases, all quoting is removed from the local part. For example, for both
16545 <literallayout class="monospaced">
16546 "abc:xyz"@test.example
16547 abc\:xyz@test.example
16550 the value of <varname>$local_part</varname> is
16552 <literallayout class="monospaced">
16556 If you use <varname>$local_part</varname> to create another address, you should always wrap it
16557 inside a quoting operator. For example, in a <command>redirect</command> router you could
16560 <literallayout class="monospaced">
16561 data = ${quote_local_part:$local_part}@new.domain.example
16564 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
16565 to process local parts in a case-dependent manner in a router, you can set the
16566 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
16568 </listitem></varlistentry>
16570 <term><varname>$local_part_data</varname></term>
16573 <indexterm role="variable">
16574 <primary><varname>$local_part_data</varname></primary>
16576 When the <option>local_parts</option> option on a router matches a local part by means of a
16577 lookup, the data read by the lookup is available during the running of the
16578 router as <varname>$local_part_data</varname>. In addition, if the driver routes the address
16579 to a transport, the value is available in that transport. If the transport is
16580 handling multiple addresses, the value from the first address is used.
16583 <varname>$local_part_data</varname> is also set when the <option>local_parts</option> condition in an ACL
16584 matches a local part by means of a lookup. The data read by the lookup is
16585 available during the rest of the ACL statement. In all other situations, this
16586 variable expands to nothing.
16588 </listitem></varlistentry>
16590 <term><varname>$local_part_prefix</varname></term>
16593 <indexterm role="variable">
16594 <primary><varname>$local_part_prefix</varname></primary>
16596 When an address is being routed or delivered, and a
16597 specific prefix for the local part was recognized, it is available in this
16598 variable, having been removed from <varname>$local_part</varname>.
16600 </listitem></varlistentry>
16602 <term><varname>$local_part_suffix</varname></term>
16605 <indexterm role="variable">
16606 <primary><varname>$local_part_suffix</varname></primary>
16608 When an address is being routed or delivered, and a
16609 specific suffix for the local part was recognized, it is available in this
16610 variable, having been removed from <varname>$local_part</varname>.
16612 </listitem></varlistentry>
16614 <term><varname>$local_scan_data</varname></term>
16617 <indexterm role="variable">
16618 <primary><varname>$local_scan_data</varname></primary>
16620 This variable contains the text returned by the <function>local_scan()</function> function when
16621 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
16623 </listitem></varlistentry>
16625 <term><varname>$local_user_gid</varname></term>
16628 <indexterm role="variable">
16629 <primary><varname>$local_user_gid</varname></primary>
16631 See <varname>$local_user_uid</varname>.
16633 </listitem></varlistentry>
16635 <term><varname>$local_user_uid</varname></term>
16638 <indexterm role="variable">
16639 <primary><varname>$local_user_uid</varname></primary>
16641 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
16642 <option>check_local_user</option> router precondition succeeds. This means that their values
16643 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
16644 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
16645 router-specific expansions. At all other times, the values in these variables
16646 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
16648 </listitem></varlistentry>
16650 <term><varname>$localhost_number</varname></term>
16653 <indexterm role="variable">
16654 <primary><varname>$localhost_number</varname></primary>
16656 This contains the expanded value of the
16657 <option>localhost_number</option> option. The expansion happens after the main options have
16660 </listitem></varlistentry>
16662 <term><varname>$log_inodes</varname></term>
16665 <indexterm role="variable">
16666 <primary><varname>$log_inodes</varname></primary>
16668 The number of free inodes in the disk partition where Exim’s
16669 log files are being written. The value is recalculated whenever the variable is
16670 referenced. If the relevant file system does not have the concept of inodes,
16671 the value of is -1. See also the <option>check_log_inodes</option> option.
16673 </listitem></varlistentry>
16675 <term><varname>$log_space</varname></term>
16678 <indexterm role="variable">
16679 <primary><varname>$log_space</varname></primary>
16681 The amount of free space (as a number of kilobytes) in the disk
16682 partition where Exim’s log files are being written. The value is recalculated
16683 whenever the variable is referenced. If the operating system does not have the
16684 ability to find the amount of free space (only true for experimental systems),
16685 the space value is -1. See also the <option>check_log_space</option> option.
16687 </listitem></varlistentry>
16689 <term><varname>$mailstore_basename</varname></term>
16692 <indexterm role="variable">
16693 <primary><varname>$mailstore_basename</varname></primary>
16695 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
16696 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
16697 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
16698 contains the basename of the files that are being written, that is, the name
16699 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
16702 </listitem></varlistentry>
16704 <term><varname>$malware_name</varname></term>
16707 <indexterm role="variable">
16708 <primary><varname>$malware_name</varname></primary>
16710 This variable is available when Exim is compiled with the
16711 content-scanning extension. It is set to the name of the virus that was found
16712 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
16714 </listitem></varlistentry>
16716 <term><varname>$max_received_linelength</varname></term>
16719 <indexterm role="variable">
16720 <primary><varname>$max_received_linelength</varname></primary>
16722 <indexterm role="concept">
16723 <primary>maximum</primary>
16724 <secondary>line length</secondary>
16726 <indexterm role="concept">
16727 <primary>line length</primary>
16728 <secondary>maximum</secondary>
16730 This variable contains the number of bytes in the longest line that was
16731 received as part of the message, not counting the line termination
16734 </listitem></varlistentry>
16736 <term><varname>$message_age</varname></term>
16739 <indexterm role="concept">
16740 <primary>message</primary>
16741 <secondary>age of</secondary>
16743 <indexterm role="variable">
16744 <primary><varname>$message_age</varname></primary>
16746 This variable is set at the start of a delivery attempt to contain the number
16747 of seconds since the message was received. It does not change during a single
16750 </listitem></varlistentry>
16752 <term><varname>$message_body</varname></term>
16755 <indexterm role="concept">
16756 <primary>body of message</primary>
16757 <secondary>expansion variable</secondary>
16759 <indexterm role="concept">
16760 <primary>message body</primary>
16761 <secondary>in expansion</secondary>
16763 <indexterm role="concept">
16764 <primary>binary zero</primary>
16765 <secondary>in message body</secondary>
16767 <indexterm role="variable">
16768 <primary><varname>$message_body</varname></primary>
16770 <indexterm role="option">
16771 <primary><option>message_body_visible</option></primary>
16773 This variable contains the initial portion of a message’s body while it is
16774 being delivered, and is intended mainly for use in filter files. The maximum
16775 number of characters of the body that are put into the variable is set by the
16776 <option>message_body_visible</option> configuration option; the default is 500.
16779 <indexterm role="option">
16780 <primary><option>message_body_newlines</option></primary>
16782 By default, newlines are converted into spaces in <varname>$message_body</varname>, to make it
16783 easier to search for phrases that might be split over a line break. However,
16784 this can be disabled by setting <option>message_body_newlines</option> to be true. Binary
16785 zeros are always converted into spaces.
16787 </listitem></varlistentry>
16789 <term><varname>$message_body_end</varname></term>
16792 <indexterm role="concept">
16793 <primary>body of message</primary>
16794 <secondary>expansion variable</secondary>
16796 <indexterm role="concept">
16797 <primary>message body</primary>
16798 <secondary>in expansion</secondary>
16800 <indexterm role="variable">
16801 <primary><varname>$message_body_end</varname></primary>
16803 This variable contains the final portion of a message’s
16804 body while it is being delivered. The format and maximum size are as for
16805 <varname>$message_body</varname>.
16807 </listitem></varlistentry>
16809 <term><varname>$message_body_size</varname></term>
16812 <indexterm role="concept">
16813 <primary>body of message</primary>
16814 <secondary>size</secondary>
16816 <indexterm role="concept">
16817 <primary>message body</primary>
16818 <secondary>size</secondary>
16820 <indexterm role="variable">
16821 <primary><varname>$message_body_size</varname></primary>
16823 When a message is being delivered, this variable contains the size of the body
16824 in bytes. The count starts from the character after the blank line that
16825 separates the body from the header. Newlines are included in the count. See
16826 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
16828 </listitem></varlistentry>
16830 <term><varname>$message_exim_id</varname></term>
16833 <indexterm role="variable">
16834 <primary><varname>$message_exim_id</varname></primary>
16836 When a message is being received or delivered, this variable contains the
16837 unique message id that is generated and used by Exim to identify the message.
16838 An id is not created for a message until after its header has been successfully
16839 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
16840 line; it is the local id that Exim assigns to the message, for example:
16841 <literal>1BXTIK-0001yO-VA</literal>.
16843 </listitem></varlistentry>
16845 <term><varname>$message_headers</varname></term>
16848 <indexterm role="variable">
16849 <primary><varname>$message_headers</varname></primary>
16851 This variable contains a concatenation of all the header lines when a message
16852 is being processed, except for lines added by routers or transports. The header
16853 lines are separated by newline characters. Their contents are decoded in the
16854 same way as a header line that is inserted by <option>bheader</option>.
16856 </listitem></varlistentry>
16858 <term><varname>$message_headers_raw</varname></term>
16861 <indexterm role="variable">
16862 <primary><varname>$message_headers_raw</varname></primary>
16864 This variable is like <varname>$message_headers</varname> except that no processing of the
16865 contents of header lines is done.
16867 </listitem></varlistentry>
16869 <term><varname>$message_id</varname></term>
16872 This is an old name for <varname>$message_exim_id</varname>, which is now deprecated.
16874 </listitem></varlistentry>
16876 <term><varname>$message_linecount</varname></term>
16879 <indexterm role="variable">
16880 <primary><varname>$message_linecount</varname></primary>
16882 This variable contains the total number of lines in the header and body of the
16883 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
16884 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
16885 number of lines received. Before delivery happens (that is, before filters,
16886 routers, and transports run) the count is increased to include the
16887 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
16888 lines that are added by ACLs. The blank line that separates the message header
16889 from the body is not counted. Here is an example of the use of this variable in
16892 <literallayout class="monospaced">
16893 deny message = Too many lines in message header
16895 ${if <{250}{${eval:$message_linecount - $body_linecount}}}
16898 In the MAIL and RCPT ACLs, the value is zero because at that stage the
16899 message has not yet been received.
16901 </listitem></varlistentry>
16903 <term><varname>$message_size</varname></term>
16906 <indexterm role="concept">
16907 <primary>size</primary>
16908 <secondary>of message</secondary>
16910 <indexterm role="concept">
16911 <primary>message</primary>
16912 <secondary>size</secondary>
16914 <indexterm role="variable">
16915 <primary><varname>$message_size</varname></primary>
16917 When a message is being processed, this variable contains its size in bytes. In
16918 most cases, the size includes those headers that were received with the
16919 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
16920 deliveries as they are written. However, there is one special case: during the
16921 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
16922 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
16923 precise size of the file that has been written. See also
16924 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
16926 <para revisionflag="changed">
16927 <indexterm role="concept">
16928 <primary>RCPT</primary>
16929 <secondary>value of <varname>$message_size</varname></secondary>
16931 While running a per message ACL (mail/rcpt/predata), <varname>$message_size</varname>
16932 contains the size supplied on the MAIL command, or -1 if no size was given. The
16933 value may not, of course, be truthful.
16935 </listitem></varlistentry>
16937 <term><varname>$mime_</varname><emphasis>xxx</emphasis></term>
16940 A number of variables whose names start with <varname>$mime</varname> are
16941 available when Exim is compiled with the content-scanning extension. For
16942 details, see section <xref linkend="SECTscanmimepart"/>.
16944 </listitem></varlistentry>
16946 <term><varname>$n0</varname> – <varname>$n9</varname></term>
16949 These variables are counters that can be incremented by means
16950 of the <option>add</option> command in filter files.
16952 </listitem></varlistentry>
16954 <term><varname>$original_domain</varname></term>
16957 <indexterm role="variable">
16958 <primary><varname>$domain</varname></primary>
16960 <indexterm role="variable">
16961 <primary><varname>$original_domain</varname></primary>
16963 When a top-level address is being processed for delivery, this contains the
16964 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
16965 generated by an alias, forward, or filter file) is being processed, this
16966 variable contains the domain of the original address (lower cased). This
16967 differs from <varname>$parent_domain</varname> only when there is more than one level of
16968 aliasing or forwarding. When more than one address is being delivered in a
16969 single transport run, <varname>$original_domain</varname> is not set.
16972 If a new address is created by means of a <option>deliver</option> command in a system
16973 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
16974 part <emphasis>system-filter</emphasis> and the default qualify domain.
16976 </listitem></varlistentry>
16978 <term><varname>$original_local_part</varname></term>
16981 <indexterm role="variable">
16982 <primary><varname>$local_part</varname></primary>
16984 <indexterm role="variable">
16985 <primary><varname>$original_local_part</varname></primary>
16987 When a top-level address is being processed for delivery, this contains the
16988 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
16989 local part, because <varname>$original_local_part</varname> always contains the full local
16990 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
16991 filter file) is being processed, this variable contains the full local part of
16992 the original address.
16995 If the router that did the redirection processed the local part
16996 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
16997 This variable differs from <varname>$parent_local_part</varname> only when there is more than
16998 one level of aliasing or forwarding. When more than one address is being
16999 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
17002 If a new address is created by means of a <option>deliver</option> command in a system
17003 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
17004 part <emphasis>system-filter</emphasis> and the default qualify domain.
17006 </listitem></varlistentry>
17008 <term><varname>$originator_gid</varname></term>
17011 <indexterm role="concept">
17012 <primary>gid (group id)</primary>
17013 <secondary>of originating user</secondary>
17015 <indexterm role="concept">
17016 <primary>sender</primary>
17017 <secondary>gid</secondary>
17019 <indexterm role="variable">
17020 <primary><varname>$caller_gid</varname></primary>
17022 <indexterm role="variable">
17023 <primary><varname>$originator_gid</varname></primary>
17025 This variable contains the value of <varname>$caller_gid</varname> that was set when the
17026 message was received. For messages received via the command line, this is the
17027 gid of the sending user. For messages received by SMTP over TCP/IP, this is
17028 normally the gid of the Exim user.
17030 </listitem></varlistentry>
17032 <term><varname>$originator_uid</varname></term>
17035 <indexterm role="concept">
17036 <primary>uid (user id)</primary>
17037 <secondary>of originating user</secondary>
17039 <indexterm role="concept">
17040 <primary>sender</primary>
17041 <secondary>uid</secondary>
17043 <indexterm role="variable">
17044 <primary><varname>$caller_uid</varname></primary>
17046 <indexterm role="variable">
17047 <primary><varname>$originaltor_uid</varname></primary>
17049 The value of <varname>$caller_uid</varname> that was set when the message was received. For
17050 messages received via the command line, this is the uid of the sending user.
17051 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
17054 </listitem></varlistentry>
17056 <term><varname>$parent_domain</varname></term>
17059 <indexterm role="variable">
17060 <primary><varname>$parent_domain</varname></primary>
17062 This variable is similar to <varname>$original_domain</varname> (see
17063 above), except that it refers to the immediately preceding parent address.
17065 </listitem></varlistentry>
17067 <term><varname>$parent_local_part</varname></term>
17070 <indexterm role="variable">
17071 <primary><varname>$parent_local_part</varname></primary>
17073 This variable is similar to <varname>$original_local_part</varname>
17074 (see above), except that it refers to the immediately preceding parent address.
17076 </listitem></varlistentry>
17078 <term><varname>$pid</varname></term>
17081 <indexterm role="concept">
17082 <primary>pid (process id)</primary>
17083 <secondary>of current process</secondary>
17085 <indexterm role="variable">
17086 <primary><varname>$pid</varname></primary>
17088 This variable contains the current process id.
17090 </listitem></varlistentry>
17092 <term><varname>$pipe_addresses</varname></term>
17095 <indexterm role="concept">
17096 <primary>filter</primary>
17097 <secondary>transport filter</secondary>
17099 <indexterm role="concept">
17100 <primary>transport</primary>
17101 <secondary>filter</secondary>
17103 <indexterm role="variable">
17104 <primary><varname>$pipe_addresses</varname></primary>
17106 This is not an expansion variable, but is mentioned here because the string
17107 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
17108 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
17109 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
17110 It cannot be used in general expansion strings, and provokes an <quote>unknown
17111 variable</quote> error if encountered.
17113 </listitem></varlistentry>
17115 <term><varname>$primary_hostname</varname></term>
17118 <indexterm role="variable">
17119 <primary><varname>$primary_hostname</varname></primary>
17121 This variable contains the value set by <option>primary_hostname</option> in the
17122 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
17123 a single-component name, Exim calls <function>gethostbyname()</function> (or
17124 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
17125 qualified host name. See also <varname>$smtp_active_hostname</varname>.
17127 </listitem></varlistentry>
17129 <term><varname>$prvscheck_address</varname></term>
17132 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
17133 which is described in sections <xref linkend="SECTexpansionitems"/> and
17134 <xref linkend="SECTverifyPRVS"/>.
17136 </listitem></varlistentry>
17138 <term><varname>$prvscheck_keynum</varname></term>
17141 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
17142 which is described in sections <xref linkend="SECTexpansionitems"/> and
17143 <xref linkend="SECTverifyPRVS"/>.
17145 </listitem></varlistentry>
17147 <term><varname>$prvscheck_result</varname></term>
17150 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
17151 which is described in sections <xref linkend="SECTexpansionitems"/> and
17152 <xref linkend="SECTverifyPRVS"/>.
17154 </listitem></varlistentry>
17156 <term><varname>$qualify_domain</varname></term>
17159 <indexterm role="variable">
17160 <primary><varname>$qualify_domain</varname></primary>
17162 The value set for the <option>qualify_domain</option> option in the configuration file.
17164 </listitem></varlistentry>
17166 <term><varname>$qualify_recipient</varname></term>
17169 <indexterm role="variable">
17170 <primary><varname>$qualify_recipient</varname></primary>
17172 The value set for the <option>qualify_recipient</option> option in the configuration file,
17173 or if not set, the value of <varname>$qualify_domain</varname>.
17175 </listitem></varlistentry>
17177 <term><varname>$rcpt_count</varname></term>
17180 <indexterm role="variable">
17181 <primary><varname>$rcpt_count</varname></primary>
17183 When a message is being received by SMTP, this variable contains the number of
17184 RCPT commands received for the current message. If this variable is used in a
17185 RCPT ACL, its value includes the current command.
17187 </listitem></varlistentry>
17189 <term><varname>$rcpt_defer_count</varname></term>
17192 <indexterm role="variable">
17193 <primary><varname>$rcpt_defer_count</varname></primary>
17195 <indexterm role="concept">
17196 <primary>4<emphasis>xx</emphasis> responses</primary>
17197 <secondary>count of</secondary>
17199 When a message is being received by SMTP, this variable contains the number of
17200 RCPT commands in the current message that have previously been rejected with a
17201 temporary (4<emphasis>xx</emphasis>) response.
17203 </listitem></varlistentry>
17205 <term><varname>$rcpt_fail_count</varname></term>
17208 <indexterm role="variable">
17209 <primary><varname>$rcpt_fail_count</varname></primary>
17211 When a message is being received by SMTP, this variable contains the number of
17212 RCPT commands in the current message that have previously been rejected with a
17213 permanent (5<emphasis>xx</emphasis>) response.
17215 </listitem></varlistentry>
17217 <term><varname>$received_count</varname></term>
17220 <indexterm role="variable">
17221 <primary><varname>$received_count</varname></primary>
17223 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
17224 including the one added by Exim (so its value is always greater than zero). It
17225 is available in the DATA ACL, the non-SMTP ACL, and while routing and
17228 </listitem></varlistentry>
17230 <term><varname>$received_for</varname></term>
17233 <indexterm role="variable">
17234 <primary><varname>$received_for</varname></primary>
17236 If there is only a single recipient address in an incoming message, this
17237 variable contains that address when the <emphasis>Received:</emphasis> header line is being
17238 built. The value is copied after recipient rewriting has happened, but before
17239 the <function>local_scan()</function> function is run.
17241 </listitem></varlistentry>
17243 <term><varname>$received_ip_address</varname></term>
17246 <indexterm role="variable">
17247 <primary><varname>$received_ip_address</varname></primary>
17249 As soon as an Exim server starts processing an incoming TCP/IP connection, this
17250 variable is set to the address of the local IP interface, and <varname>$received_port</varname>
17251 is set to the local port number. (The remote IP address and port are in
17252 <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.) When testing with <option>-bh</option>,
17253 the port value is -1 unless it has been set using the <option>-oMi</option> command line
17257 As well as being useful in ACLs (including the <quote>connect</quote> ACL), these variable
17258 could be used, for example, to make the file name for a TLS certificate depend
17259 on which interface and/or port is being used for the incoming connection. The
17260 values of <varname>$received_ip_address</varname> and <varname>$received_port</varname> are saved with any
17261 messages that are received, thus making these variables available at delivery
17265 <emphasis role="bold">Note:</emphasis> There are no equivalent variables for outgoing connections, because
17266 the values are unknown (unless they are explicitly set by options of the
17267 <command>smtp</command> transport).
17269 </listitem></varlistentry>
17271 <term><varname>$received_port</varname></term>
17274 <indexterm role="variable">
17275 <primary><varname>$received_port</varname></primary>
17277 See <varname>$received_ip_address</varname>.
17279 </listitem></varlistentry>
17281 <term><varname>$received_protocol</varname></term>
17284 <indexterm role="variable">
17285 <primary><varname>$received_protocol</varname></primary>
17287 When a message is being processed, this variable contains the name of the
17288 protocol by which it was received. Most of the names used by Exim are defined
17289 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
17290 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
17291 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
17292 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
17293 connection and the client was successfully authenticated.
17296 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
17297 automatically set up on connection without the use of STARTTLS (see
17298 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
17299 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
17300 where the client initially uses EHLO, sets up an encrypted connection using
17301 STARTTLS, and then uses HELO afterwards.
17304 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
17305 messages that are injected locally by trusted callers. This is commonly used to
17306 identify messages that are being re-injected after some kind of scanning.
17308 </listitem></varlistentry>
17310 <term><varname>$received_time</varname></term>
17313 <indexterm role="variable">
17314 <primary><varname>$received_time</varname></primary>
17316 This variable contains the date and time when the current message was received,
17317 as a number of seconds since the start of the Unix epoch.
17319 </listitem></varlistentry>
17321 <term><varname>$recipient_data</varname></term>
17324 <indexterm role="variable">
17325 <primary><varname>$recipient_data</varname></primary>
17327 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
17328 condition. It contains the data from the lookup, and the value remains set
17329 until the next <option>recipients</option> test. Thus, you can do things like this:
17332 <literal>require recipients = cdb*@;/some/file</literal>
17333 <literal>deny </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
17336 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
17337 method in the address list, using the semicolon syntax as in the example above.
17338 The variable is not set for a lookup that is used as part of the string
17339 expansion that all such lists undergo before being interpreted.
17341 </listitem></varlistentry>
17343 <term><varname>$recipient_verify_failure</varname></term>
17346 <indexterm role="variable">
17347 <primary><varname>$recipient_verify_failure</varname></primary>
17349 In an ACL, when a recipient verification fails, this variable contains
17350 information about the failure. It is set to one of the following words:
17355 <quote>qualify</quote>: The address was unqualified (no domain), and the message
17356 was neither local nor came from an exempted host.
17361 <quote>route</quote>: Routing failed.
17366 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
17367 or before the MAIL command (that is, on initial connection, HELO, or
17373 <quote>recipient</quote>: The RCPT command in a callout was rejected.
17378 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
17383 The main use of this variable is expected to be to distinguish between
17384 rejections of MAIL and rejections of RCPT.
17386 </listitem></varlistentry>
17388 <term><varname>$recipients</varname></term>
17391 <indexterm role="variable">
17392 <primary><varname>$recipients</varname></primary>
17394 This variable contains a list of envelope recipients for a message. A comma and
17395 a space separate the addresses in the replacement text. However, the variable
17396 is not generally available, to prevent exposure of Bcc recipients in
17397 unprivileged users’ filter files. You can use <varname>$recipients</varname> only in these
17400 <orderedlist numeration="arabic">
17403 In a system filter file.
17408 In the ACLs associated with the DATA command and with non-SMTP messages, that
17409 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
17410 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
17411 <option>acl_not_smtp_mime</option>.
17416 From within a <function>local_scan()</function> function.
17420 </listitem></varlistentry>
17422 <term><varname>$recipients_count</varname></term>
17425 <indexterm role="variable">
17426 <primary><varname>$recipients_count</varname></primary>
17428 When a message is being processed, this variable contains the number of
17429 envelope recipients that came with the message. Duplicates are not excluded
17430 from the count. While a message is being received over SMTP, the number
17431 increases for each accepted recipient. It can be referenced in an ACL.
17433 </listitem></varlistentry>
17435 <term><varname>$regex_match_string</varname></term>
17438 <indexterm role="variable">
17439 <primary><varname>$regex_match_string</varname></primary>
17441 This variable is set to contain the matching regular expression after a
17442 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
17444 </listitem></varlistentry>
17446 <term><varname>$reply_address</varname></term>
17449 <indexterm role="variable">
17450 <primary><varname>$reply_address</varname></primary>
17452 When a message is being processed, this variable contains the contents of the
17453 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
17454 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
17455 white space, the value is not processed in any way. In particular, no RFC 2047
17456 decoding or character code translation takes place.
17458 </listitem></varlistentry>
17460 <term><varname>$return_path</varname></term>
17463 <indexterm role="variable">
17464 <primary><varname>$return_path</varname></primary>
17466 When a message is being delivered, this variable contains the return path –
17467 the sender field that will be sent as part of the envelope. It is not enclosed
17468 in <> characters. At the start of routing an address, <varname>$return_path</varname> has the
17469 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
17470 mailing list has been expanded by a router which specifies a different address
17471 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
17472 address, whereas <varname>$sender_address</varname> always contains the original sender address
17473 that was received with the message. In other words, <varname>$sender_address</varname> contains
17474 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
17477 </listitem></varlistentry>
17479 <term><varname>$return_size_limit</varname></term>
17482 <indexterm role="variable">
17483 <primary><varname>$return_size_limit</varname></primary>
17485 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
17487 </listitem></varlistentry>
17489 <term><varname>$runrc</varname></term>
17492 <indexterm role="concept">
17493 <primary>return code</primary>
17494 <secondary>from <option>run</option> expansion</secondary>
17496 <indexterm role="variable">
17497 <primary><varname>$runrc</varname></primary>
17499 This variable contains the return code from a command that is run by the
17500 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
17501 assume the order in which option values are expanded, except for those
17502 preconditions whose order of testing is documented. Therefore, you cannot
17503 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
17506 </listitem></varlistentry>
17508 <term><varname>$self_hostname</varname></term>
17511 <indexterm role="option">
17512 <primary><option>self</option></primary>
17513 <secondary>value of host name</secondary>
17515 <indexterm role="variable">
17516 <primary><varname>$self_hostname</varname></primary>
17518 When an address is routed to a supposedly remote host that turns out to be the
17519 local host, what happens is controlled by the <option>self</option> generic router option.
17520 One of its values causes the address to be passed to another router. When this
17521 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
17522 original router encountered. In other circumstances its contents are null.
17524 </listitem></varlistentry>
17526 <term><varname>$sender_address</varname></term>
17529 <indexterm role="variable">
17530 <primary><varname>$sender_address</varname></primary>
17532 When a message is being processed, this variable contains the sender’s address
17533 that was received in the message’s envelope. The case of letters in the address
17534 is retained, in both the local part and the domain. For bounce messages, the
17535 value of this variable is the empty string. See also <varname>$return_path</varname>.
17537 </listitem></varlistentry>
17539 <term><varname>$sender_address_data</varname></term>
17542 <indexterm role="variable">
17543 <primary><varname>$address_data</varname></primary>
17545 <indexterm role="variable">
17546 <primary><varname>$sender_address_data</varname></primary>
17548 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
17549 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
17550 distinguish it from data from a recipient address. The value does not persist
17551 after the end of the current ACL statement. If you want to preserve it for
17552 longer, you can save it in an ACL variable.
17554 </listitem></varlistentry>
17556 <term><varname>$sender_address_domain</varname></term>
17559 <indexterm role="variable">
17560 <primary><varname>$sender_address_domain</varname></primary>
17562 The domain portion of <varname>$sender_address</varname>.
17564 </listitem></varlistentry>
17566 <term><varname>$sender_address_local_part</varname></term>
17569 <indexterm role="variable">
17570 <primary><varname>$sender_address_local_part</varname></primary>
17572 The local part portion of <varname>$sender_address</varname>.
17574 </listitem></varlistentry>
17576 <term><varname>$sender_data</varname></term>
17579 <indexterm role="variable">
17580 <primary><varname>$sender_data</varname></primary>
17582 This variable is set after a lookup success in an ACL <option>senders</option> condition or
17583 in a router <option>senders</option> option. It contains the data from the lookup, and the
17584 value remains set until the next <option>senders</option> test. Thus, you can do things like
17588 <literal>require senders = cdb*@;/some/file</literal>
17589 <literal>deny </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
17592 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
17593 method in the address list, using the semicolon syntax as in the example above.
17594 The variable is not set for a lookup that is used as part of the string
17595 expansion that all such lists undergo before being interpreted.
17597 </listitem></varlistentry>
17599 <term><varname>$sender_fullhost</varname></term>
17602 <indexterm role="variable">
17603 <primary><varname>$sender_fullhost</varname></primary>
17605 When a message is received from a remote host, this variable contains the host
17606 name and IP address in a single string. It ends with the IP address in square
17607 brackets, followed by a colon and a port number if the logging of ports is
17608 enabled. The format of the rest of the string depends on whether the host
17609 issued a HELO or EHLO SMTP command, and whether the host name was verified by
17610 looking up its IP address. (Looking up the IP address can be forced by the
17611 <option>host_lookup</option> option, independent of verification.) A plain host name at the
17612 start of the string is a verified host name; if this is not present,
17613 verification either failed or was not requested. A host name in parentheses is
17614 the argument of a HELO or EHLO command. This is omitted if it is identical to
17615 the verified host name or to the host’s IP address in square brackets.
17617 </listitem></varlistentry>
17619 <term><varname>$sender_helo_name</varname></term>
17622 <indexterm role="variable">
17623 <primary><varname>$sender_helo_name</varname></primary>
17625 When a message is received from a remote host that has issued a HELO or EHLO
17626 command, the argument of that command is placed in this variable. It is also
17627 set if HELO or EHLO is used when a message is received using SMTP locally via
17628 the <option>-bs</option> or <option>-bS</option> options.
17630 </listitem></varlistentry>
17632 <term><varname>$sender_host_address</varname></term>
17635 <indexterm role="variable">
17636 <primary><varname>$sender_host_address</varname></primary>
17638 When a message is received from a remote host, this variable contains that
17639 host’s IP address. For locally submitted messages, it is empty.
17641 </listitem></varlistentry>
17643 <term><varname>$sender_host_authenticated</varname></term>
17646 <indexterm role="variable">
17647 <primary><varname>$sender_host_authenticated</varname></primary>
17649 This variable contains the name (not the public name) of the authenticator
17650 driver that successfully authenticated the client from which the message was
17651 received. It is empty if there was no successful authentication. See also
17652 <varname>$authenticated_id</varname>.
17654 </listitem></varlistentry>
17656 <term><varname>$sender_host_name</varname></term>
17659 <indexterm role="variable">
17660 <primary><varname>$sender_host_name</varname></primary>
17662 When a message is received from a remote host, this variable contains the
17663 host’s name as obtained by looking up its IP address. For messages received by
17664 other means, this variable is empty.
17667 <indexterm role="variable">
17668 <primary><varname>$host_lookup_failed</varname></primary>
17670 If the host name has not previously been looked up, a reference to
17671 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
17672 A looked up name is accepted only if it leads back to the original IP address
17673 via a forward lookup. If either the reverse or the forward lookup fails to find
17674 any data, or if the forward lookup does not yield the original IP address,
17675 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
17678 <indexterm role="variable">
17679 <primary><varname>$host_lookup_deferred</varname></primary>
17681 However, if either of the lookups cannot be completed (for example, there is a
17682 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
17683 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
17686 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
17687 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
17688 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
17689 is set to <quote>1</quote>.
17692 Exim does not automatically look up every calling host’s name. If you want
17693 maximum efficiency, you should arrange your configuration so that it avoids
17694 these lookups altogether. The lookup happens only if one or more of the
17695 following are true:
17700 A string containing <varname>$sender_host_name</varname> is expanded.
17705 The calling host matches the list in <option>host_lookup</option>. In the default
17706 configuration, this option is set to *, so it must be changed if lookups are
17707 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
17712 Exim needs the host name in order to test an item in a host list. The items
17713 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
17714 <xref linkend="SECThoslispatnamsk"/>.
17719 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
17720 In this case, the host name is required to compare with the name quoted in any
17721 EHLO or HELO commands that the client issues.
17726 The remote host issues a EHLO or HELO command that quotes one of the
17727 domains in <option>helo_lookup_domains</option>. The default value of this option is
17729 <literallayout class="monospaced">
17730 helo_lookup_domains = @ : @[]
17733 which causes a lookup if a remote host (incorrectly) gives the server’s name or
17734 IP address in an EHLO or HELO command.
17738 </listitem></varlistentry>
17740 <term><varname>$sender_host_port</varname></term>
17743 <indexterm role="variable">
17744 <primary><varname>$sender_host_port</varname></primary>
17746 When a message is received from a remote host, this variable contains the port
17747 number that was used on the remote host.
17749 </listitem></varlistentry>
17751 <term><varname>$sender_ident</varname></term>
17754 <indexterm role="variable">
17755 <primary><varname>$sender_ident</varname></primary>
17757 When a message is received from a remote host, this variable contains the
17758 identification received in response to an RFC 1413 request. When a message has
17759 been received locally, this variable contains the login name of the user that
17762 </listitem></varlistentry>
17764 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
17767 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
17768 <option>ratelimit</option> ACL condition. Details are given in section
17769 <xref linkend="SECTratelimiting"/>.
17771 </listitem></varlistentry>
17773 <term><varname>$sender_rcvhost</varname></term>
17776 <indexterm role="concept">
17777 <primary>DNS</primary>
17778 <secondary>reverse lookup</secondary>
17780 <indexterm role="concept">
17781 <primary>reverse DNS lookup</primary>
17783 <indexterm role="variable">
17784 <primary><varname>$sender_rcvhost</varname></primary>
17786 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
17787 either the verified host name (as obtained from a reverse DNS lookup) or, if
17788 there is no verified host name, the IP address in square brackets. After that
17789 there may be text in parentheses. When the first item is a verified host name,
17790 the first thing in the parentheses is the IP address in square brackets,
17791 followed by a colon and a port number if port logging is enabled. When the
17792 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
17796 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
17797 was used and its argument was not identical to the real host name or IP
17798 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
17799 all three items are present in the parentheses, a newline and tab are inserted
17800 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
17802 </listitem></varlistentry>
17804 <term><varname>$sender_verify_failure</varname></term>
17807 <indexterm role="variable">
17808 <primary><varname>$sender_verify_failure</varname></primary>
17810 In an ACL, when a sender verification fails, this variable contains information
17811 about the failure. The details are the same as for
17812 <varname>$recipient_verify_failure</varname>.
17814 </listitem></varlistentry>
17816 <term><varname>$sending_ip_address</varname></term>
17819 <indexterm role="variable">
17820 <primary><varname>$sending_ip_address</varname></primary>
17822 This variable is set whenever an outgoing SMTP connection to another host has
17823 been set up. It contains the IP address of the local interface that is being
17824 used. This is useful if a host that has more than one IP address wants to take
17825 on different personalities depending on which one is being used. For incoming
17826 connections, see <varname>$received_ip_address</varname>.
17828 </listitem></varlistentry>
17830 <term><varname>$sending_port</varname></term>
17833 <indexterm role="variable">
17834 <primary><varname>$sending_port</varname></primary>
17836 This variable is set whenever an outgoing SMTP connection to another host has
17837 been set up. It contains the local port that is being used. For incoming
17838 connections, see <varname>$received_port</varname>.
17840 </listitem></varlistentry>
17842 <term><varname>$smtp_active_hostname</varname></term>
17845 <indexterm role="variable">
17846 <primary><varname>$smtp_active_hostname</varname></primary>
17848 During an incoming SMTP session, this variable contains the value of the active
17849 host name, as specified by the <option>smtp_active_hostname</option> option. The value of
17850 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
17851 value can be consulted during routing and delivery.
17853 </listitem></varlistentry>
17855 <term><varname>$smtp_command</varname></term>
17858 <indexterm role="variable">
17859 <primary><varname>$smtp_command</varname></primary>
17861 During the processing of an incoming SMTP command, this variable contains the
17862 entire command. This makes it possible to distinguish between HELO and EHLO in
17863 the HELO ACL, and also to distinguish between commands such as these:
17865 <literallayout class="monospaced">
17867 MAIL FROM: <>
17870 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
17871 command, the address in <varname>$smtp_command</varname> is the original address before any
17872 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
17873 the address after SMTP-time rewriting.
17875 </listitem></varlistentry>
17877 <term><varname>$smtp_command_argument</varname></term>
17880 <indexterm role="concept">
17881 <primary>SMTP</primary>
17882 <secondary>command, argument for</secondary>
17884 <indexterm role="variable">
17885 <primary><varname>$smtp_command_argument</varname></primary>
17887 While an ACL is running to check an SMTP command, this variable contains the
17888 argument, that is, the text that follows the command name, with leading white
17889 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
17890 somewhat redundant, but is retained for backwards compatibility.
17892 </listitem></varlistentry>
17894 <term><varname>$smtp_count_at_connection_start</varname></term>
17897 <indexterm role="variable">
17898 <primary><varname>$smtp_count_at_connection_start</varname></primary>
17900 This variable is set greater than zero only in processes spawned by the Exim
17901 daemon for handling incoming SMTP connections. The name is deliberately long,
17902 in order to emphasize what the contents are. When the daemon accepts a new
17903 connection, it increments this variable. A copy of the variable is passed to
17904 the child process that handles the connection, but its value is fixed, and
17905 never changes. It is only an approximation of how many incoming connections
17906 there actually are, because many other connections may come and go while a
17907 single connection is being processed. When a child process terminates, the
17908 daemon decrements its copy of the variable.
17910 </listitem></varlistentry>
17912 <term><varname>$sn0</varname> – <varname>$sn9</varname></term>
17915 These variables are copies of the values of the <varname>$n0</varname> – <varname>$n9</varname> accumulators
17916 that were current at the end of the system filter file. This allows a system
17917 filter file to set values that can be tested in users’ filter files. For
17918 example, a system filter could set a value indicating how likely it is that a
17919 message is junk mail.
17921 </listitem></varlistentry>
17923 <term><varname>$spam_</varname><emphasis>xxx</emphasis></term>
17926 A number of variables whose names start with <varname>$spam</varname> are available when Exim
17927 is compiled with the content-scanning extension. For details, see section
17928 <xref linkend="SECTscanspamass"/>.
17930 </listitem></varlistentry>
17932 <term><varname>$spool_directory</varname></term>
17935 <indexterm role="variable">
17936 <primary><varname>$spool_directory</varname></primary>
17938 The name of Exim’s spool directory.
17940 </listitem></varlistentry>
17942 <term><varname>$spool_inodes</varname></term>
17945 <indexterm role="variable">
17946 <primary><varname>$spool_inodes</varname></primary>
17948 The number of free inodes in the disk partition where Exim’s spool files are
17949 being written. The value is recalculated whenever the variable is referenced.
17950 If the relevant file system does not have the concept of inodes, the value of
17951 is -1. See also the <option>check_spool_inodes</option> option.
17953 </listitem></varlistentry>
17955 <term><varname>$spool_space</varname></term>
17958 <indexterm role="variable">
17959 <primary><varname>$spool_space</varname></primary>
17961 The amount of free space (as a number of kilobytes) in the disk partition where
17962 Exim’s spool files are being written. The value is recalculated whenever the
17963 variable is referenced. If the operating system does not have the ability to
17964 find the amount of free space (only true for experimental systems), the space
17965 value is -1. For example, to check in an ACL that there is at least 50
17966 megabytes free on the spool, you could write:
17968 <literallayout class="monospaced">
17969 condition = ${if > {$spool_space}{50000}}
17972 See also the <option>check_spool_space</option> option.
17974 </listitem></varlistentry>
17976 <term><varname>$thisaddress</varname></term>
17979 <indexterm role="variable">
17980 <primary><varname>$thisaddress</varname></primary>
17982 This variable is set only during the processing of the <option>foranyaddress</option>
17983 command in a filter file. Its use is explained in the description of that
17984 command, which can be found in the separate document entitled <emphasis>Exim’s
17985 interfaces to mail filtering</emphasis>.
17987 </listitem></varlistentry>
17989 <term><varname>$tls_certificate_verified</varname></term>
17992 <indexterm role="variable">
17993 <primary><varname>$tls_certificate_verified</varname></primary>
17995 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
17996 message was received, and <quote>0</quote> otherwise.
17998 </listitem></varlistentry>
18000 <term><varname>$tls_cipher</varname></term>
18003 <indexterm role="variable">
18004 <primary><varname>$tls_cipher</varname></primary>
18006 When a message is received from a remote host over an encrypted SMTP
18007 connection, this variable is set to the cipher suite that was negotiated, for
18008 example DES-CBC3-SHA. In other circumstances, in particular, for message
18009 received over unencrypted connections, the variable is empty. Testing
18010 <varname>$tls_cipher</varname> for emptiness is one way of distinguishing between encrypted and
18011 non-encrypted connections during ACL processing.
18014 The <varname>$tls_cipher</varname> variable retains its value during message delivery, except
18015 when an outward SMTP delivery takes place via the <command>smtp</command> transport. In this
18016 case, <varname>$tls_cipher</varname> is cleared before any outgoing SMTP connection is made,
18017 and then set to the outgoing cipher suite if one is negotiated. See chapter
18018 <xref linkend="CHAPTLS"/> for details of TLS support and chapter <xref linkend="CHAPsmtptrans"/> for
18019 details of the <command>smtp</command> transport.
18021 </listitem></varlistentry>
18023 <term><varname>$tls_peerdn</varname></term>
18026 <indexterm role="variable">
18027 <primary><varname>$tls_peerdn</varname></primary>
18029 When a message is received from a remote host over an encrypted SMTP
18030 connection, and Exim is configured to request a certificate from the client,
18031 the value of the Distinguished Name of the certificate is made available in the
18032 <varname>$tls_peerdn</varname> during subsequent processing. Like <varname>$tls_cipher</varname>, the
18033 value is retained during message delivery, except during outbound SMTP
18036 </listitem></varlistentry>
18038 <term><varname>$tod_bsdinbox</varname></term>
18041 <indexterm role="variable">
18042 <primary><varname>$tod_bsdinbox</varname></primary>
18044 The time of day and the date, in the format required for BSD-style mailbox
18045 files, for example: Thu Oct 17 17:14:09 1995.
18047 </listitem></varlistentry>
18049 <term><varname>$tod_epoch</varname></term>
18052 <indexterm role="variable">
18053 <primary><varname>$tod_epoch</varname></primary>
18055 The time and date as a number of seconds since the start of the Unix epoch.
18057 </listitem></varlistentry>
18059 <term><varname>$tod_full</varname></term>
18062 <indexterm role="variable">
18063 <primary><varname>$tod_full</varname></primary>
18065 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
18066 +0100. The timezone is always given as a numerical offset from UTC, with
18067 positive values used for timezones that are ahead (east) of UTC, and negative
18068 values for those that are behind (west).
18070 </listitem></varlistentry>
18072 <term><varname>$tod_log</varname></term>
18075 <indexterm role="variable">
18076 <primary><varname>$tod_log</varname></primary>
18078 The time and date in the format used for writing Exim’s log files, for example:
18079 1995-10-12 15:32:29, but without a timezone.
18081 </listitem></varlistentry>
18083 <term><varname>$tod_logfile</varname></term>
18086 <indexterm role="variable">
18087 <primary><varname>$tod_logfile</varname></primary>
18089 This variable contains the date in the format yyyymmdd. This is the format that
18090 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
18093 </listitem></varlistentry>
18095 <term><varname>$tod_zone</varname></term>
18098 <indexterm role="variable">
18099 <primary><varname>$tod_zone</varname></primary>
18101 This variable contains the numerical value of the local timezone, for example:
18104 </listitem></varlistentry>
18106 <term><varname>$tod_zulu</varname></term>
18109 <indexterm role="variable">
18110 <primary><varname>$tod_zulu</varname></primary>
18112 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
18113 by ISO 8601, for example: 20030221154023Z.
18115 </listitem></varlistentry>
18117 <term><varname>$value</varname></term>
18120 <indexterm role="variable">
18121 <primary><varname>$value</varname></primary>
18123 This variable contains the result of an expansion lookup, extraction operation,
18124 or external command, as described above. It is also used during a
18125 <emphasis role="bold">reduce</emphasis> expansion.
18127 </listitem></varlistentry>
18129 <term><varname>$version_number</varname></term>
18132 <indexterm role="variable">
18133 <primary><varname>$version_number</varname></primary>
18135 The version number of Exim.
18137 </listitem></varlistentry>
18139 <term><varname>$warn_message_delay</varname></term>
18142 <indexterm role="variable">
18143 <primary><varname>$warn_message_delay</varname></primary>
18145 This variable is set only during the creation of a message warning about a
18146 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
18148 </listitem></varlistentry>
18150 <term><varname>$warn_message_recipients</varname></term>
18153 <indexterm role="variable">
18154 <primary><varname>$warn_message_recipients</varname></primary>
18156 This variable is set only during the creation of a message warning about a
18157 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
18159 </listitem></varlistentry>
18162 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
18167 <chapter id="CHAPperl">
18168 <title>Embedded Perl</title>
18170 <indexterm role="concept" id="IIDperl" class="startofrange">
18171 <primary>Perl</primary>
18172 <secondary>calling from Exim</secondary>
18174 Exim can be built to include an embedded Perl interpreter. When this is done,
18175 Perl subroutines can be called as part of the string expansion process. To make
18176 use of the Perl support, you need version 5.004 or later of Perl installed on
18177 your system. To include the embedded interpreter in the Exim binary, include
18180 <literallayout class="monospaced">
18184 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
18186 <section id="SECID85">
18187 <title>Setting up so Perl can be used</title>
18189 <indexterm role="option">
18190 <primary><option>perl_startup</option></primary>
18192 Access to Perl subroutines is via a global configuration option called
18193 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
18194 no <option>perl_startup</option> option in the Exim configuration file then no Perl
18195 interpreter is started and there is almost no overhead for Exim (since none of
18196 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
18197 option then the associated value is taken to be Perl code which is executed in
18198 a newly created Perl interpreter.
18201 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
18202 need backslashes before any characters to escape special meanings. The option
18203 should usually be something like
18205 <literallayout class="monospaced">
18206 perl_startup = do '/etc/exim.pl'
18209 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
18210 use from Exim. Exim can be configured either to start up a Perl interpreter as
18211 soon as it is entered, or to wait until the first time it is needed. Starting
18212 the interpreter at the beginning ensures that it is done while Exim still has
18213 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
18214 fact used in a particular run. Also, note that this does not mean that Exim is
18215 necessarily running as root when Perl is called at a later time. By default,
18216 the interpreter is started only when it is needed, but this can be changed in
18222 <indexterm role="option">
18223 <primary><option>perl_at_start</option></primary>
18225 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
18226 a startup when Exim is entered.
18231 The command line option <option>-ps</option> also requests a startup when Exim is entered,
18232 overriding the setting of <option>perl_at_start</option>.
18237 There is also a command line option <option>-pd</option> (for delay) which suppresses the
18238 initial startup, even if <option>perl_at_start</option> is set.
18241 <section id="SECID86">
18242 <title>Calling Perl subroutines</title>
18244 When the configuration file includes a <option>perl_startup</option> option you can make use
18245 of the string expansion item to call the Perl subroutines that are defined
18246 by the <option>perl_startup</option> code. The operator is used in any of the following
18249 <literallayout class="monospaced">
18251 ${perl{foo}{argument}}
18252 ${perl{foo}{argument1}{argument2} ... }
18255 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
18256 arguments may be passed. Passing more than this results in an expansion failure
18257 with an error message of the form
18259 <literallayout class="monospaced">
18260 Too many arguments passed to Perl subroutine "foo" (max is 8)
18263 The return value of the Perl subroutine is evaluated in a scalar context before
18264 it is passed back to Exim to be inserted into the expanded string. If the
18265 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
18266 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
18267 by obeying Perl’s <option>die</option> function, the expansion fails with the error message
18268 that was passed to <option>die</option>.
18271 <section id="SECID87">
18272 <title>Calling Exim functions from Perl</title>
18274 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
18275 is available to call back into Exim’s string expansion function. For example,
18278 <literallayout class="monospaced">
18279 my $lp = Exim::expand_string('$local_part');
18282 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
18283 Note those are single quotes and not double quotes to protect against
18284 <varname>$local_part</varname> being interpolated as a Perl variable.
18287 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
18288 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
18289 expansion string, the Perl call from the original expansion string fails with
18290 an appropriate error message, in the same way as if <option>die</option> were used.
18293 <indexterm role="concept">
18294 <primary>debugging</primary>
18295 <secondary>from embedded Perl</secondary>
18297 <indexterm role="concept">
18298 <primary>log</primary>
18299 <secondary>writing from embedded Perl</secondary>
18301 Two other Exim functions are available for use from within Perl code.
18302 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim’s
18303 debugging is enabled. If you want a newline at the end, you must supply it.
18304 <emphasis>Exim::log_write()</emphasis> writes a string to Exim’s main log, adding a leading
18305 timestamp. In this case, you should not supply a terminating newline.
18308 <section id="SECID88">
18309 <title>Use of standard output and error by Perl</title>
18311 <indexterm role="concept">
18312 <primary>Perl</primary>
18313 <secondary>standard output and error</secondary>
18315 You should not write to the standard error or output streams from within your
18316 Perl code, as it is not defined how these are set up. In versions of Exim
18317 before 4.50, it is possible for the standard output or error to refer to the
18318 SMTP connection during message reception via the daemon. Writing to this stream
18319 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
18320 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
18321 avoided, but the output is lost.
18324 <indexterm role="concept">
18325 <primary>Perl</primary>
18326 <secondary>use of <option>warn</option></secondary>
18328 The Perl <option>warn</option> statement writes to the standard error stream by default.
18329 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
18330 you have no control. When Exim starts up the Perl interpreter, it arranges for
18331 output from the <option>warn</option> statement to be written to the Exim main log. You can
18332 change this by including appropriate Perl magic somewhere in your Perl code.
18333 For example, to discard <option>warn</option> output completely, you need this:
18335 <literallayout class="monospaced">
18336 $SIG{__WARN__} = sub { };
18339 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
18340 example, the code for the subroutine is empty, so it does nothing, but you can
18341 include any Perl code that you like. The text of the <option>warn</option> message is passed
18342 as the first subroutine argument.
18343 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
18348 <chapter id="CHAPinterfaces">
18349 <title>Starting the daemon and the use of network interfaces</title>
18350 <titleabbrev>Starting the daemon</titleabbrev>
18352 <indexterm role="concept">
18353 <primary>daemon</primary>
18354 <secondary>starting</secondary>
18356 <indexterm role="concept">
18357 <primary>interface</primary>
18358 <secondary>listening</secondary>
18360 <indexterm role="concept">
18361 <primary>network interface</primary>
18363 <indexterm role="concept">
18364 <primary>interface</primary>
18365 <secondary>network</secondary>
18367 <indexterm role="concept">
18368 <primary>IP address</primary>
18369 <secondary>for listening</secondary>
18371 <indexterm role="concept">
18372 <primary>daemon</primary>
18373 <secondary>listening IP addresses</secondary>
18375 <indexterm role="concept">
18376 <primary>TCP/IP</primary>
18377 <secondary>setting listening interfaces</secondary>
18379 <indexterm role="concept">
18380 <primary>TCP/IP</primary>
18381 <secondary>setting listening ports</secondary>
18383 A host that is connected to a TCP/IP network may have one or more physical
18384 hardware network interfaces. Each of these interfaces may be configured as one
18385 or more <quote>logical</quote> interfaces, which are the entities that a program actually
18386 works with. Each of these logical interfaces is associated with an IP address.
18387 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
18388 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
18389 knowledge about the host’s interfaces for use in three different circumstances:
18391 <orderedlist numeration="arabic">
18394 When a listening daemon is started, Exim needs to know which interfaces
18395 and ports to listen on.
18400 When Exim is routing an address, it needs to know which IP addresses
18401 are associated with local interfaces. This is required for the correct
18402 processing of MX lists by removing the local host and others with the
18403 same or higher priority values. Also, Exim needs to detect cases
18404 when an address is routed to an IP address that in fact belongs to the
18405 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
18406 option of the smtp transport is set (as appropriate), this is treated
18407 as an error situation.
18412 When Exim connects to a remote host, it may need to know which interface to use
18413 for the outgoing connection.
18418 Exim’s default behaviour is likely to be appropriate in the vast majority
18419 of cases. If your host has only one interface, and you want all its IP
18420 addresses to be treated in the same way, and you are using only the
18421 standard SMTP port, you should not need to take any special action. The
18422 rest of this chapter does not apply to you.
18425 In a more complicated situation you may want to listen only on certain
18426 interfaces, or on different ports, and for this reason there are a number of
18427 options that can be used to influence Exim’s behaviour. The rest of this
18428 chapter describes how they operate.
18431 When a message is received over TCP/IP, the interface and port that were
18432 actually used are set in <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
18434 <section id="SECID89">
18435 <title>Starting a listening daemon</title>
18437 When a listening daemon is started (by means of the <option>-bd</option> command line
18438 option), the interfaces and ports on which it listens are controlled by the
18444 <option>daemon_smtp_ports</option> contains a list of default ports. (For backward
18445 compatibility, this option can also be specified in the singular.)
18450 <option>local_interfaces</option> contains list of interface IP addresses on which to
18451 listen. Each item may optionally also specify a port.
18456 The default list separator in both cases is a colon, but this can be changed as
18457 described in section <xref linkend="SECTlistconstruct"/>. When IPv6 addresses are involved,
18458 it is usually best to change the separator to avoid having to double all the
18459 colons. For example:
18461 <literallayout class="monospaced">
18462 local_interfaces = <; 127.0.0.1 ; \
18465 3ffe:ffff:836f::fe86:a061
18468 There are two different formats for specifying a port along with an IP address
18469 in <option>local_interfaces</option>:
18471 <orderedlist numeration="arabic">
18474 The port is added onto the address with a dot separator. For example, to listen
18475 on port 1234 on two different IP addresses:
18477 <literallayout class="monospaced">
18478 local_interfaces = <; 192.168.23.65.1234 ; \
18479 3ffe:ffff:836f::fe86:a061.1234
18484 The IP address is enclosed in square brackets, and the port is added
18485 with a colon separator, for example:
18487 <literallayout class="monospaced">
18488 local_interfaces = <; [192.168.23.65]:1234 ; \
18489 [3ffe:ffff:836f::fe86:a061]:1234
18494 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
18495 default setting contains just one port:
18497 <literallayout class="monospaced">
18498 daemon_smtp_ports = smtp
18501 If more than one port is listed, each interface that does not have its own port
18502 specified listens on all of them. Ports that are listed in
18503 <option>daemon_smtp_ports</option> can be identified either by name (defined in
18504 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
18505 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
18508 <section id="SECID90">
18509 <title>Special IP listening addresses</title>
18511 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
18512 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
18513 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
18514 instead of setting up separate listening sockets for each interface. The
18515 default value of <option>local_interfaces</option> is
18517 <literallayout class="monospaced">
18518 local_interfaces = 0.0.0.0
18521 when Exim is built without IPv6 support; otherwise it is:
18523 <literallayout class="monospaced">
18524 local_interfaces = <; ::0 ; 0.0.0.0
18527 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
18530 <section id="SECID91">
18531 <title>Overriding local_interfaces and daemon_smtp_ports</title>
18533 The <option>-oX</option> command line option can be used to override the values of
18534 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
18535 instance. Another way of doing this would be to use macros and the <option>-D</option>
18536 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
18537 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
18541 The value of <option>-oX</option> is a list of items. The default colon separator can be
18542 changed in the usual way if required. If there are any items that do not
18543 contain dots or colons (that is, are not IP addresses), the value of
18544 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
18545 items that do contain dots or colons, the value of <option>local_interfaces</option> is
18546 replaced by those items. Thus, for example,
18548 <literallayout class="monospaced">
18552 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
18555 <literallayout class="monospaced">
18556 -oX 192.168.34.5.1125
18559 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
18560 (However, since <option>local_interfaces</option> now contains no items without ports, the
18561 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
18564 <section id="SECTsupobssmt">
18565 <title>Support for the obsolete SSMTP (or SMTPS) protocol</title>
18567 <indexterm role="concept">
18568 <primary>ssmtp protocol</primary>
18570 <indexterm role="concept">
18571 <primary>smtps protocol</primary>
18573 <indexterm role="concept">
18574 <primary>SMTP</primary>
18575 <secondary>ssmtp protocol</secondary>
18577 <indexterm role="concept">
18578 <primary>SMTP</primary>
18579 <secondary>smtps protocol</secondary>
18581 Exim supports the obsolete SSMTP protocol (also known as SMTPS) that was used
18582 before the STARTTLS command was standardized for SMTP. Some legacy clients
18583 still use this protocol. If the <option>tls_on_connect_ports</option> option is set to a
18584 list of port numbers, connections to those ports must use SSMTP. The most
18585 common use of this option is expected to be
18587 <literallayout class="monospaced">
18588 tls_on_connect_ports = 465
18591 because 465 is the usual port number used by the legacy clients. There is also
18592 a command line option <option>-tls-on-connect</option>, which forces all ports to behave in
18593 this way when a daemon is started.
18596 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
18597 daemon to listen on those ports. You must still specify them in
18598 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
18599 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
18600 connections via the daemon.)
18603 <section id="SECID92">
18604 <title>IPv6 address scopes</title>
18606 <indexterm role="concept">
18607 <primary>IPv6</primary>
18608 <secondary>address scopes</secondary>
18610 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
18611 can, in principle, have the same link-local IPv6 address on different
18612 interfaces. Thus, additional information is needed, over and above the IP
18613 address, to distinguish individual interfaces. A convention of using a
18614 percent sign followed by something (often the interface name) has been
18615 adopted in some cases, leading to addresses like this:
18617 <literallayout class="monospaced">
18618 fe80::202:b3ff:fe03:45c1%eth0
18621 To accommodate this usage, a percent sign followed by an arbitrary string is
18622 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
18623 to convert a textual IPv6 address for actual use. This function recognizes the
18624 percent convention in operating systems that support it, and it processes the
18625 address appropriately. Unfortunately, some older libraries have problems with
18626 <function>getaddrinfo()</function>. If
18628 <literallayout class="monospaced">
18629 IPV6_USE_INET_PTON=yes
18632 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
18633 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
18634 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
18635 function.) Of course, this means that the additional functionality of
18636 <function>getaddrinfo()</function> – recognizing scoped addresses – is lost.
18639 <section id="SECID93">
18640 <title>Disabling IPv6</title>
18642 <indexterm role="concept">
18643 <primary>IPv6</primary>
18644 <secondary>disabling</secondary>
18646 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
18647 run on a host whose kernel does not support IPv6. The binary will fall back to
18648 using IPv4, but it may waste resources looking up AAAA records, and trying to
18649 connect to IPv6 addresses, causing delays to mail delivery. If you set the
18650 <indexterm role="option">
18651 <primary><option>disable_ipv6</option></primary>
18653 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
18654 activities take place. AAAA records are never looked up, and any IPv6 addresses
18655 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
18656 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
18657 to handle IPv6 literal addresses.
18660 On the other hand, when IPv6 is in use, there may be times when you want to
18661 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
18662 option to globally suppress the lookup of AAAA records for specified domains,
18663 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
18664 IPv6 addresses in an individual router.
18667 <section id="SECID94">
18668 <title>Examples of starting a listening daemon</title>
18670 The default case in an IPv6 environment is
18672 <literallayout class="monospaced">
18673 daemon_smtp_ports = smtp
18674 local_interfaces = <; ::0 ; 0.0.0.0
18677 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
18678 Either one or two sockets may be used, depending on the characteristics of
18679 the TCP/IP stack. (This is complicated and messy; for more information,
18680 read the comments in the <filename>daemon.c</filename> source file.)
18683 To specify listening on ports 25 and 26 on all interfaces:
18685 <literallayout class="monospaced">
18686 daemon_smtp_ports = 25 : 26
18689 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
18691 <literallayout class="monospaced">
18692 local_interfaces = <; ::0.25 ; ::0.26 \
18693 0.0.0.0.25 ; 0.0.0.0.26
18696 To listen on the default port on all IPv4 interfaces, and on port 26 on the
18697 IPv4 loopback address only:
18699 <literallayout class="monospaced">
18700 local_interfaces = 0.0.0.0 : 127.0.0.1.26
18703 To specify listening on the default port on specific interfaces only:
18705 <literallayout class="monospaced">
18706 local_interfaces = 192.168.34.67 : 192.168.34.67
18709 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
18712 <section id="SECTreclocipadd">
18713 <title>Recognizing the local host</title>
18715 The <option>local_interfaces</option> option is also used when Exim needs to determine
18716 whether or not an IP address refers to the local host. That is, the IP
18717 addresses of all the interfaces on which a daemon is listening are always
18721 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
18722 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
18723 available interfaces from the operating system, and extracts the relevant
18724 (that is, IPv4 or IPv6) addresses to use for checking.
18727 Some systems set up large numbers of virtual interfaces in order to provide
18728 many virtual web servers. In this situation, you may want to listen for
18729 email on only a few of the available interfaces, but nevertheless treat all
18730 interfaces as local when routing. You can do this by setting
18731 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
18732 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
18733 used for listening. Consider this example:
18735 <literallayout class="monospaced">
18736 local_interfaces = <; 127.0.0.1 ; ::1 ; \
18738 3ffe:2101:12:1:a00:20ff:fe86:a061
18740 extra_local_interfaces = <; ::0 ; 0.0.0.0
18743 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
18744 address, but all available interface addresses are treated as local when
18748 In some environments the local host name may be in an MX list, but with an IP
18749 address that is not assigned to any local interface. In other cases it may be
18750 desirable to treat other host names as if they referred to the local host. Both
18751 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
18752 This contains host names rather than IP addresses. When a host is referenced
18753 during routing, either via an MX record or directly, it is treated as the local
18754 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
18755 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
18758 <section id="SECID95">
18759 <title>Delivering to a remote host</title>
18761 Delivery to a remote host is handled by the smtp transport. By default, it
18762 allows the system’s TCP/IP functions to choose which interface to use (if
18763 there is more than one) when connecting to a remote host. However, the
18764 <option>interface</option> option can be set to specify which interface is used. See the
18765 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
18771 <chapter id="CHAPmainconfig">
18772 <title>Main configuration</title>
18774 <indexterm role="concept" id="IIDconfima" class="startofrange">
18775 <primary>configuration file</primary>
18776 <secondary>main section</secondary>
18778 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
18779 <primary>main configuration</primary>
18781 The first part of the run time configuration file contains three types of item:
18786 Macro definitions: These lines start with an upper case letter. See section
18787 <xref linkend="SECTmacrodefs"/> for details of macro processing.
18792 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
18793 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
18794 section <xref linkend="SECTnamedlists"/>.
18799 Main configuration settings: Each setting occupies one line of the file
18800 (with possible continuations). If any setting is preceded by the word
18801 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
18802 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
18808 This chapter specifies all the main configuration options, along with their
18809 types and default values. For ease of finding a particular option, they appear
18810 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
18811 are now so many options, they are first listed briefly in functional groups, as
18812 an aid to finding the name of the option you are looking for. Some options are
18813 listed in more than one group.
18815 <section id="SECID96">
18816 <title>Miscellaneous</title>
18817 <informaltable frame="none">
18818 <tgroup cols="2" colsep="0" rowsep="0">
18819 <colspec colwidth="196pt" align="left"/>
18820 <colspec colwidth="254pt" align="left"/>
18823 <entry><option>bi_command</option></entry>
18824 <entry>to run for <option>-bi</option> command line option</entry>
18827 <entry><option>disable_ipv6</option></entry>
18828 <entry>do no IPv6 processing</entry>
18831 <entry><option>keep_malformed</option></entry>
18832 <entry>for broken files – should not happen</entry>
18835 <entry><option>localhost_number</option></entry>
18836 <entry>for unique message ids in clusters</entry>
18839 <entry><option>message_body_newlines</option></entry>
18840 <entry>retain newlines in <varname>$message_body</varname></entry>
18843 <entry><option>message_body_visible</option></entry>
18844 <entry>how much to show in <varname>$message_body</varname></entry>
18847 <entry><option>mua_wrapper</option></entry>
18848 <entry>run in <quote>MUA wrapper</quote> mode</entry>
18851 <entry><option>print_topbitchars</option></entry>
18852 <entry>top-bit characters are printing</entry>
18855 <entry><option>timezone</option></entry>
18856 <entry>force time zone</entry>
18862 <section id="SECID97">
18863 <title>Exim parameters</title>
18864 <informaltable frame="none">
18865 <tgroup cols="2" colsep="0" rowsep="0">
18866 <colspec colwidth="196pt" align="left"/>
18867 <colspec colwidth="254pt" align="left"/>
18870 <entry><option>exim_group</option></entry>
18871 <entry>override compiled-in value</entry>
18874 <entry><option>exim_path</option></entry>
18875 <entry>override compiled-in value</entry>
18878 <entry><option>exim_user</option></entry>
18879 <entry>override compiled-in value</entry>
18882 <entry><option>primary_hostname</option></entry>
18883 <entry>default from <function>uname()</function></entry>
18886 <entry><option>split_spool_directory</option></entry>
18887 <entry>use multiple directories</entry>
18890 <entry><option>spool_directory</option></entry>
18891 <entry>override compiled-in value</entry>
18897 <section id="SECID98">
18898 <title>Privilege controls</title>
18899 <informaltable frame="none">
18900 <tgroup cols="2" colsep="0" rowsep="0">
18901 <colspec colwidth="196pt" align="left"/>
18902 <colspec colwidth="254pt" align="left"/>
18905 <entry><option>admin_groups</option></entry>
18906 <entry>groups that are Exim admin users</entry>
18909 <entry><option>deliver_drop_privilege</option></entry>
18910 <entry>drop root for delivery processes</entry>
18913 <entry><option>local_from_check</option></entry>
18914 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
18917 <entry><option>local_from_prefix</option></entry>
18918 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
18921 <entry><option>local_from_suffix</option></entry>
18922 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
18925 <entry><option>local_sender_retain</option></entry>
18926 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
18929 <entry><option>never_users</option></entry>
18930 <entry>do not run deliveries as these</entry>
18933 <entry><option>prod_requires_admin</option></entry>
18934 <entry>forced delivery requires admin user</entry>
18937 <entry><option>queue_list_requires_admin</option></entry>
18938 <entry>queue listing requires admin user</entry>
18941 <entry><option>trusted_groups</option></entry>
18942 <entry>groups that are trusted</entry>
18945 <entry><option>trusted_users</option></entry>
18946 <entry>users that are trusted</entry>
18952 <section id="SECID99">
18953 <title>Logging</title>
18954 <informaltable frame="none">
18955 <tgroup cols="2" colsep="0" rowsep="0">
18956 <colspec colwidth="196pt" align="left"/>
18957 <colspec colwidth="254pt" align="left"/>
18960 <entry><option>hosts_connection_nolog</option></entry>
18961 <entry>exemption from connect logging</entry>
18964 <entry><option>log_file_path</option></entry>
18965 <entry>override compiled-in value</entry>
18968 <entry><option>log_selector</option></entry>
18969 <entry>set/unset optional logging</entry>
18972 <entry><option>log_timezone</option></entry>
18973 <entry>add timezone to log lines</entry>
18976 <entry><option>message_logs</option></entry>
18977 <entry>create per-message logs</entry>
18980 <entry><option>preserve_message_logs</option></entry>
18981 <entry>after message completion</entry>
18984 <entry><option>process_log_path</option></entry>
18985 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
18988 <entry><option>syslog_duplication</option></entry>
18989 <entry>controls duplicate log lines on syslog</entry>
18992 <entry><option>syslog_facility</option></entry>
18993 <entry>set syslog <quote>facility</quote> field</entry>
18996 <entry><option>syslog_processname</option></entry>
18997 <entry>set syslog <quote>ident</quote> field</entry>
19000 <entry><option>syslog_timestamp</option></entry>
19001 <entry>timestamp syslog lines</entry>
19004 <entry><option>write_rejectlog</option></entry>
19005 <entry>control use of message log</entry>
19011 <section id="SECID100">
19012 <title>Frozen messages</title>
19013 <informaltable frame="none">
19014 <tgroup cols="2" colsep="0" rowsep="0">
19015 <colspec colwidth="196pt" align="left"/>
19016 <colspec colwidth="254pt" align="left"/>
19019 <entry><option>auto_thaw</option></entry>
19020 <entry>sets time for retrying frozen messages</entry>
19023 <entry><option>freeze_tell</option></entry>
19024 <entry>send message when freezing</entry>
19027 <entry><option>move_frozen_messages</option></entry>
19028 <entry>to another directory</entry>
19031 <entry><option>timeout_frozen_after</option></entry>
19032 <entry>keep frozen messages only so long</entry>
19038 <section id="SECID101">
19039 <title>Data lookups</title>
19040 <informaltable frame="none">
19041 <tgroup cols="2" colsep="0" rowsep="0">
19042 <colspec colwidth="196pt" align="left"/>
19043 <colspec colwidth="254pt" align="left"/>
19046 <entry><option>ibase_servers</option></entry>
19047 <entry>InterBase servers</entry>
19050 <entry><option>ldap_default_servers</option></entry>
19051 <entry>used if no server in query</entry>
19054 <entry><option>ldap_version</option></entry>
19055 <entry>set protocol version</entry>
19058 <entry><option>lookup_open_max</option></entry>
19059 <entry>lookup files held open</entry>
19062 <entry><option>mysql_servers</option></entry>
19063 <entry>default MySQL servers</entry>
19066 <entry><option>oracle_servers</option></entry>
19067 <entry>Oracle servers</entry>
19070 <entry><option>pgsql_servers</option></entry>
19071 <entry>default PostgreSQL servers</entry>
19074 <entry><option>sqlite_lock_timeout</option></entry>
19075 <entry>as it says</entry>
19081 <section id="SECID102">
19082 <title>Message ids</title>
19083 <informaltable frame="none">
19084 <tgroup cols="2" colsep="0" rowsep="0">
19085 <colspec colwidth="196pt" align="left"/>
19086 <colspec colwidth="254pt" align="left"/>
19089 <entry><option>message_id_header_domain</option></entry>
19090 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
19093 <entry><option>message_id_header_text</option></entry>
19094 <entry>ditto</entry>
19100 <section id="SECID103">
19101 <title>Embedded Perl Startup</title>
19102 <informaltable frame="none">
19103 <tgroup cols="2" colsep="0" rowsep="0">
19104 <colspec colwidth="196pt" align="left"/>
19105 <colspec colwidth="254pt" align="left"/>
19108 <entry><option>perl_at_start</option></entry>
19109 <entry>always start the interpreter</entry>
19112 <entry><option>perl_startup</option></entry>
19113 <entry>code to obey when starting Perl</entry>
19119 <section id="SECID104">
19120 <title>Daemon</title>
19121 <informaltable frame="none">
19122 <tgroup cols="2" colsep="0" rowsep="0">
19123 <colspec colwidth="196pt" align="left"/>
19124 <colspec colwidth="254pt" align="left"/>
19127 <entry><option>daemon_smtp_ports</option></entry>
19128 <entry>default ports</entry>
19131 <entry><option>daemon_startup_retries</option></entry>
19132 <entry>number of times to retry</entry>
19135 <entry><option>daemon_startup_sleep</option></entry>
19136 <entry>time to sleep between tries</entry>
19139 <entry><option>extra_local_interfaces</option></entry>
19140 <entry>not necessarily listened on</entry>
19143 <entry><option>local_interfaces</option></entry>
19144 <entry>on which to listen, with optional ports</entry>
19147 <entry><option>pid_file_path</option></entry>
19148 <entry>override compiled-in value</entry>
19151 <entry><option>queue_run_max</option></entry>
19152 <entry>maximum simultaneous queue runners</entry>
19158 <section id="SECID105">
19159 <title>Resource control</title>
19160 <informaltable frame="none">
19161 <tgroup cols="2" colsep="0" rowsep="0">
19162 <colspec colwidth="196pt" align="left"/>
19163 <colspec colwidth="254pt" align="left"/>
19166 <entry><option>check_log_inodes</option></entry>
19167 <entry>before accepting a message</entry>
19170 <entry><option>check_log_space</option></entry>
19171 <entry>before accepting a message</entry>
19174 <entry><option>check_spool_inodes</option></entry>
19175 <entry>before accepting a message</entry>
19178 <entry><option>check_spool_space</option></entry>
19179 <entry>before accepting a message</entry>
19182 <entry><option>deliver_queue_load_max</option></entry>
19183 <entry>no queue deliveries if load high</entry>
19186 <entry><option>queue_only_load</option></entry>
19187 <entry>queue incoming if load high</entry>
19190 <entry><option>queue_only_load_latch</option></entry>
19191 <entry>don’t re-evaluate load for each message</entry>
19194 <entry><option>queue_run_max</option></entry>
19195 <entry>maximum simultaneous queue runners</entry>
19198 <entry><option>remote_max_parallel</option></entry>
19199 <entry>parallel SMTP delivery per message</entry>
19202 <entry><option>smtp_accept_max</option></entry>
19203 <entry>simultaneous incoming connections</entry>
19206 <entry><option>smtp_accept_max_nonmail</option></entry>
19207 <entry>non-mail commands</entry>
19210 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
19211 <entry>hosts to which the limit applies</entry>
19214 <entry><option>smtp_accept_max_per_connection</option></entry>
19215 <entry>messages per connection</entry>
19218 <entry><option>smtp_accept_max_per_host</option></entry>
19219 <entry>connections from one host</entry>
19222 <entry><option>smtp_accept_queue</option></entry>
19223 <entry>queue mail if more connections</entry>
19226 <entry><option>smtp_accept_queue_per_connection</option></entry>
19227 <entry>queue if more messages per connection</entry>
19230 <entry><option>smtp_accept_reserve</option></entry>
19231 <entry>only reserve hosts if more connections</entry>
19234 <entry><option>smtp_check_spool_space</option></entry>
19235 <entry>from SIZE on MAIL command</entry>
19238 <entry><option>smtp_connect_backlog</option></entry>
19239 <entry>passed to TCP/IP stack</entry>
19242 <entry><option>smtp_load_reserve</option></entry>
19243 <entry>SMTP from reserved hosts if load high</entry>
19246 <entry><option>smtp_reserve_hosts</option></entry>
19247 <entry>these are the reserve hosts</entry>
19253 <section id="SECID106">
19254 <title>Policy controls</title>
19255 <informaltable frame="none">
19256 <tgroup cols="2" colsep="0" rowsep="0">
19257 <colspec colwidth="196pt" align="left"/>
19258 <colspec colwidth="254pt" align="left"/>
19261 <entry><option>acl_not_smtp</option></entry>
19262 <entry>ACL for non-SMTP messages</entry>
19265 <entry><option>acl_not_smtp_mime</option></entry>
19266 <entry>ACL for non-SMTP MIME parts</entry>
19269 <entry><option>acl_not_smtp_start</option></entry>
19270 <entry>ACL for start of non-SMTP message</entry>
19273 <entry><option>acl_smtp_auth</option></entry>
19274 <entry>ACL for AUTH</entry>
19277 <entry><option>acl_smtp_connect</option></entry>
19278 <entry>ACL for connection</entry>
19281 <entry><option>acl_smtp_data</option></entry>
19282 <entry>ACL for DATA</entry>
19285 <entry><option>acl_smtp_etrn</option></entry>
19286 <entry>ACL for ETRN</entry>
19289 <entry><option>acl_smtp_expn</option></entry>
19290 <entry>ACL for EXPN</entry>
19293 <entry><option>acl_smtp_helo</option></entry>
19294 <entry>ACL for EHLO or HELO</entry>
19297 <entry><option>acl_smtp_mail</option></entry>
19298 <entry>ACL for MAIL</entry>
19301 <entry><option>acl_smtp_mailauth</option></entry>
19302 <entry>ACL for AUTH on MAIL command</entry>
19305 <entry><option>acl_smtp_mime</option></entry>
19306 <entry>ACL for MIME parts</entry>
19309 <entry><option>acl_smtp_predata</option></entry>
19310 <entry>ACL for start of data</entry>
19313 <entry><option>acl_smtp_quit</option></entry>
19314 <entry>ACL for QUIT</entry>
19317 <entry><option>acl_smtp_rcpt</option></entry>
19318 <entry>ACL for RCPT</entry>
19321 <entry><option>acl_smtp_starttls</option></entry>
19322 <entry>ACL for STARTTLS</entry>
19325 <entry><option>acl_smtp_vrfy</option></entry>
19326 <entry>ACL for VRFY</entry>
19329 <entry><option>av_scanner</option></entry>
19330 <entry>specify virus scanner</entry>
19333 <entry><option>check_rfc2047_length</option></entry>
19334 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
19337 <entry><option>dns_csa_search_limit</option></entry>
19338 <entry>control CSA parent search depth</entry>
19341 <entry><option>dns_csa_use_reverse</option></entry>
19342 <entry>en/disable CSA IP reverse search</entry>
19345 <entry><option>header_maxsize</option></entry>
19346 <entry>total size of message header</entry>
19349 <entry><option>header_line_maxsize</option></entry>
19350 <entry>individual header line limit</entry>
19353 <entry><option>helo_accept_junk_hosts</option></entry>
19354 <entry>allow syntactic junk from these hosts</entry>
19357 <entry><option>helo_allow_chars</option></entry>
19358 <entry>allow illegal chars in HELO names</entry>
19361 <entry><option>helo_lookup_domains</option></entry>
19362 <entry>lookup hostname for these HELO names</entry>
19365 <entry><option>helo_try_verify_hosts</option></entry>
19366 <entry>HELO soft-checked for these hosts</entry>
19369 <entry><option>helo_verify_hosts</option></entry>
19370 <entry>HELO hard-checked for these hosts</entry>
19373 <entry><option>host_lookup</option></entry>
19374 <entry>host name looked up for these hosts</entry>
19377 <entry><option>host_lookup_order</option></entry>
19378 <entry>order of DNS and local name lookups</entry>
19381 <entry><option>host_reject_connection</option></entry>
19382 <entry>reject connection from these hosts</entry>
19385 <entry><option>hosts_treat_as_local</option></entry>
19386 <entry>useful in some cluster configurations</entry>
19389 <entry><option>local_scan_timeout</option></entry>
19390 <entry>timeout for <function>local_scan()</function></entry>
19393 <entry><option>message_size_limit</option></entry>
19394 <entry>for all messages</entry>
19397 <entry><option>percent_hack_domains</option></entry>
19398 <entry>recognize %-hack for these domains</entry>
19401 <entry><option>spamd_address</option></entry>
19402 <entry>set interface to SpamAssassin</entry>
19405 <entry><option>strict_acl_vars</option></entry>
19406 <entry>object to unset ACL variables</entry>
19412 <section id="SECID107">
19413 <title>Callout cache</title>
19414 <informaltable frame="none">
19415 <tgroup cols="2" colsep="0" rowsep="0">
19416 <colspec colwidth="196pt" align="left"/>
19417 <colspec colwidth="254pt" align="left"/>
19420 <entry><option>callout_domain_negative_expire</option></entry>
19421 <entry>timeout for negative domain cache item</entry>
19424 <entry><option>callout_domain_positive_expire</option></entry>
19425 <entry>timeout for positive domain cache item</entry>
19428 <entry><option>callout_negative_expire</option></entry>
19429 <entry>timeout for negative address cache item</entry>
19432 <entry><option>callout_positive_expire</option></entry>
19433 <entry>timeout for positive address cache item</entry>
19436 <entry><option>callout_random_local_part</option></entry>
19437 <entry>string to use for <quote>random</quote> testing</entry>
19443 <section id="SECID108">
19445 <informaltable frame="none">
19446 <tgroup cols="2" colsep="0" rowsep="0">
19447 <colspec colwidth="196pt" align="left"/>
19448 <colspec colwidth="254pt" align="left"/>
19451 <entry><option>gnutls_require_kx</option></entry>
19452 <entry>control GnuTLS key exchanges</entry>
19455 <entry><option>gnutls_require_mac</option></entry>
19456 <entry>control GnuTLS MAC algorithms</entry>
19459 <entry><option>gnutls_require_protocols</option></entry>
19460 <entry>control GnuTLS protocols</entry>
19463 <entry><option>gnutls_compat_mode</option></entry>
19464 <entry>use GnuTLS compatibility mode</entry>
19467 <entry><option>tls_advertise_hosts</option></entry>
19468 <entry>advertise TLS to these hosts</entry>
19471 <entry><option>tls_certificate</option></entry>
19472 <entry>location of server certificate</entry>
19475 <entry><option>tls_crl</option></entry>
19476 <entry>certificate revocation list</entry>
19479 <entry><option>tls_dhparam</option></entry>
19480 <entry>DH parameters for server</entry>
19483 <entry><option>tls_on_connect_ports</option></entry>
19484 <entry>specify SSMTP (SMTPS) ports</entry>
19487 <entry><option>tls_privatekey</option></entry>
19488 <entry>location of server private key</entry>
19491 <entry><option>tls_remember_esmtp</option></entry>
19492 <entry>don’t reset after starting TLS</entry>
19495 <entry><option>tls_require_ciphers</option></entry>
19496 <entry>specify acceptable ciphers</entry>
19499 <entry><option>tls_try_verify_hosts</option></entry>
19500 <entry>try to verify client certificate</entry>
19503 <entry><option>tls_verify_certificates</option></entry>
19504 <entry>expected client certificates</entry>
19507 <entry><option>tls_verify_hosts</option></entry>
19508 <entry>insist on client certificate verify</entry>
19514 <section id="SECID109">
19515 <title>Local user handling</title>
19516 <informaltable frame="none">
19517 <tgroup cols="2" colsep="0" rowsep="0">
19518 <colspec colwidth="196pt" align="left"/>
19519 <colspec colwidth="254pt" align="left"/>
19522 <entry><option>finduser_retries</option></entry>
19523 <entry>useful in NIS environments</entry>
19526 <entry><option>gecos_name</option></entry>
19527 <entry>used when creating <emphasis>Sender:</emphasis></entry>
19530 <entry><option>gecos_pattern</option></entry>
19531 <entry>ditto</entry>
19534 <entry><option>max_username_length</option></entry>
19535 <entry>for systems that truncate</entry>
19538 <entry><option>unknown_login</option></entry>
19539 <entry>used when no login name found</entry>
19542 <entry><option>unknown_username</option></entry>
19543 <entry>ditto</entry>
19546 <entry><option>uucp_from_pattern</option></entry>
19547 <entry>for recognizing <quote>From </quote> lines</entry>
19550 <entry><option>uucp_from_sender</option></entry>
19551 <entry>ditto</entry>
19557 <section id="SECID110">
19558 <title>All incoming messages (SMTP and non-SMTP)</title>
19559 <informaltable frame="none">
19560 <tgroup cols="2" colsep="0" rowsep="0">
19561 <colspec colwidth="196pt" align="left"/>
19562 <colspec colwidth="254pt" align="left"/>
19565 <entry><option>header_maxsize</option></entry>
19566 <entry>total size of message header</entry>
19569 <entry><option>header_line_maxsize</option></entry>
19570 <entry>individual header line limit</entry>
19573 <entry><option>message_size_limit</option></entry>
19574 <entry>applies to all messages</entry>
19577 <entry><option>percent_hack_domains</option></entry>
19578 <entry>recognize %-hack for these domains</entry>
19581 <entry><option>received_header_text</option></entry>
19582 <entry>expanded to make <emphasis>Received:</emphasis></entry>
19585 <entry><option>received_headers_max</option></entry>
19586 <entry>for mail loop detection</entry>
19589 <entry><option>recipients_max</option></entry>
19590 <entry>limit per message</entry>
19593 <entry><option>recipients_max_reject</option></entry>
19594 <entry>permanently reject excess recipients</entry>
19600 <section id="SECID111">
19601 <title>Non-SMTP incoming messages</title>
19602 <informaltable frame="none">
19603 <tgroup cols="2" colsep="0" rowsep="0">
19604 <colspec colwidth="196pt" align="left"/>
19605 <colspec colwidth="254pt" align="left"/>
19608 <entry><option>receive_timeout</option></entry>
19609 <entry>for non-SMTP messages</entry>
19615 <section id="SECID112">
19616 <title>Incoming SMTP messages</title>
19618 See also the <emphasis>Policy controls</emphasis> section above.
19620 <informaltable frame="none">
19621 <tgroup cols="2" colsep="0" rowsep="0">
19622 <colspec colwidth="196pt" align="left"/>
19623 <colspec colwidth="254pt" align="left"/>
19626 <entry><option>host_lookup</option></entry>
19627 <entry>host name looked up for these hosts</entry>
19630 <entry><option>host_lookup_order</option></entry>
19631 <entry>order of DNS and local name lookups</entry>
19634 <entry><option>recipient_unqualified_hosts</option></entry>
19635 <entry>may send unqualified recipients</entry>
19638 <entry><option>rfc1413_hosts</option></entry>
19639 <entry>make ident calls to these hosts</entry>
19642 <entry><option>rfc1413_query_timeout</option></entry>
19643 <entry>zero disables ident calls</entry>
19646 <entry><option>sender_unqualified_hosts</option></entry>
19647 <entry>may send unqualified senders</entry>
19650 <entry><option>smtp_accept_keepalive</option></entry>
19651 <entry>some TCP/IP magic</entry>
19654 <entry><option>smtp_accept_max</option></entry>
19655 <entry>simultaneous incoming connections</entry>
19658 <entry><option>smtp_accept_max_nonmail</option></entry>
19659 <entry>non-mail commands</entry>
19662 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
19663 <entry>hosts to which the limit applies</entry>
19666 <entry><option>smtp_accept_max_per_connection</option></entry>
19667 <entry>messages per connection</entry>
19670 <entry><option>smtp_accept_max_per_host</option></entry>
19671 <entry>connections from one host</entry>
19674 <entry><option>smtp_accept_queue</option></entry>
19675 <entry>queue mail if more connections</entry>
19678 <entry><option>smtp_accept_queue_per_connection</option></entry>
19679 <entry>queue if more messages per connection</entry>
19682 <entry><option>smtp_accept_reserve</option></entry>
19683 <entry>only reserve hosts if more connections</entry>
19686 <entry><option>smtp_active_hostname</option></entry>
19687 <entry>host name to use in messages</entry>
19690 <entry><option>smtp_banner</option></entry>
19691 <entry>text for welcome banner</entry>
19694 <entry><option>smtp_check_spool_space</option></entry>
19695 <entry>from SIZE on MAIL command</entry>
19698 <entry><option>smtp_connect_backlog</option></entry>
19699 <entry>passed to TCP/IP stack</entry>
19702 <entry><option>smtp_enforce_sync</option></entry>
19703 <entry>of SMTP command/responses</entry>
19706 <entry><option>smtp_etrn_command</option></entry>
19707 <entry>what to run for ETRN</entry>
19710 <entry><option>smtp_etrn_serialize</option></entry>
19711 <entry>only one at once</entry>
19714 <entry><option>smtp_load_reserve</option></entry>
19715 <entry>only reserve hosts if this load</entry>
19718 <entry><option>smtp_max_unknown_commands</option></entry>
19719 <entry>before dropping connection</entry>
19722 <entry><option>smtp_ratelimit_hosts</option></entry>
19723 <entry>apply ratelimiting to these hosts</entry>
19726 <entry><option>smtp_ratelimit_mail</option></entry>
19727 <entry>ratelimit for MAIL commands</entry>
19730 <entry><option>smtp_ratelimit_rcpt</option></entry>
19731 <entry>ratelimit for RCPT commands</entry>
19734 <entry><option>smtp_receive_timeout</option></entry>
19735 <entry>per command or data line</entry>
19738 <entry><option>smtp_reserve_hosts</option></entry>
19739 <entry>these are the reserve hosts</entry>
19742 <entry><option>smtp_return_error_details</option></entry>
19743 <entry>give detail on rejections</entry>
19749 <section id="SECID113">
19750 <title>SMTP extensions</title>
19751 <informaltable frame="none">
19752 <tgroup cols="2" colsep="0" rowsep="0">
19753 <colspec colwidth="196pt" align="left"/>
19754 <colspec colwidth="254pt" align="left"/>
19757 <entry><option>accept_8bitmime</option></entry>
19758 <entry>advertise 8BITMIME</entry>
19761 <entry><option>auth_advertise_hosts</option></entry>
19762 <entry>advertise AUTH to these hosts</entry>
19765 <entry><option>ignore_fromline_hosts</option></entry>
19766 <entry>allow <quote>From </quote> from these hosts</entry>
19769 <entry><option>ignore_fromline_local</option></entry>
19770 <entry>allow <quote>From </quote> from local SMTP</entry>
19773 <entry><option>pipelining_advertise_hosts</option></entry>
19774 <entry>advertise pipelining to these hosts</entry>
19777 <entry><option>tls_advertise_hosts</option></entry>
19778 <entry>advertise TLS to these hosts</entry>
19784 <section id="SECID114">
19785 <title>Processing messages</title>
19786 <informaltable frame="none">
19787 <tgroup cols="2" colsep="0" rowsep="0">
19788 <colspec colwidth="196pt" align="left"/>
19789 <colspec colwidth="254pt" align="left"/>
19792 <entry><option>allow_domain_literals</option></entry>
19793 <entry>recognize domain literal syntax</entry>
19796 <entry><option>allow_mx_to_ip</option></entry>
19797 <entry>allow MX to point to IP address</entry>
19800 <entry><option>allow_utf8_domains</option></entry>
19801 <entry>in addresses</entry>
19804 <entry><option>check_rfc2047_length</option></entry>
19805 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
19808 <entry><option>delivery_date_remove</option></entry>
19809 <entry>from incoming messages</entry>
19812 <entry><option>envelope_to_remove</option></entry>
19813 <entry>from incoming messages</entry>
19816 <entry><option>extract_addresses_remove_arguments</option></entry>
19817 <entry>affects <option>-t</option> processing</entry>
19820 <entry><option>headers_charset</option></entry>
19821 <entry>default for translations</entry>
19824 <entry><option>qualify_domain</option></entry>
19825 <entry>default for senders</entry>
19828 <entry><option>qualify_recipient</option></entry>
19829 <entry>default for recipients</entry>
19832 <entry><option>return_path_remove</option></entry>
19833 <entry>from incoming messages</entry>
19836 <entry><option>strip_excess_angle_brackets</option></entry>
19837 <entry>in addresses</entry>
19840 <entry><option>strip_trailing_dot</option></entry>
19841 <entry>at end of addresses</entry>
19844 <entry><option>untrusted_set_sender</option></entry>
19845 <entry>untrusted can set envelope sender</entry>
19851 <section id="SECID115">
19852 <title>System filter</title>
19853 <informaltable frame="none">
19854 <tgroup cols="2" colsep="0" rowsep="0">
19855 <colspec colwidth="196pt" align="left"/>
19856 <colspec colwidth="254pt" align="left"/>
19859 <entry><option>system_filter</option></entry>
19860 <entry>locate system filter</entry>
19863 <entry><option>system_filter_directory_transport</option></entry>
19864 <entry>transport for delivery to a directory</entry>
19867 <entry><option>system_filter_file_transport</option></entry>
19868 <entry>transport for delivery to a file</entry>
19871 <entry><option>system_filter_group</option></entry>
19872 <entry>group for filter running</entry>
19875 <entry><option>system_filter_pipe_transport</option></entry>
19876 <entry>transport for delivery to a pipe</entry>
19879 <entry><option>system_filter_reply_transport</option></entry>
19880 <entry>transport for autoreply delivery</entry>
19883 <entry><option>system_filter_user</option></entry>
19884 <entry>user for filter running</entry>
19890 <section id="SECID116">
19891 <title>Routing and delivery</title>
19892 <informaltable frame="none">
19893 <tgroup cols="2" colsep="0" rowsep="0">
19894 <colspec colwidth="196pt" align="left"/>
19895 <colspec colwidth="254pt" align="left"/>
19898 <entry><option>disable_ipv6</option></entry>
19899 <entry>do no IPv6 processing</entry>
19902 <entry><option>dns_again_means_nonexist</option></entry>
19903 <entry>for broken domains</entry>
19906 <entry><option>dns_check_names_pattern</option></entry>
19907 <entry>pre-DNS syntax check</entry>
19910 <entry><option>dns_ipv4_lookup</option></entry>
19911 <entry>only v4 lookup for these domains</entry>
19914 <entry><option>dns_retrans</option></entry>
19915 <entry>parameter for resolver</entry>
19918 <entry><option>dns_retry</option></entry>
19919 <entry>parameter for resolver</entry>
19922 <entry><option>hold_domains</option></entry>
19923 <entry>hold delivery for these domains</entry>
19926 <entry><option>local_interfaces</option></entry>
19927 <entry>for routing checks</entry>
19930 <entry><option>queue_domains</option></entry>
19931 <entry>no immediate delivery for these</entry>
19934 <entry><option>queue_only</option></entry>
19935 <entry>no immediate delivery at all</entry>
19938 <entry><option>queue_only_file</option></entry>
19939 <entry>no immediate delivery if file exists</entry>
19942 <entry><option>queue_only_load</option></entry>
19943 <entry>no immediate delivery if load is high</entry>
19946 <entry><option>queue_only_load_latch</option></entry>
19947 <entry>don’t re-evaluate load for each message</entry>
19950 <entry><option>queue_only_override</option></entry>
19951 <entry>allow command line to override</entry>
19954 <entry><option>queue_run_in_order</option></entry>
19955 <entry>order of arrival</entry>
19958 <entry><option>queue_run_max</option></entry>
19959 <entry>of simultaneous queue runners</entry>
19962 <entry><option>queue_smtp_domains</option></entry>
19963 <entry>no immediate SMTP delivery for these</entry>
19966 <entry><option>remote_max_parallel</option></entry>
19967 <entry>parallel SMTP delivery per message</entry>
19970 <entry><option>remote_sort_domains</option></entry>
19971 <entry>order of remote deliveries</entry>
19974 <entry><option>retry_data_expire</option></entry>
19975 <entry>timeout for retry data</entry>
19978 <entry><option>retry_interval_max</option></entry>
19979 <entry>safety net for retry rules</entry>
19985 <section id="SECID117">
19986 <title>Bounce and warning messages</title>
19987 <informaltable frame="none">
19988 <tgroup cols="2" colsep="0" rowsep="0">
19989 <colspec colwidth="196pt" align="left"/>
19990 <colspec colwidth="254pt" align="left"/>
19993 <entry><option>bounce_message_file</option></entry>
19994 <entry>content of bounce</entry>
19997 <entry><option>bounce_message_text</option></entry>
19998 <entry>content of bounce</entry>
20001 <entry><option>bounce_return_body</option></entry>
20002 <entry>include body if returning message</entry>
20005 <entry><option>bounce_return_message</option></entry>
20006 <entry>include original message in bounce</entry>
20009 <entry><option>bounce_return_size_limit</option></entry>
20010 <entry>limit on returned message</entry>
20013 <entry><option>bounce_sender_authentication</option></entry>
20014 <entry>send authenticated sender with bounce</entry>
20017 <entry><option>dsn_from</option></entry>
20018 <entry>set <emphasis>From:</emphasis> contents in bounces</entry>
20021 <entry><option>errors_copy</option></entry>
20022 <entry>copy bounce messages</entry>
20025 <entry><option>errors_reply_to</option></entry>
20026 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
20029 <entry><option>delay_warning</option></entry>
20030 <entry>time schedule</entry>
20033 <entry><option>delay_warning_condition</option></entry>
20034 <entry>condition for warning messages</entry>
20037 <entry><option>ignore_bounce_errors_after</option></entry>
20038 <entry>discard undeliverable bounces</entry>
20041 <entry><option>smtp_return_error_details</option></entry>
20042 <entry>give detail on rejections</entry>
20045 <entry><option>warn_message_file</option></entry>
20046 <entry>content of warning message</entry>
20052 <section id="SECTalomo">
20053 <title>Alphabetical list of main options</title>
20055 Those options that undergo string expansion before use are marked with
20059 <indexterm role="option">
20060 <primary><option>accept_8bitmime</option></primary>
20063 <informaltable frame="all">
20064 <tgroup cols="4" colsep="0" rowsep="0">
20065 <colspec colwidth="8*" align="left"/>
20066 <colspec colwidth="6*" align="center"/>
20067 <colspec colwidth="6*" align="center"/>
20068 <colspec colwidth="6*" align="right"/>
20071 <entry><option>accept_8bitmime</option></entry>
20072 <entry>Use: <emphasis>main</emphasis></entry>
20073 <entry>Type: <emphasis>boolean</emphasis></entry>
20074 <entry>Default: <emphasis>false</emphasis></entry>
20080 <indexterm role="concept">
20081 <primary>8BITMIME</primary>
20083 <indexterm role="concept">
20084 <primary>8-bit characters</primary>
20086 This option causes Exim to send 8BITMIME in its response to an SMTP
20087 EHLO command, and to accept the BODY= parameter on MAIL commands.
20088 However, though Exim is 8-bit clean, it is not a protocol converter, and it
20089 takes no steps to do anything special with messages received by this route.
20090 Consequently, this option is turned off by default.
20093 <indexterm role="option">
20094 <primary><option>acl_not_smtp</option></primary>
20097 <informaltable frame="all">
20098 <tgroup cols="4" colsep="0" rowsep="0">
20099 <colspec colwidth="8*" align="left"/>
20100 <colspec colwidth="6*" align="center"/>
20101 <colspec colwidth="6*" align="center"/>
20102 <colspec colwidth="6*" align="right"/>
20105 <entry><option>acl_not_smtp</option></entry>
20106 <entry>Use: <emphasis>main</emphasis></entry>
20107 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20108 <entry>Default: <emphasis>unset</emphasis></entry>
20114 <indexterm role="concept">
20115 <primary>access control lists (ACLs)</primary>
20116 <secondary>for non-SMTP messages</secondary>
20118 <indexterm role="concept">
20119 <primary>non-SMTP messages</primary>
20120 <secondary>ACLs for</secondary>
20122 This option defines the ACL that is run when a non-SMTP message has been
20123 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
20127 <indexterm role="option">
20128 <primary><option>acl_not_smtp_mime</option></primary>
20131 <informaltable frame="all">
20132 <tgroup cols="4" colsep="0" rowsep="0">
20133 <colspec colwidth="8*" align="left"/>
20134 <colspec colwidth="6*" align="center"/>
20135 <colspec colwidth="6*" align="center"/>
20136 <colspec colwidth="6*" align="right"/>
20139 <entry><option>acl_not_smtp_mime</option></entry>
20140 <entry>Use: <emphasis>main</emphasis></entry>
20141 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20142 <entry>Default: <emphasis>unset</emphasis></entry>
20148 This option defines the ACL that is run for individual MIME parts of non-SMTP
20149 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
20153 <indexterm role="option">
20154 <primary><option>acl_not_smtp_start</option></primary>
20157 <informaltable frame="all">
20158 <tgroup cols="4" colsep="0" rowsep="0">
20159 <colspec colwidth="8*" align="left"/>
20160 <colspec colwidth="6*" align="center"/>
20161 <colspec colwidth="6*" align="center"/>
20162 <colspec colwidth="6*" align="right"/>
20165 <entry><option>acl_not_smtp_start</option></entry>
20166 <entry>Use: <emphasis>main</emphasis></entry>
20167 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20168 <entry>Default: <emphasis>unset</emphasis></entry>
20174 <indexterm role="concept">
20175 <primary>access control lists (ACLs)</primary>
20176 <secondary>at start of non-SMTP message</secondary>
20178 <indexterm role="concept">
20179 <primary>non-SMTP messages</primary>
20180 <secondary>ACLs for</secondary>
20182 This option defines the ACL that is run before Exim starts reading a
20183 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
20186 <indexterm role="option">
20187 <primary><option>acl_smtp_auth</option></primary>
20190 <informaltable frame="all">
20191 <tgroup cols="4" colsep="0" rowsep="0">
20192 <colspec colwidth="8*" align="left"/>
20193 <colspec colwidth="6*" align="center"/>
20194 <colspec colwidth="6*" align="center"/>
20195 <colspec colwidth="6*" align="right"/>
20198 <entry><option>acl_smtp_auth</option></entry>
20199 <entry>Use: <emphasis>main</emphasis></entry>
20200 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20201 <entry>Default: <emphasis>unset</emphasis></entry>
20207 <indexterm role="concept">
20208 <primary>access control lists (ACLs)</primary>
20209 <secondary>setting up for SMTP commands</secondary>
20211 <indexterm role="concept">
20212 <primary>AUTH</primary>
20213 <secondary>ACL for</secondary>
20215 This option defines the ACL that is run when an SMTP AUTH command is
20216 received. See chapter <xref linkend="CHAPACL"/> for further details.
20219 <indexterm role="option">
20220 <primary><option>acl_smtp_connect</option></primary>
20223 <informaltable frame="all">
20224 <tgroup cols="4" colsep="0" rowsep="0">
20225 <colspec colwidth="8*" align="left"/>
20226 <colspec colwidth="6*" align="center"/>
20227 <colspec colwidth="6*" align="center"/>
20228 <colspec colwidth="6*" align="right"/>
20231 <entry><option>acl_smtp_connect</option></entry>
20232 <entry>Use: <emphasis>main</emphasis></entry>
20233 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20234 <entry>Default: <emphasis>unset</emphasis></entry>
20240 <indexterm role="concept">
20241 <primary>access control lists (ACLs)</primary>
20242 <secondary>on SMTP connection</secondary>
20244 This option defines the ACL that is run when an SMTP connection is received.
20245 See chapter <xref linkend="CHAPACL"/> for further details.
20248 <indexterm role="option">
20249 <primary><option>acl_smtp_data</option></primary>
20252 <informaltable frame="all">
20253 <tgroup cols="4" colsep="0" rowsep="0">
20254 <colspec colwidth="8*" align="left"/>
20255 <colspec colwidth="6*" align="center"/>
20256 <colspec colwidth="6*" align="center"/>
20257 <colspec colwidth="6*" align="right"/>
20260 <entry><option>acl_smtp_data</option></entry>
20261 <entry>Use: <emphasis>main</emphasis></entry>
20262 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20263 <entry>Default: <emphasis>unset</emphasis></entry>
20269 <indexterm role="concept">
20270 <primary>DATA</primary>
20271 <secondary>ACL for</secondary>
20273 This option defines the ACL that is run after an SMTP DATA command has been
20274 processed and the message itself has been received, but before the final
20275 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
20278 <indexterm role="option">
20279 <primary><option>acl_smtp_etrn</option></primary>
20282 <informaltable frame="all">
20283 <tgroup cols="4" colsep="0" rowsep="0">
20284 <colspec colwidth="8*" align="left"/>
20285 <colspec colwidth="6*" align="center"/>
20286 <colspec colwidth="6*" align="center"/>
20287 <colspec colwidth="6*" align="right"/>
20290 <entry><option>acl_smtp_etrn</option></entry>
20291 <entry>Use: <emphasis>main</emphasis></entry>
20292 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20293 <entry>Default: <emphasis>unset</emphasis></entry>
20299 <indexterm role="concept">
20300 <primary>ETRN</primary>
20301 <secondary>ACL for</secondary>
20303 This option defines the ACL that is run when an SMTP ETRN command is
20304 received. See chapter <xref linkend="CHAPACL"/> for further details.
20307 <indexterm role="option">
20308 <primary><option>acl_smtp_expn</option></primary>
20311 <informaltable frame="all">
20312 <tgroup cols="4" colsep="0" rowsep="0">
20313 <colspec colwidth="8*" align="left"/>
20314 <colspec colwidth="6*" align="center"/>
20315 <colspec colwidth="6*" align="center"/>
20316 <colspec colwidth="6*" align="right"/>
20319 <entry><option>acl_smtp_expn</option></entry>
20320 <entry>Use: <emphasis>main</emphasis></entry>
20321 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20322 <entry>Default: <emphasis>unset</emphasis></entry>
20328 <indexterm role="concept">
20329 <primary>EXPN</primary>
20330 <secondary>ACL for</secondary>
20332 This option defines the ACL that is run when an SMTP EXPN command is
20333 received. See chapter <xref linkend="CHAPACL"/> for further details.
20336 <indexterm role="option">
20337 <primary><option>acl_smtp_helo</option></primary>
20340 <informaltable frame="all">
20341 <tgroup cols="4" colsep="0" rowsep="0">
20342 <colspec colwidth="8*" align="left"/>
20343 <colspec colwidth="6*" align="center"/>
20344 <colspec colwidth="6*" align="center"/>
20345 <colspec colwidth="6*" align="right"/>
20348 <entry><option>acl_smtp_helo</option></entry>
20349 <entry>Use: <emphasis>main</emphasis></entry>
20350 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20351 <entry>Default: <emphasis>unset</emphasis></entry>
20357 <indexterm role="concept">
20358 <primary>EHLO</primary>
20359 <secondary>ACL for</secondary>
20361 <indexterm role="concept">
20362 <primary>HELO</primary>
20363 <secondary>ACL for</secondary>
20365 This option defines the ACL that is run when an SMTP EHLO or HELO
20366 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
20369 <indexterm role="option">
20370 <primary><option>acl_smtp_mail</option></primary>
20373 <informaltable frame="all">
20374 <tgroup cols="4" colsep="0" rowsep="0">
20375 <colspec colwidth="8*" align="left"/>
20376 <colspec colwidth="6*" align="center"/>
20377 <colspec colwidth="6*" align="center"/>
20378 <colspec colwidth="6*" align="right"/>
20381 <entry><option>acl_smtp_mail</option></entry>
20382 <entry>Use: <emphasis>main</emphasis></entry>
20383 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20384 <entry>Default: <emphasis>unset</emphasis></entry>
20390 <indexterm role="concept">
20391 <primary>MAIL</primary>
20392 <secondary>ACL for</secondary>
20394 This option defines the ACL that is run when an SMTP MAIL command is
20395 received. See chapter <xref linkend="CHAPACL"/> for further details.
20398 <indexterm role="option">
20399 <primary><option>acl_smtp_mailauth</option></primary>
20402 <informaltable frame="all">
20403 <tgroup cols="4" colsep="0" rowsep="0">
20404 <colspec colwidth="8*" align="left"/>
20405 <colspec colwidth="6*" align="center"/>
20406 <colspec colwidth="6*" align="center"/>
20407 <colspec colwidth="6*" align="right"/>
20410 <entry><option>acl_smtp_mailauth</option></entry>
20411 <entry>Use: <emphasis>main</emphasis></entry>
20412 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20413 <entry>Default: <emphasis>unset</emphasis></entry>
20419 <indexterm role="concept">
20420 <primary>AUTH</primary>
20421 <secondary>on MAIL command</secondary>
20423 This option defines the ACL that is run when there is an AUTH parameter on
20424 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
20425 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
20428 <indexterm role="option">
20429 <primary><option>acl_smtp_mime</option></primary>
20432 <informaltable frame="all">
20433 <tgroup cols="4" colsep="0" rowsep="0">
20434 <colspec colwidth="8*" align="left"/>
20435 <colspec colwidth="6*" align="center"/>
20436 <colspec colwidth="6*" align="center"/>
20437 <colspec colwidth="6*" align="right"/>
20440 <entry><option>acl_smtp_mime</option></entry>
20441 <entry>Use: <emphasis>main</emphasis></entry>
20442 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20443 <entry>Default: <emphasis>unset</emphasis></entry>
20449 <indexterm role="concept">
20450 <primary>MIME content scanning</primary>
20451 <secondary>ACL for</secondary>
20453 This option is available when Exim is built with the content-scanning
20454 extension. It defines the ACL that is run for each MIME part in a message. See
20455 section <xref linkend="SECTscanmimepart"/> for details.
20458 <indexterm role="option">
20459 <primary><option>acl_smtp_predata</option></primary>
20462 <informaltable frame="all">
20463 <tgroup cols="4" colsep="0" rowsep="0">
20464 <colspec colwidth="8*" align="left"/>
20465 <colspec colwidth="6*" align="center"/>
20466 <colspec colwidth="6*" align="center"/>
20467 <colspec colwidth="6*" align="right"/>
20470 <entry><option>acl_smtp_predata</option></entry>
20471 <entry>Use: <emphasis>main</emphasis></entry>
20472 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20473 <entry>Default: <emphasis>unset</emphasis></entry>
20479 This option defines the ACL that is run when an SMTP DATA command is
20480 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
20484 <indexterm role="option">
20485 <primary><option>acl_smtp_quit</option></primary>
20488 <informaltable frame="all">
20489 <tgroup cols="4" colsep="0" rowsep="0">
20490 <colspec colwidth="8*" align="left"/>
20491 <colspec colwidth="6*" align="center"/>
20492 <colspec colwidth="6*" align="center"/>
20493 <colspec colwidth="6*" align="right"/>
20496 <entry><option>acl_smtp_quit</option></entry>
20497 <entry>Use: <emphasis>main</emphasis></entry>
20498 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20499 <entry>Default: <emphasis>unset</emphasis></entry>
20505 <indexterm role="concept">
20506 <primary>QUIT, ACL for</primary>
20508 This option defines the ACL that is run when an SMTP QUIT command is
20509 received. See chapter <xref linkend="CHAPACL"/> for further details.
20512 <indexterm role="option">
20513 <primary><option>acl_smtp_rcpt</option></primary>
20516 <informaltable frame="all">
20517 <tgroup cols="4" colsep="0" rowsep="0">
20518 <colspec colwidth="8*" align="left"/>
20519 <colspec colwidth="6*" align="center"/>
20520 <colspec colwidth="6*" align="center"/>
20521 <colspec colwidth="6*" align="right"/>
20524 <entry><option>acl_smtp_rcpt</option></entry>
20525 <entry>Use: <emphasis>main</emphasis></entry>
20526 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20527 <entry>Default: <emphasis>unset</emphasis></entry>
20533 <indexterm role="concept">
20534 <primary>RCPT</primary>
20535 <secondary>ACL for</secondary>
20537 This option defines the ACL that is run when an SMTP RCPT command is
20538 received. See chapter <xref linkend="CHAPACL"/> for further details.
20541 <indexterm role="option">
20542 <primary><option>acl_smtp_starttls</option></primary>
20545 <informaltable frame="all">
20546 <tgroup cols="4" colsep="0" rowsep="0">
20547 <colspec colwidth="8*" align="left"/>
20548 <colspec colwidth="6*" align="center"/>
20549 <colspec colwidth="6*" align="center"/>
20550 <colspec colwidth="6*" align="right"/>
20553 <entry><option>acl_smtp_starttls</option></entry>
20554 <entry>Use: <emphasis>main</emphasis></entry>
20555 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20556 <entry>Default: <emphasis>unset</emphasis></entry>
20562 <indexterm role="concept">
20563 <primary>STARTTLS, ACL for</primary>
20565 This option defines the ACL that is run when an SMTP STARTTLS command is
20566 received. See chapter <xref linkend="CHAPACL"/> for further details.
20569 <indexterm role="option">
20570 <primary><option>acl_smtp_vrfy</option></primary>
20573 <informaltable frame="all">
20574 <tgroup cols="4" colsep="0" rowsep="0">
20575 <colspec colwidth="8*" align="left"/>
20576 <colspec colwidth="6*" align="center"/>
20577 <colspec colwidth="6*" align="center"/>
20578 <colspec colwidth="6*" align="right"/>
20581 <entry><option>acl_smtp_vrfy</option></entry>
20582 <entry>Use: <emphasis>main</emphasis></entry>
20583 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20584 <entry>Default: <emphasis>unset</emphasis></entry>
20590 <indexterm role="concept">
20591 <primary>VRFY</primary>
20592 <secondary>ACL for</secondary>
20594 This option defines the ACL that is run when an SMTP VRFY command is
20595 received. See chapter <xref linkend="CHAPACL"/> for further details.
20598 <indexterm role="option">
20599 <primary><option>admin_groups</option></primary>
20602 <informaltable frame="all">
20603 <tgroup cols="4" colsep="0" rowsep="0">
20604 <colspec colwidth="8*" align="left"/>
20605 <colspec colwidth="6*" align="center"/>
20606 <colspec colwidth="6*" align="center"/>
20607 <colspec colwidth="6*" align="right"/>
20610 <entry><option>admin_groups</option></entry>
20611 <entry>Use: <emphasis>main</emphasis></entry>
20612 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
20613 <entry>Default: <emphasis>unset</emphasis></entry>
20619 <indexterm role="concept">
20620 <primary>admin user</primary>
20622 This option is expanded just once, at the start of Exim’s processing. If the
20623 current group or any of the supplementary groups of an Exim caller is in this
20624 colon-separated list, the caller has admin privileges. If all your system
20625 programmers are in a specific group, for example, you can give them all Exim
20626 admin privileges by putting that group in <option>admin_groups</option>. However, this does
20627 not permit them to read Exim’s spool files (whose group owner is the Exim gid).
20628 To permit this, you have to add individuals to the Exim group.
20631 <indexterm role="option">
20632 <primary><option>allow_domain_literals</option></primary>
20635 <informaltable frame="all">
20636 <tgroup cols="4" colsep="0" rowsep="0">
20637 <colspec colwidth="8*" align="left"/>
20638 <colspec colwidth="6*" align="center"/>
20639 <colspec colwidth="6*" align="center"/>
20640 <colspec colwidth="6*" align="right"/>
20643 <entry><option>allow_domain_literals</option></entry>
20644 <entry>Use: <emphasis>main</emphasis></entry>
20645 <entry>Type: <emphasis>boolean</emphasis></entry>
20646 <entry>Default: <emphasis>false</emphasis></entry>
20652 <indexterm role="concept">
20653 <primary>domain literal</primary>
20655 If this option is set, the RFC 2822 domain literal format is permitted in
20656 email addresses. The option is not set by default, because the domain literal
20657 format is not normally required these days, and few people know about it. It
20658 has, however, been exploited by mail abusers.
20661 Unfortunately, it seems that some DNS black list maintainers are using this
20662 format to report black listing to postmasters. If you want to accept messages
20663 addressed to your hosts by IP address, you need to set
20664 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
20665 domains (defined in the named domain list <option>local_domains</option> in the default
20666 configuration). This <quote>magic string</quote> matches the domain literal form of all
20667 the local host’s IP addresses.
20670 <indexterm role="option">
20671 <primary><option>allow_mx_to_ip</option></primary>
20674 <informaltable frame="all">
20675 <tgroup cols="4" colsep="0" rowsep="0">
20676 <colspec colwidth="8*" align="left"/>
20677 <colspec colwidth="6*" align="center"/>
20678 <colspec colwidth="6*" align="center"/>
20679 <colspec colwidth="6*" align="right"/>
20682 <entry><option>allow_mx_to_ip</option></entry>
20683 <entry>Use: <emphasis>main</emphasis></entry>
20684 <entry>Type: <emphasis>boolean</emphasis></entry>
20685 <entry>Default: <emphasis>false</emphasis></entry>
20691 <indexterm role="concept">
20692 <primary>MX record</primary>
20693 <secondary>pointing to IP address</secondary>
20695 It appears that more and more DNS zone administrators are breaking the rules
20696 and putting domain names that look like IP addresses on the right hand side of
20697 MX records. Exim follows the rules and rejects this, giving an error message
20698 that explains the mis-configuration. However, some other MTAs support this
20699 practice, so to avoid <quote>Why can’t Exim do this?</quote> complaints,
20700 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
20701 recommended, except when you have no other choice.
20704 <indexterm role="option">
20705 <primary><option>allow_utf8_domains</option></primary>
20708 <informaltable frame="all">
20709 <tgroup cols="4" colsep="0" rowsep="0">
20710 <colspec colwidth="8*" align="left"/>
20711 <colspec colwidth="6*" align="center"/>
20712 <colspec colwidth="6*" align="center"/>
20713 <colspec colwidth="6*" align="right"/>
20716 <entry><option>allow_utf8_domains</option></entry>
20717 <entry>Use: <emphasis>main</emphasis></entry>
20718 <entry>Type: <emphasis>boolean</emphasis></entry>
20719 <entry>Default: <emphasis>false</emphasis></entry>
20725 <indexterm role="concept">
20726 <primary>domain</primary>
20727 <secondary>UTF-8 characters in</secondary>
20729 <indexterm role="concept">
20730 <primary>UTF-8</primary>
20731 <secondary>in domain name</secondary>
20733 Lots of discussion is going on about internationalized domain names. One
20734 camp is strongly in favour of just using UTF-8 characters, and it seems
20735 that at least two other MTAs permit this. This option allows Exim users to
20736 experiment if they wish.
20739 If it is set true, Exim’s domain parsing function allows valid
20740 UTF-8 multicharacters to appear in domain name components, in addition to
20741 letters, digits, and hyphens. However, just setting this option is not
20742 enough; if you want to look up these domain names in the DNS, you must also
20743 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
20744 suitable setting is:
20746 <literallayout class="monospaced">
20747 dns_check_names_pattern = (?i)^(?>(?(1)\.|())[a-z0-9\xc0-\xff]\
20748 (?>[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
20751 Alternatively, you can just disable this feature by setting
20753 <literallayout class="monospaced">
20754 dns_check_names_pattern =
20757 That is, set the option to an empty string so that no check is done.
20760 <indexterm role="option">
20761 <primary><option>auth_advertise_hosts</option></primary>
20764 <informaltable frame="all">
20765 <tgroup cols="4" colsep="0" rowsep="0">
20766 <colspec colwidth="8*" align="left"/>
20767 <colspec colwidth="6*" align="center"/>
20768 <colspec colwidth="6*" align="center"/>
20769 <colspec colwidth="6*" align="right"/>
20772 <entry><option>auth_advertise_hosts</option></entry>
20773 <entry>Use: <emphasis>main</emphasis></entry>
20774 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
20775 <entry>Default: <emphasis>*</emphasis></entry>
20781 <indexterm role="concept">
20782 <primary>authentication</primary>
20783 <secondary>advertising</secondary>
20785 <indexterm role="concept">
20786 <primary>AUTH</primary>
20787 <secondary>advertising</secondary>
20789 If any server authentication mechanisms are configured, Exim advertises them in
20790 response to an EHLO command only if the calling host matches this list.
20791 Otherwise, Exim does not advertise AUTH.
20792 Exim does not accept AUTH commands from clients to which it has not
20793 advertised the availability of AUTH. The advertising of individual
20794 authentication mechanisms can be controlled by the use of the
20795 <option>server_advertise_condition</option> generic authenticator option on the individual
20796 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
20799 Certain mail clients (for example, Netscape) require the user to provide a name
20800 and password for authentication if AUTH is advertised, even though it may
20801 not be needed (the host may accept messages from hosts on its local LAN without
20802 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
20803 to make these clients more friendly by excluding them from the set of hosts to
20804 which Exim advertises AUTH.
20807 <indexterm role="concept">
20808 <primary>AUTH</primary>
20809 <secondary>advertising when encrypted</secondary>
20811 If you want to advertise the availability of AUTH only when the connection
20812 is encrypted using TLS, you can make use of the fact that the value of this
20813 option is expanded, with a setting like this:
20815 <literallayout class="monospaced">
20816 auth_advertise_hosts = ${if eq{$tls_cipher}{}{}{*}}
20819 <indexterm role="variable">
20820 <primary><varname>$tls_cipher</varname></primary>
20822 If <varname>$tls_cipher</varname> is empty, the session is not encrypted, and the result of
20823 the expansion is empty, thus matching no hosts. Otherwise, the result of the
20824 expansion is *, which matches all hosts.
20827 <indexterm role="option">
20828 <primary><option>auto_thaw</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>auto_thaw</option></entry>
20840 <entry>Use: <emphasis>main</emphasis></entry>
20841 <entry>Type: <emphasis>time</emphasis></entry>
20842 <entry>Default: <emphasis>0s</emphasis></entry>
20848 <indexterm role="concept">
20849 <primary>thawing messages</primary>
20851 <indexterm role="concept">
20852 <primary>unfreezing messages</primary>
20854 If this option is set to a time greater than zero, a queue runner will try a
20855 new delivery attempt on any frozen message, other than a bounce message, if
20856 this much time has passed since it was frozen. This may result in the message
20857 being re-frozen if nothing has changed since the last attempt. It is a way of
20858 saying <quote>keep on trying, even though there are big problems</quote>.
20861 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
20862 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
20863 thought to be very useful any more, and its use should probably be avoided.
20866 <indexterm role="option">
20867 <primary><option>av_scanner</option></primary>
20870 <informaltable frame="all">
20871 <tgroup cols="4" colsep="0" rowsep="0">
20872 <colspec colwidth="8*" align="left"/>
20873 <colspec colwidth="6*" align="center"/>
20874 <colspec colwidth="6*" align="center"/>
20875 <colspec colwidth="6*" align="right"/>
20878 <entry><option>av_scanner</option></entry>
20879 <entry>Use: <emphasis>main</emphasis></entry>
20880 <entry>Type: <emphasis>string</emphasis></entry>
20881 <entry>Default: <emphasis>see below</emphasis></entry>
20887 This option is available if Exim is built with the content-scanning extension.
20888 It specifies which anti-virus scanner to use. The default value is:
20890 <literallayout class="monospaced">
20891 sophie:/var/run/sophie
20894 If the value of <option>av_scanner</option> starts with dollar character, it is expanded
20895 before use. See section <xref linkend="SECTscanvirus"/> for further details.
20898 <indexterm role="option">
20899 <primary><option>bi_command</option></primary>
20902 <informaltable frame="all">
20903 <tgroup cols="4" colsep="0" rowsep="0">
20904 <colspec colwidth="8*" align="left"/>
20905 <colspec colwidth="6*" align="center"/>
20906 <colspec colwidth="6*" align="center"/>
20907 <colspec colwidth="6*" align="right"/>
20910 <entry><option>bi_command</option></entry>
20911 <entry>Use: <emphasis>main</emphasis></entry>
20912 <entry>Type: <emphasis>string</emphasis></entry>
20913 <entry>Default: <emphasis>unset</emphasis></entry>
20919 <indexterm role="option">
20920 <primary><option>-bi</option></primary>
20922 This option supplies the name of a command that is run when Exim is called with
20923 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
20924 just the command name, it is not a complete command line. If an argument is
20925 required, it must come from the <option>-oA</option> command line option.
20928 <indexterm role="option">
20929 <primary><option>bounce_message_file</option></primary>
20932 <informaltable frame="all">
20933 <tgroup cols="4" colsep="0" rowsep="0">
20934 <colspec colwidth="8*" align="left"/>
20935 <colspec colwidth="6*" align="center"/>
20936 <colspec colwidth="6*" align="center"/>
20937 <colspec colwidth="6*" align="right"/>
20940 <entry><option>bounce_message_file</option></entry>
20941 <entry>Use: <emphasis>main</emphasis></entry>
20942 <entry>Type: <emphasis>string</emphasis></entry>
20943 <entry>Default: <emphasis>unset</emphasis></entry>
20949 <indexterm role="concept">
20950 <primary>bounce message</primary>
20951 <secondary>customizing</secondary>
20953 <indexterm role="concept">
20954 <primary>customizing</primary>
20955 <secondary>bounce message</secondary>
20957 This option defines a template file containing paragraphs of text to be used
20958 for constructing bounce messages. Details of the file’s contents are given in
20959 chapter <xref linkend="CHAPemsgcust"/>. See also <option>warn_message_file</option>.
20962 <indexterm role="option">
20963 <primary><option>bounce_message_text</option></primary>
20966 <informaltable frame="all">
20967 <tgroup cols="4" colsep="0" rowsep="0">
20968 <colspec colwidth="8*" align="left"/>
20969 <colspec colwidth="6*" align="center"/>
20970 <colspec colwidth="6*" align="center"/>
20971 <colspec colwidth="6*" align="right"/>
20974 <entry><option>bounce_message_text</option></entry>
20975 <entry>Use: <emphasis>main</emphasis></entry>
20976 <entry>Type: <emphasis>string</emphasis></entry>
20977 <entry>Default: <emphasis>unset</emphasis></entry>
20983 When this option is set, its contents are included in the default bounce
20984 message immediately after <quote>This message was created automatically by mail
20985 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
20988 <indexterm role="option">
20989 <primary><option>bounce_return_body</option></primary>
20992 <informaltable frame="all">
20993 <tgroup cols="4" colsep="0" rowsep="0">
20994 <colspec colwidth="8*" align="left"/>
20995 <colspec colwidth="6*" align="center"/>
20996 <colspec colwidth="6*" align="center"/>
20997 <colspec colwidth="6*" align="right"/>
21000 <entry><option>bounce_return_body</option></entry>
21001 <entry>Use: <emphasis>main</emphasis></entry>
21002 <entry>Type: <emphasis>boolean</emphasis></entry>
21003 <entry>Default: <emphasis>true</emphasis></entry>
21009 <indexterm role="concept">
21010 <primary>bounce message</primary>
21011 <secondary>including body</secondary>
21013 This option controls whether the body of an incoming message is included in a
21014 bounce message when <option>bounce_return_message</option> is true. The default setting
21015 causes the entire message, both header and body, to be returned (subject to the
21016 value of <option>bounce_return_size_limit</option>). If this option is false, only the
21017 message header is included. In the case of a non-SMTP message containing an
21018 error that is detected during reception, only those header lines preceding the
21019 point at which the error was detected are returned.
21020 <indexterm role="concept">
21021 <primary>bounce message</primary>
21022 <secondary>including original</secondary>
21026 <indexterm role="option">
21027 <primary><option>bounce_return_message</option></primary>
21030 <informaltable frame="all">
21031 <tgroup cols="4" colsep="0" rowsep="0">
21032 <colspec colwidth="8*" align="left"/>
21033 <colspec colwidth="6*" align="center"/>
21034 <colspec colwidth="6*" align="center"/>
21035 <colspec colwidth="6*" align="right"/>
21038 <entry><option>bounce_return_message</option></entry>
21039 <entry>Use: <emphasis>main</emphasis></entry>
21040 <entry>Type: <emphasis>boolean</emphasis></entry>
21041 <entry>Default: <emphasis>true</emphasis></entry>
21047 If this option is set false, none of the original message is included in
21048 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
21049 <option>bounce_return_body</option>.
21052 <indexterm role="option">
21053 <primary><option>bounce_return_size_limit</option></primary>
21056 <informaltable frame="all">
21057 <tgroup cols="4" colsep="0" rowsep="0">
21058 <colspec colwidth="8*" align="left"/>
21059 <colspec colwidth="6*" align="center"/>
21060 <colspec colwidth="6*" align="center"/>
21061 <colspec colwidth="6*" align="right"/>
21064 <entry><option>bounce_return_size_limit</option></entry>
21065 <entry>Use: <emphasis>main</emphasis></entry>
21066 <entry>Type: <emphasis>integer</emphasis></entry>
21067 <entry>Default: <emphasis>100K</emphasis></entry>
21073 <indexterm role="concept">
21074 <primary>size</primary>
21075 <secondary>of bounce, limit</secondary>
21077 <indexterm role="concept">
21078 <primary>bounce message</primary>
21079 <secondary>size limit</secondary>
21081 <indexterm role="concept">
21082 <primary>limit</primary>
21083 <secondary>bounce message size</secondary>
21085 This option sets a limit in bytes on the size of messages that are returned to
21086 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
21087 limit should be less than the value of the global <option>message_size_limit</option> and of
21088 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
21089 that Exim generates. If this option is set to zero there is no limit.
21092 When the body of any message that is to be included in a bounce message is
21093 greater than the limit, it is truncated, and a comment pointing this out is
21094 added at the top. The actual cutoff may be greater than the value given, owing
21095 to the use of buffering for transferring the message in chunks (typically 8K in
21096 size). The idea is to save bandwidth on those undeliverable 15-megabyte
21100 <indexterm role="option">
21101 <primary><option>bounce_sender_authentication</option></primary>
21104 <informaltable frame="all">
21105 <tgroup cols="4" colsep="0" rowsep="0">
21106 <colspec colwidth="8*" align="left"/>
21107 <colspec colwidth="6*" align="center"/>
21108 <colspec colwidth="6*" align="center"/>
21109 <colspec colwidth="6*" align="right"/>
21112 <entry><option>bounce_sender_authentication</option></entry>
21113 <entry>Use: <emphasis>main</emphasis></entry>
21114 <entry>Type: <emphasis>string</emphasis></entry>
21115 <entry>Default: <emphasis>unset</emphasis></entry>
21121 <indexterm role="concept">
21122 <primary>bounce message</primary>
21123 <secondary>sender authentication</secondary>
21125 <indexterm role="concept">
21126 <primary>authentication</primary>
21127 <secondary>bounce message</secondary>
21129 <indexterm role="concept">
21130 <primary>AUTH</primary>
21131 <secondary>on bounce message</secondary>
21133 This option provides an authenticated sender address that is sent with any
21134 bounce messages generated by Exim that are sent over an authenticated SMTP
21135 connection. A typical setting might be:
21137 <literallayout class="monospaced">
21138 bounce_sender_authentication = mailer-daemon@my.domain.example
21141 which would cause bounce messages to be sent using the SMTP command:
21143 <literallayout class="monospaced">
21144 MAIL FROM:<> AUTH=mailer-daemon@my.domain.example
21147 The value of <option>bounce_sender_authentication</option> must always be a complete email
21151 <indexterm role="option">
21152 <primary><option>callout_domain_negative_expire</option></primary>
21155 <informaltable frame="all">
21156 <tgroup cols="4" colsep="0" rowsep="0">
21157 <colspec colwidth="8*" align="left"/>
21158 <colspec colwidth="6*" align="center"/>
21159 <colspec colwidth="6*" align="center"/>
21160 <colspec colwidth="6*" align="right"/>
21163 <entry><option>callout_domain_negative_expire</option></entry>
21164 <entry>Use: <emphasis>main</emphasis></entry>
21165 <entry>Type: <emphasis>time</emphasis></entry>
21166 <entry>Default: <emphasis>3h</emphasis></entry>
21172 <indexterm role="concept">
21173 <primary>caching</primary>
21174 <secondary>callout timeouts</secondary>
21176 <indexterm role="concept">
21177 <primary>callout</primary>
21178 <secondary>caching timeouts</secondary>
21180 This option specifies the expiry time for negative callout cache data for a
21181 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21182 section <xref linkend="SECTcallvercache"/> for details of the caching.
21185 <indexterm role="option">
21186 <primary><option>callout_domain_positive_expire</option></primary>
21189 <informaltable frame="all">
21190 <tgroup cols="4" colsep="0" rowsep="0">
21191 <colspec colwidth="8*" align="left"/>
21192 <colspec colwidth="6*" align="center"/>
21193 <colspec colwidth="6*" align="center"/>
21194 <colspec colwidth="6*" align="right"/>
21197 <entry><option>callout_domain_positive_expire</option></entry>
21198 <entry>Use: <emphasis>main</emphasis></entry>
21199 <entry>Type: <emphasis>time</emphasis></entry>
21200 <entry>Default: <emphasis>7d</emphasis></entry>
21206 This option specifies the expiry time for positive callout cache data for a
21207 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21208 section <xref linkend="SECTcallvercache"/> for details of the caching.
21211 <indexterm role="option">
21212 <primary><option>callout_negative_expire</option></primary>
21215 <informaltable frame="all">
21216 <tgroup cols="4" colsep="0" rowsep="0">
21217 <colspec colwidth="8*" align="left"/>
21218 <colspec colwidth="6*" align="center"/>
21219 <colspec colwidth="6*" align="center"/>
21220 <colspec colwidth="6*" align="right"/>
21223 <entry><option>callout_negative_expire</option></entry>
21224 <entry>Use: <emphasis>main</emphasis></entry>
21225 <entry>Type: <emphasis>time</emphasis></entry>
21226 <entry>Default: <emphasis>2h</emphasis></entry>
21232 This option specifies the expiry time for negative callout cache data for an
21233 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21234 section <xref linkend="SECTcallvercache"/> for details of the caching.
21237 <indexterm role="option">
21238 <primary><option>callout_positive_expire</option></primary>
21241 <informaltable frame="all">
21242 <tgroup cols="4" colsep="0" rowsep="0">
21243 <colspec colwidth="8*" align="left"/>
21244 <colspec colwidth="6*" align="center"/>
21245 <colspec colwidth="6*" align="center"/>
21246 <colspec colwidth="6*" align="right"/>
21249 <entry><option>callout_positive_expire</option></entry>
21250 <entry>Use: <emphasis>main</emphasis></entry>
21251 <entry>Type: <emphasis>time</emphasis></entry>
21252 <entry>Default: <emphasis>24h</emphasis></entry>
21258 This option specifies the expiry time for positive callout cache data for an
21259 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21260 section <xref linkend="SECTcallvercache"/> for details of the caching.
21263 <indexterm role="option">
21264 <primary><option>callout_random_local_part</option></primary>
21267 <informaltable frame="all">
21268 <tgroup cols="4" colsep="0" rowsep="0">
21269 <colspec colwidth="8*" align="left"/>
21270 <colspec colwidth="6*" align="center"/>
21271 <colspec colwidth="6*" align="center"/>
21272 <colspec colwidth="6*" align="right"/>
21275 <entry><option>callout_random_local_part</option></entry>
21276 <entry>Use: <emphasis>main</emphasis></entry>
21277 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
21278 <entry>Default: <emphasis>see below</emphasis></entry>
21284 This option defines the <quote>random</quote> local part that can be used as part of
21285 callout verification. The default value is
21287 <literallayout class="monospaced">
21288 $primary_host_name-$tod_epoch-testing
21291 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
21294 <indexterm role="option">
21295 <primary><option>check_log_inodes</option></primary>
21298 <informaltable frame="all">
21299 <tgroup cols="4" colsep="0" rowsep="0">
21300 <colspec colwidth="8*" align="left"/>
21301 <colspec colwidth="6*" align="center"/>
21302 <colspec colwidth="6*" align="center"/>
21303 <colspec colwidth="6*" align="right"/>
21306 <entry><option>check_log_inodes</option></entry>
21307 <entry>Use: <emphasis>main</emphasis></entry>
21308 <entry>Type: <emphasis>integer</emphasis></entry>
21309 <entry>Default: <emphasis>0</emphasis></entry>
21315 See <option>check_spool_space</option> below.
21318 <indexterm role="option">
21319 <primary><option>check_log_space</option></primary>
21322 <informaltable frame="all">
21323 <tgroup cols="4" colsep="0" rowsep="0">
21324 <colspec colwidth="8*" align="left"/>
21325 <colspec colwidth="6*" align="center"/>
21326 <colspec colwidth="6*" align="center"/>
21327 <colspec colwidth="6*" align="right"/>
21330 <entry><option>check_log_space</option></entry>
21331 <entry>Use: <emphasis>main</emphasis></entry>
21332 <entry>Type: <emphasis>integer</emphasis></entry>
21333 <entry>Default: <emphasis>0</emphasis></entry>
21339 See <option>check_spool_space</option> below.
21342 <indexterm role="option">
21343 <primary><option>check_rfc2047_length</option></primary>
21345 <indexterm role="concept">
21346 <primary>RFC 2047</primary>
21347 <secondary>disabling length check</secondary>
21349 <indexterm role="option">
21350 <primary><option>check_rfc2047_length</option></primary>
21353 <informaltable frame="all">
21354 <tgroup cols="4" colsep="0" rowsep="0">
21355 <colspec colwidth="8*" align="left"/>
21356 <colspec colwidth="6*" align="center"/>
21357 <colspec colwidth="6*" align="center"/>
21358 <colspec colwidth="6*" align="right"/>
21361 <entry><option>check_rfc2047_length</option></entry>
21362 <entry>Use: <emphasis>main</emphasis></entry>
21363 <entry>Type: <emphasis>boolean</emphasis></entry>
21364 <entry>Default: <emphasis>true</emphasis></entry>
21370 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
21371 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
21372 word; strings to be encoded that exceed this length are supposed to use
21373 multiple encoded words. By default, Exim does not recognize encoded words that
21374 exceed the maximum length. However, it seems that some software, in violation
21375 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
21376 set false, Exim recognizes encoded words of any length.
21379 <indexterm role="option">
21380 <primary><option>check_spool_inodes</option></primary>
21383 <informaltable frame="all">
21384 <tgroup cols="4" colsep="0" rowsep="0">
21385 <colspec colwidth="8*" align="left"/>
21386 <colspec colwidth="6*" align="center"/>
21387 <colspec colwidth="6*" align="center"/>
21388 <colspec colwidth="6*" align="right"/>
21391 <entry><option>check_spool_inodes</option></entry>
21392 <entry>Use: <emphasis>main</emphasis></entry>
21393 <entry>Type: <emphasis>integer</emphasis></entry>
21394 <entry>Default: <emphasis>0</emphasis></entry>
21400 See <option>check_spool_space</option> below.
21403 <indexterm role="option">
21404 <primary><option>check_spool_space</option></primary>
21407 <informaltable frame="all">
21408 <tgroup cols="4" colsep="0" rowsep="0">
21409 <colspec colwidth="8*" align="left"/>
21410 <colspec colwidth="6*" align="center"/>
21411 <colspec colwidth="6*" align="center"/>
21412 <colspec colwidth="6*" align="right"/>
21415 <entry><option>check_spool_space</option></entry>
21416 <entry>Use: <emphasis>main</emphasis></entry>
21417 <entry>Type: <emphasis>integer</emphasis></entry>
21418 <entry>Default: <emphasis>0</emphasis></entry>
21424 <indexterm role="concept">
21425 <primary>checking disk space</primary>
21427 <indexterm role="concept">
21428 <primary>disk space, checking</primary>
21430 <indexterm role="concept">
21431 <primary>spool directory</primary>
21432 <secondary>checking space</secondary>
21434 The four <option>check_...</option> options allow for checking of disk resources before a
21435 message is accepted.
21438 <indexterm role="variable">
21439 <primary><varname>$log_inodes</varname></primary>
21441 <indexterm role="variable">
21442 <primary><varname>$log_space</varname></primary>
21444 <indexterm role="variable">
21445 <primary><varname>$spool_inodes</varname></primary>
21447 <indexterm role="variable">
21448 <primary><varname>$spool_space</varname></primary>
21450 When any of these options are set, they apply to all incoming messages. If you
21451 want to apply different checks to different kinds of message, you can do so by
21452 testing the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
21453 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
21456 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
21457 either value is greater than zero, for example:
21459 <literallayout class="monospaced">
21460 check_spool_space = 10M
21461 check_spool_inodes = 100
21464 The spool partition is the one that contains the directory defined by
21465 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
21469 <option>check_log_space</option> and <option>check_log_inodes</option> check the partition in which log
21470 files are written if either is greater than zero. These should be set only if
21471 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
21474 If there is less space or fewer inodes than requested, Exim refuses to accept
21475 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
21476 error response to the MAIL command. If ESMTP is in use and there was a
21477 SIZE parameter on the MAIL command, its value is added to the
21478 <option>check_spool_space</option> value, and the check is performed even if
21479 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
21482 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
21483 number of kilobytes. If a non-multiple of 1024 is specified, it is rounded up.
21486 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
21487 failure a message is written to stderr and Exim exits with a non-zero code, as
21488 it obviously cannot send an error message of any kind.
21491 <indexterm role="option">
21492 <primary><option>daemon_smtp_ports</option></primary>
21495 <informaltable frame="all">
21496 <tgroup cols="4" colsep="0" rowsep="0">
21497 <colspec colwidth="8*" align="left"/>
21498 <colspec colwidth="6*" align="center"/>
21499 <colspec colwidth="6*" align="center"/>
21500 <colspec colwidth="6*" align="right"/>
21503 <entry><option>daemon_smtp_ports</option></entry>
21504 <entry>Use: <emphasis>main</emphasis></entry>
21505 <entry>Type: <emphasis>string</emphasis></entry>
21506 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
21512 <indexterm role="concept">
21513 <primary>port</primary>
21514 <secondary>for daemon</secondary>
21516 <indexterm role="concept">
21517 <primary>TCP/IP</primary>
21518 <secondary>setting listening ports</secondary>
21520 This option specifies one or more default SMTP ports on which the Exim daemon
21521 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
21522 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
21525 <indexterm role="option">
21526 <primary><option>daemon_startup_retries</option></primary>
21529 <informaltable frame="all">
21530 <tgroup cols="4" colsep="0" rowsep="0">
21531 <colspec colwidth="8*" align="left"/>
21532 <colspec colwidth="6*" align="center"/>
21533 <colspec colwidth="6*" align="center"/>
21534 <colspec colwidth="6*" align="right"/>
21537 <entry><option>daemon_startup_retries</option></entry>
21538 <entry>Use: <emphasis>main</emphasis></entry>
21539 <entry>Type: <emphasis>integer</emphasis></entry>
21540 <entry>Default: <emphasis>9</emphasis></entry>
21546 <indexterm role="concept">
21547 <primary>daemon startup, retrying</primary>
21549 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
21550 the daemon at startup when it cannot immediately bind a listening socket
21551 (typically because the socket is already in use): <option>daemon_startup_retries</option>
21552 defines the number of retries after the first failure, and
21553 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
21556 <indexterm role="option">
21557 <primary><option>daemon_startup_sleep</option></primary>
21560 <informaltable frame="all">
21561 <tgroup cols="4" colsep="0" rowsep="0">
21562 <colspec colwidth="8*" align="left"/>
21563 <colspec colwidth="6*" align="center"/>
21564 <colspec colwidth="6*" align="center"/>
21565 <colspec colwidth="6*" align="right"/>
21568 <entry><option>daemon_startup_sleep</option></entry>
21569 <entry>Use: <emphasis>main</emphasis></entry>
21570 <entry>Type: <emphasis>time</emphasis></entry>
21571 <entry>Default: <emphasis>30s</emphasis></entry>
21577 See <option>daemon_startup_retries</option>.
21580 <indexterm role="option">
21581 <primary><option>delay_warning</option></primary>
21584 <informaltable frame="all">
21585 <tgroup cols="4" colsep="0" rowsep="0">
21586 <colspec colwidth="8*" align="left"/>
21587 <colspec colwidth="6*" align="center"/>
21588 <colspec colwidth="6*" align="center"/>
21589 <colspec colwidth="6*" align="right"/>
21592 <entry><option>delay_warning</option></entry>
21593 <entry>Use: <emphasis>main</emphasis></entry>
21594 <entry>Type: <emphasis>time list</emphasis></entry>
21595 <entry>Default: <emphasis>24h</emphasis></entry>
21601 <indexterm role="concept">
21602 <primary>warning of delay</primary>
21604 <indexterm role="concept">
21605 <primary>delay warning, specifying</primary>
21607 When a message is delayed, Exim sends a warning message to the sender at
21608 intervals specified by this option. The data is a colon-separated list of times
21609 after which to send warning messages. If the value of the option is an empty
21610 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
21611 message has been on the queue for longer than the last time, the last interval
21612 between the times is used to compute subsequent warning times. For example,
21615 <literallayout class="monospaced">
21616 delay_warning = 4h:8h:24h
21619 the first message is sent after 4 hours, the second after 8 hours, and
21620 the third one after 24 hours. After that, messages are sent every 16 hours,
21621 because that is the interval between the last two times on the list. If you set
21622 just one time, it specifies the repeat interval. For example, with:
21624 <literallayout class="monospaced">
21628 messages are repeated every six hours. To stop warnings after a given time, set
21629 a very large time at the end of the list. For example:
21631 <literallayout class="monospaced">
21632 delay_warning = 2h:12h:99d
21635 <indexterm role="option">
21636 <primary><option>delay_warning_condition</option></primary>
21639 <informaltable frame="all">
21640 <tgroup cols="4" colsep="0" rowsep="0">
21641 <colspec colwidth="8*" align="left"/>
21642 <colspec colwidth="6*" align="center"/>
21643 <colspec colwidth="6*" align="center"/>
21644 <colspec colwidth="6*" align="right"/>
21647 <entry><option>delay_warning_condition</option></entry>
21648 <entry>Use: <emphasis>main</emphasis></entry>
21649 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
21650 <entry>Default: <emphasis>see below</emphasis></entry>
21656 <indexterm role="variable">
21657 <primary><varname>$domain</varname></primary>
21659 The string is expanded at the time a warning message might be sent. If all the
21660 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
21661 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
21662 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
21663 <quote>false</quote> (the comparison being done caselessly) then the warning message is
21664 not sent. The default is:
21666 <literallayout class="monospaced">
21667 delay_warning_condition = ${if or {\
21668 { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
21669 { match{$h_precedence:}{(?i)bulk|list|junk} }\
21670 { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
21674 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
21675 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
21676 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
21677 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
21680 <indexterm role="option">
21681 <primary><option>deliver_drop_privilege</option></primary>
21684 <informaltable frame="all">
21685 <tgroup cols="4" colsep="0" rowsep="0">
21686 <colspec colwidth="8*" align="left"/>
21687 <colspec colwidth="6*" align="center"/>
21688 <colspec colwidth="6*" align="center"/>
21689 <colspec colwidth="6*" align="right"/>
21692 <entry><option>deliver_drop_privilege</option></entry>
21693 <entry>Use: <emphasis>main</emphasis></entry>
21694 <entry>Type: <emphasis>boolean</emphasis></entry>
21695 <entry>Default: <emphasis>false</emphasis></entry>
21701 <indexterm role="concept">
21702 <primary>unprivileged delivery</primary>
21704 <indexterm role="concept">
21705 <primary>delivery</primary>
21706 <secondary>unprivileged</secondary>
21708 If this option is set true, Exim drops its root privilege at the start of a
21709 delivery process, and runs as the Exim user throughout. This severely restricts
21710 the kinds of local delivery that are possible, but is viable in certain types
21711 of configuration. There is a discussion about the use of root privilege in
21712 chapter <xref linkend="CHAPsecurity"/>.
21715 <indexterm role="option">
21716 <primary><option>deliver_queue_load_max</option></primary>
21719 <informaltable frame="all">
21720 <tgroup cols="4" colsep="0" rowsep="0">
21721 <colspec colwidth="8*" align="left"/>
21722 <colspec colwidth="6*" align="center"/>
21723 <colspec colwidth="6*" align="center"/>
21724 <colspec colwidth="6*" align="right"/>
21727 <entry><option>deliver_queue_load_max</option></entry>
21728 <entry>Use: <emphasis>main</emphasis></entry>
21729 <entry>Type: <emphasis>fixed-point</emphasis></entry>
21730 <entry>Default: <emphasis>unset</emphasis></entry>
21736 <indexterm role="concept">
21737 <primary>load average</primary>
21739 <indexterm role="concept">
21740 <primary>queue runner</primary>
21741 <secondary>abandoning</secondary>
21743 When this option is set, a queue run is abandoned if the system load average
21744 becomes greater than the value of the option. The option has no effect on
21745 ancient operating systems on which Exim cannot determine the load average.
21746 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
21749 <indexterm role="option">
21750 <primary><option>delivery_date_remove</option></primary>
21753 <informaltable frame="all">
21754 <tgroup cols="4" colsep="0" rowsep="0">
21755 <colspec colwidth="8*" align="left"/>
21756 <colspec colwidth="6*" align="center"/>
21757 <colspec colwidth="6*" align="center"/>
21758 <colspec colwidth="6*" align="right"/>
21761 <entry><option>delivery_date_remove</option></entry>
21762 <entry>Use: <emphasis>main</emphasis></entry>
21763 <entry>Type: <emphasis>boolean</emphasis></entry>
21764 <entry>Default: <emphasis>true</emphasis></entry>
21770 <indexterm role="concept">
21771 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
21773 Exim’s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
21774 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
21775 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
21776 should not be present in incoming messages, and this option causes them to be
21777 removed at the time the message is received, to avoid any problems that might
21778 occur when a delivered message is subsequently sent on to some other recipient.
21781 <indexterm role="option">
21782 <primary><option>disable_fsync</option></primary>
21785 <informaltable frame="all">
21786 <tgroup cols="4" colsep="0" rowsep="0">
21787 <colspec colwidth="8*" align="left"/>
21788 <colspec colwidth="6*" align="center"/>
21789 <colspec colwidth="6*" align="center"/>
21790 <colspec colwidth="6*" align="right"/>
21793 <entry><option>disable_fsync</option></entry>
21794 <entry>Use: <emphasis>main</emphasis></entry>
21795 <entry>Type: <emphasis>boolean</emphasis></entry>
21796 <entry>Default: <emphasis>false</emphasis></entry>
21802 <indexterm role="concept">
21803 <primary><function>fsync()</function>, disabling</primary>
21805 This option is available only if Exim was built with the compile-time option
21806 ENABLE_DISABLE_FSYNC. When this is not set, a reference to <option>disable_fsync</option> in
21807 a runtime configuration generates an <quote>unknown option</quote> error. You should not
21808 build Exim with ENABLE_DISABLE_FSYNC or set <option>disable_fsync</option> unless you
21809 really, really, really understand what you are doing. <emphasis>No pre-compiled
21810 distributions of Exim should ever make this option available.</emphasis>
21813 When <option>disable_fsync</option> is set true, Exim no longer calls <function>fsync()</function> to force
21814 updated files’ data to be written to disc before continuing. Unexpected events
21815 such as crashes and power outages may cause data to be lost or scrambled.
21816 Here be Dragons. <emphasis role="bold">Beware.</emphasis>
21819 <indexterm role="option">
21820 <primary><option>disable_ipv6</option></primary>
21823 <informaltable frame="all">
21824 <tgroup cols="4" colsep="0" rowsep="0">
21825 <colspec colwidth="8*" align="left"/>
21826 <colspec colwidth="6*" align="center"/>
21827 <colspec colwidth="6*" align="center"/>
21828 <colspec colwidth="6*" align="right"/>
21831 <entry><option>disable_ipv6</option></entry>
21832 <entry>Use: <emphasis>main</emphasis></entry>
21833 <entry>Type: <emphasis>boolean</emphasis></entry>
21834 <entry>Default: <emphasis>false</emphasis></entry>
21840 <indexterm role="concept">
21841 <primary>IPv6</primary>
21842 <secondary>disabling</secondary>
21844 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
21845 activities take place. AAAA records are never looked up, and any IPv6 addresses
21846 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
21847 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
21848 to handle IPv6 literal addresses.
21851 <indexterm role="option">
21852 <primary><option>dns_again_means_nonexist</option></primary>
21855 <informaltable frame="all">
21856 <tgroup cols="4" colsep="0" rowsep="0">
21857 <colspec colwidth="8*" align="left"/>
21858 <colspec colwidth="6*" align="center"/>
21859 <colspec colwidth="6*" align="center"/>
21860 <colspec colwidth="6*" align="right"/>
21863 <entry><option>dns_again_means_nonexist</option></entry>
21864 <entry>Use: <emphasis>main</emphasis></entry>
21865 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
21866 <entry>Default: <emphasis>unset</emphasis></entry>
21872 <indexterm role="concept">
21873 <primary>DNS</primary>
21874 <secondary><quote>try again</quote> response; overriding</secondary>
21876 DNS lookups give a <quote>try again</quote> response for the DNS errors
21877 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
21878 keep trying to deliver a message, or to give repeated temporary errors to
21879 incoming mail. Sometimes the effect is caused by a badly set up name server and
21880 may persist for a long time. If a domain which exhibits this problem matches
21881 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
21882 This option should be used with care. You can make it apply to reverse lookups
21883 by a setting such as this:
21885 <literallayout class="monospaced">
21886 dns_again_means_nonexist = *.in-addr.arpa
21889 This option applies to all DNS lookups that Exim does. It also applies when the
21890 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
21891 since these are most likely to be caused by DNS lookup problems. The
21892 <command>dnslookup</command> router has some options of its own for controlling what happens
21893 when lookups for MX or SRV records give temporary errors. These more specific
21894 options are applied after this global option.
21897 <indexterm role="option">
21898 <primary><option>dns_check_names_pattern</option></primary>
21901 <informaltable frame="all">
21902 <tgroup cols="4" colsep="0" rowsep="0">
21903 <colspec colwidth="8*" align="left"/>
21904 <colspec colwidth="6*" align="center"/>
21905 <colspec colwidth="6*" align="center"/>
21906 <colspec colwidth="6*" align="right"/>
21909 <entry><option>dns_check_names_pattern</option></entry>
21910 <entry>Use: <emphasis>main</emphasis></entry>
21911 <entry>Type: <emphasis>string</emphasis></entry>
21912 <entry>Default: <emphasis>see below</emphasis></entry>
21918 <indexterm role="concept">
21919 <primary>DNS</primary>
21920 <secondary>pre-check of name syntax</secondary>
21922 When this option is set to a non-empty string, it causes Exim to check domain
21923 names for characters that are not allowed in host names before handing them to
21924 the DNS resolver, because some resolvers give temporary errors for names that
21925 contain unusual characters. If a domain name contains any unwanted characters,
21926 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
21927 done by matching the domain name against a regular expression, which is the
21928 value of this option. The default pattern is
21930 <literallayout class="monospaced">
21931 dns_check_names_pattern = \
21932 (?i)^(?>(?(1)\.|())[^\W_](?>[a-z0-9/-]*[^\W_])?)+$
21935 which permits only letters, digits, slashes, and hyphens in components, but
21936 they must start and end with a letter or digit. Slashes are not, in fact,
21937 permitted in host names, but they are found in certain NS records (which can be
21938 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
21939 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
21943 <indexterm role="option">
21944 <primary><option>dns_csa_search_limit</option></primary>
21947 <informaltable frame="all">
21948 <tgroup cols="4" colsep="0" rowsep="0">
21949 <colspec colwidth="8*" align="left"/>
21950 <colspec colwidth="6*" align="center"/>
21951 <colspec colwidth="6*" align="center"/>
21952 <colspec colwidth="6*" align="right"/>
21955 <entry><option>dns_csa_search_limit</option></entry>
21956 <entry>Use: <emphasis>main</emphasis></entry>
21957 <entry>Type: <emphasis>integer</emphasis></entry>
21958 <entry>Default: <emphasis>5</emphasis></entry>
21964 This option controls the depth of parental searching for CSA SRV records in the
21965 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
21968 <indexterm role="option">
21969 <primary><option>dns_csa_use_reverse</option></primary>
21972 <informaltable frame="all">
21973 <tgroup cols="4" colsep="0" rowsep="0">
21974 <colspec colwidth="8*" align="left"/>
21975 <colspec colwidth="6*" align="center"/>
21976 <colspec colwidth="6*" align="center"/>
21977 <colspec colwidth="6*" align="right"/>
21980 <entry><option>dns_csa_use_reverse</option></entry>
21981 <entry>Use: <emphasis>main</emphasis></entry>
21982 <entry>Type: <emphasis>boolean</emphasis></entry>
21983 <entry>Default: <emphasis>true</emphasis></entry>
21989 This option controls whether or not an IP address, given as a CSA domain, is
21990 reversed and looked up in the reverse DNS, as described in more detail in
21991 section <xref linkend="SECTverifyCSA"/>.
21994 <indexterm role="option">
21995 <primary><option>dns_ipv4_lookup</option></primary>
21998 <informaltable frame="all">
21999 <tgroup cols="4" colsep="0" rowsep="0">
22000 <colspec colwidth="8*" align="left"/>
22001 <colspec colwidth="6*" align="center"/>
22002 <colspec colwidth="6*" align="center"/>
22003 <colspec colwidth="6*" align="right"/>
22006 <entry><option>dns_ipv4_lookup</option></entry>
22007 <entry>Use: <emphasis>main</emphasis></entry>
22008 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
22009 <entry>Default: <emphasis>unset</emphasis></entry>
22015 <indexterm role="concept">
22016 <primary>IPv6</primary>
22017 <secondary>DNS lookup for AAAA records</secondary>
22019 <indexterm role="concept">
22020 <primary>DNS</primary>
22021 <secondary>IPv6 lookup for AAAA records</secondary>
22023 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
22024 looks for IPv6 address records (AAAA records) as well as IPv4 address records
22025 (A records) when trying to find IP addresses for hosts, unless the host’s
22026 domain matches this list.
22029 This is a fudge to help with name servers that give big delays or otherwise do
22030 not work for the AAAA record type. In due course, when the world’s name
22031 servers have all been upgraded, there should be no need for this option.
22034 <indexterm role="option">
22035 <primary><option>dns_retrans</option></primary>
22038 <informaltable frame="all">
22039 <tgroup cols="4" colsep="0" rowsep="0">
22040 <colspec colwidth="8*" align="left"/>
22041 <colspec colwidth="6*" align="center"/>
22042 <colspec colwidth="6*" align="center"/>
22043 <colspec colwidth="6*" align="right"/>
22046 <entry><option>dns_retrans</option></entry>
22047 <entry>Use: <emphasis>main</emphasis></entry>
22048 <entry>Type: <emphasis>time</emphasis></entry>
22049 <entry>Default: <emphasis>0s</emphasis></entry>
22055 <indexterm role="concept">
22056 <primary>DNS</primary>
22057 <secondary>resolver options</secondary>
22059 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
22060 retransmission and retry parameters for DNS lookups. Values of zero (the
22061 defaults) leave the system default settings unchanged. The first value is the
22062 time between retries, and the second is the number of retries. It isn’t
22063 totally clear exactly how these settings affect the total time a DNS lookup may
22064 take. I haven’t found any documentation about timeouts on DNS lookups; these
22065 parameter values are available in the external resolver interface structure,
22066 but nowhere does it seem to describe how they are used or what you might want
22070 <indexterm role="option">
22071 <primary><option>dns_retry</option></primary>
22074 <informaltable frame="all">
22075 <tgroup cols="4" colsep="0" rowsep="0">
22076 <colspec colwidth="8*" align="left"/>
22077 <colspec colwidth="6*" align="center"/>
22078 <colspec colwidth="6*" align="center"/>
22079 <colspec colwidth="6*" align="right"/>
22082 <entry><option>dns_retry</option></entry>
22083 <entry>Use: <emphasis>main</emphasis></entry>
22084 <entry>Type: <emphasis>integer</emphasis></entry>
22085 <entry>Default: <emphasis>0</emphasis></entry>
22091 See <option>dns_retrans</option> above.
22094 <indexterm role="option">
22095 <primary><option>drop_cr</option></primary>
22098 <informaltable frame="all">
22099 <tgroup cols="4" colsep="0" rowsep="0">
22100 <colspec colwidth="8*" align="left"/>
22101 <colspec colwidth="6*" align="center"/>
22102 <colspec colwidth="6*" align="center"/>
22103 <colspec colwidth="6*" align="right"/>
22106 <entry><option>drop_cr</option></entry>
22107 <entry>Use: <emphasis>main</emphasis></entry>
22108 <entry>Type: <emphasis>boolean</emphasis></entry>
22109 <entry>Default: <emphasis>false</emphasis></entry>
22115 This is an obsolete option that is now a no-op. It used to affect the way Exim
22116 handled CR and LF characters in incoming messages. What happens now is
22117 described in section <xref linkend="SECTlineendings"/>.
22120 <indexterm role="option">
22121 <primary><option>dsn_from</option></primary>
22124 <informaltable frame="all">
22125 <tgroup cols="4" colsep="0" rowsep="0">
22126 <colspec colwidth="8*" align="left"/>
22127 <colspec colwidth="6*" align="center"/>
22128 <colspec colwidth="6*" align="center"/>
22129 <colspec colwidth="6*" align="right"/>
22132 <entry><option>dsn_from</option></entry>
22133 <entry>Use: <emphasis>main</emphasis></entry>
22134 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
22135 <entry>Default: <emphasis>see below</emphasis></entry>
22141 <indexterm role="concept">
22142 <primary><emphasis>From:</emphasis> header line</primary>
22143 <secondary>in bounces</secondary>
22145 <indexterm role="concept">
22146 <primary>bounce messages</primary>
22147 <secondary><emphasis>From:</emphasis> line, specifying</secondary>
22149 This option can be used to vary the contents of <emphasis>From:</emphasis> header lines in
22150 bounces and other automatically generated messages (<quote>Delivery Status
22151 Notifications</quote> – hence the name of the option). The default setting is:
22153 <literallayout class="monospaced">
22154 dsn_from = Mail Delivery System <Mailer-Daemon@$qualify_domain>
22157 The value is expanded every time it is needed. If the expansion fails, a
22158 panic is logged, and the default value is used.
22161 <indexterm role="option">
22162 <primary><option>envelope_to_remove</option></primary>
22165 <informaltable frame="all">
22166 <tgroup cols="4" colsep="0" rowsep="0">
22167 <colspec colwidth="8*" align="left"/>
22168 <colspec colwidth="6*" align="center"/>
22169 <colspec colwidth="6*" align="center"/>
22170 <colspec colwidth="6*" align="right"/>
22173 <entry><option>envelope_to_remove</option></entry>
22174 <entry>Use: <emphasis>main</emphasis></entry>
22175 <entry>Type: <emphasis>boolean</emphasis></entry>
22176 <entry>Default: <emphasis>true</emphasis></entry>
22182 <indexterm role="concept">
22183 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
22185 Exim’s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
22186 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
22187 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
22188 messages’s envelope that caused the delivery to happen. Such headers should not
22189 be present in incoming messages, and this option causes them to be removed at
22190 the time the message is received, to avoid any problems that might occur when a
22191 delivered message is subsequently sent on to some other recipient.
22194 <indexterm role="option">
22195 <primary><option>errors_copy</option></primary>
22198 <informaltable frame="all">
22199 <tgroup cols="4" colsep="0" rowsep="0">
22200 <colspec colwidth="8*" align="left"/>
22201 <colspec colwidth="6*" align="center"/>
22202 <colspec colwidth="6*" align="center"/>
22203 <colspec colwidth="6*" align="right"/>
22206 <entry><option>errors_copy</option></entry>
22207 <entry>Use: <emphasis>main</emphasis></entry>
22208 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
22209 <entry>Default: <emphasis>unset</emphasis></entry>
22215 <indexterm role="concept">
22216 <primary>bounce message</primary>
22217 <secondary>copy to other address</secondary>
22219 <indexterm role="concept">
22220 <primary>copy of bounce message</primary>
22222 Setting this option causes Exim to send bcc copies of bounce messages that it
22223 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
22224 coming from elsewhere. The value of the option is a colon-separated list of
22225 items. Each item consists of a pattern, terminated by white space, followed by
22226 a comma-separated list of email addresses. If a pattern contains spaces, it
22227 must be enclosed in double quotes.
22230 Each pattern is processed in the same way as a single item in an address list
22231 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
22232 the bounce message, the message is copied to the addresses on the list. The
22233 items are scanned in order, and once a matching one is found, no further items
22234 are examined. For example:
22236 <literallayout class="monospaced">
22237 errors_copy = spqr@mydomain postmaster@mydomain.example :\
22238 rqps@mydomain hostmaster@mydomain.example,\
22239 postmaster@mydomain.example
22242 <indexterm role="variable">
22243 <primary><varname>$domain</varname></primary>
22245 <indexterm role="variable">
22246 <primary><varname>$local_part</varname></primary>
22248 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
22249 and <varname>$domain</varname> are set from the original recipient of the error message, and if
22250 there was any wildcard matching in the pattern, the expansion
22251 <indexterm role="concept">
22252 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
22253 <secondary>in <option>errors_copy</option></secondary>
22255 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
22258 <indexterm role="option">
22259 <primary><option>errors_reply_to</option></primary>
22262 <informaltable frame="all">
22263 <tgroup cols="4" colsep="0" rowsep="0">
22264 <colspec colwidth="8*" align="left"/>
22265 <colspec colwidth="6*" align="center"/>
22266 <colspec colwidth="6*" align="center"/>
22267 <colspec colwidth="6*" align="right"/>
22270 <entry><option>errors_reply_to</option></entry>
22271 <entry>Use: <emphasis>main</emphasis></entry>
22272 <entry>Type: <emphasis>string</emphasis></entry>
22273 <entry>Default: <emphasis>unset</emphasis></entry>
22279 <indexterm role="concept">
22280 <primary>bounce message</primary>
22281 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
22283 By default, Exim’s bounce and delivery warning messages contain the header line
22286 <literal>From: Mail Delivery System <Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>></literal>
22289 <indexterm role="option">
22290 <primary><option>quota_warn_message</option></primary>
22292 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
22293 A warning message that is generated by the <option>quota_warn_message</option> option in an
22294 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
22295 overrides the default.
22298 Experience shows that people reply to bounce messages. If the
22299 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
22300 and warning messages. For example:
22302 <literallayout class="monospaced">
22303 errors_reply_to = postmaster@my.domain.example
22306 The value of the option is not expanded. It must specify a valid RFC 2822
22307 address. However, if a warning message that is generated by the
22308 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
22309 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
22313 <indexterm role="option">
22314 <primary><option>exim_group</option></primary>
22317 <informaltable frame="all">
22318 <tgroup cols="4" colsep="0" rowsep="0">
22319 <colspec colwidth="8*" align="left"/>
22320 <colspec colwidth="6*" align="center"/>
22321 <colspec colwidth="6*" align="center"/>
22322 <colspec colwidth="6*" align="right"/>
22325 <entry><option>exim_group</option></entry>
22326 <entry>Use: <emphasis>main</emphasis></entry>
22327 <entry>Type: <emphasis>string</emphasis></entry>
22328 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
22334 <indexterm role="concept">
22335 <primary>gid (group id)</primary>
22336 <secondary>Exim’s own</secondary>
22338 <indexterm role="concept">
22339 <primary>Exim group</primary>
22341 This option changes the gid under which Exim runs when it gives up root
22342 privilege. The default value is compiled into the binary. The value of this
22343 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
22344 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
22345 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
22349 <indexterm role="option">
22350 <primary><option>exim_path</option></primary>
22353 <informaltable frame="all">
22354 <tgroup cols="4" colsep="0" rowsep="0">
22355 <colspec colwidth="8*" align="left"/>
22356 <colspec colwidth="6*" align="center"/>
22357 <colspec colwidth="6*" align="center"/>
22358 <colspec colwidth="6*" align="right"/>
22361 <entry><option>exim_path</option></entry>
22362 <entry>Use: <emphasis>main</emphasis></entry>
22363 <entry>Type: <emphasis>string</emphasis></entry>
22364 <entry>Default: <emphasis>see below</emphasis></entry>
22370 <indexterm role="concept">
22371 <primary>Exim binary, path name</primary>
22373 This option specifies the path name of the Exim binary, which is used when Exim
22374 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
22375 the directory configured at compile time by the BIN_DIRECTORY setting. It
22376 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
22378 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
22379 you will break those Exim utilities that scan the configuration file to find
22380 where the binary is. (They then use the <option>-bP</option> option to extract option
22381 settings such as the value of <option>spool_directory</option>.)
22384 <indexterm role="option">
22385 <primary><option>exim_user</option></primary>
22388 <informaltable frame="all">
22389 <tgroup cols="4" colsep="0" rowsep="0">
22390 <colspec colwidth="8*" align="left"/>
22391 <colspec colwidth="6*" align="center"/>
22392 <colspec colwidth="6*" align="center"/>
22393 <colspec colwidth="6*" align="right"/>
22396 <entry><option>exim_user</option></entry>
22397 <entry>Use: <emphasis>main</emphasis></entry>
22398 <entry>Type: <emphasis>string</emphasis></entry>
22399 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
22405 <indexterm role="concept">
22406 <primary>uid (user id)</primary>
22407 <secondary>Exim’s own</secondary>
22409 <indexterm role="concept">
22410 <primary>Exim user</primary>
22412 This option changes the uid under which Exim runs when it gives up root
22413 privilege. The default value is compiled into the binary. Ownership of the run
22414 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
22415 options is checked against the values in the binary, not what is set here.
22418 Unless it consists entirely of digits, the string is looked up using
22419 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
22420 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
22421 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
22424 <indexterm role="option">
22425 <primary><option>extra_local_interfaces</option></primary>
22428 <informaltable frame="all">
22429 <tgroup cols="4" colsep="0" rowsep="0">
22430 <colspec colwidth="8*" align="left"/>
22431 <colspec colwidth="6*" align="center"/>
22432 <colspec colwidth="6*" align="center"/>
22433 <colspec colwidth="6*" align="right"/>
22436 <entry><option>extra_local_interfaces</option></entry>
22437 <entry>Use: <emphasis>main</emphasis></entry>
22438 <entry>Type: <emphasis>string list</emphasis></entry>
22439 <entry>Default: <emphasis>unset</emphasis></entry>
22445 This option defines network interfaces that are to be considered local when
22446 routing, but which are not used for listening by the daemon. See section
22447 <xref linkend="SECTreclocipadd"/> for details.
22450 <indexterm role="option">
22451 <primary><option>extract_addresses_remove_arguments</option></primary>
22454 <informaltable frame="all">
22455 <tgroup cols="4" colsep="0" rowsep="0">
22456 <colspec colwidth="8*" align="left"/>
22457 <colspec colwidth="6*" align="center"/>
22458 <colspec colwidth="6*" align="center"/>
22459 <colspec colwidth="6*" align="right"/>
22462 <entry><option>extract_addresses_remove_ arguments</option></entry>
22463 <entry>Use: <emphasis>main</emphasis></entry>
22464 <entry>Type: <emphasis>boolean</emphasis></entry>
22465 <entry>Default: <emphasis>true</emphasis></entry>
22471 <indexterm role="option">
22472 <primary><option>-t</option></primary>
22474 <indexterm role="concept">
22475 <primary>command line</primary>
22476 <secondary>addresses with <option>-t</option></secondary>
22478 <indexterm role="concept">
22479 <primary>Sendmail compatibility</primary>
22480 <secondary><option>-t</option> option</secondary>
22482 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
22483 are present on the command line when the <option>-t</option> option is used to build an
22484 envelope from a message’s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
22485 line addresses are removed from the recipients list. This is also how Smail
22486 behaves. However, other Sendmail documentation (the O’Reilly book) states that
22487 command line addresses are added to those obtained from the header lines. When
22488 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
22489 argument headers. If it is set false, Exim adds rather than removes argument
22493 <indexterm role="option">
22494 <primary><option>finduser_retries</option></primary>
22497 <informaltable frame="all">
22498 <tgroup cols="4" colsep="0" rowsep="0">
22499 <colspec colwidth="8*" align="left"/>
22500 <colspec colwidth="6*" align="center"/>
22501 <colspec colwidth="6*" align="center"/>
22502 <colspec colwidth="6*" align="right"/>
22505 <entry><option>finduser_retries</option></entry>
22506 <entry>Use: <emphasis>main</emphasis></entry>
22507 <entry>Type: <emphasis>integer</emphasis></entry>
22508 <entry>Default: <emphasis>0</emphasis></entry>
22514 <indexterm role="concept">
22515 <primary>NIS, retrying user lookups</primary>
22517 On systems running NIS or other schemes in which user and group information is
22518 distributed from a remote system, there can be times when <function>getpwnam()</function> and
22519 related functions fail, even when given valid data, because things time out.
22520 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
22521 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
22522 many extra times to find a user or a group, waiting for one second between
22526 <indexterm role="concept">
22527 <primary><filename>/etc/passwd</filename></primary>
22528 <secondary>multiple reading of</secondary>
22530 You should not set this option greater than zero if your user information is in
22531 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
22532 search the file multiple times for non-existent users, and also cause delay.
22535 <indexterm role="option">
22536 <primary><option>freeze_tell</option></primary>
22539 <informaltable frame="all">
22540 <tgroup cols="4" colsep="0" rowsep="0">
22541 <colspec colwidth="8*" align="left"/>
22542 <colspec colwidth="6*" align="center"/>
22543 <colspec colwidth="6*" align="center"/>
22544 <colspec colwidth="6*" align="right"/>
22547 <entry><option>freeze_tell</option></entry>
22548 <entry>Use: <emphasis>main</emphasis></entry>
22549 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
22550 <entry>Default: <emphasis>unset</emphasis></entry>
22556 <indexterm role="concept">
22557 <primary>freezing messages</primary>
22558 <secondary>sending a message when freezing</secondary>
22560 On encountering certain errors, or when configured to do so in a system filter,
22561 ACL, or special router, Exim freezes a message. This means that no further
22562 delivery attempts take place until an administrator thaws the message, or the
22563 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
22564 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
22565 warning message whenever it freezes something, unless the message it is
22566 freezing is a locally-generated bounce message. (Without this exception there
22567 is the possibility of looping.) The warning message is sent to the addresses
22568 supplied as the comma-separated value of this option. If several of the
22569 message’s addresses cause freezing, only a single message is sent. If the
22570 freezing was automatic, the reason(s) for freezing can be found in the message
22571 log. If you configure freezing in a filter or ACL, you must arrange for any
22572 logging that you require.
22575 <indexterm role="option">
22576 <primary><option>gecos_name</option></primary>
22579 <informaltable frame="all">
22580 <tgroup cols="4" colsep="0" rowsep="0">
22581 <colspec colwidth="8*" align="left"/>
22582 <colspec colwidth="6*" align="center"/>
22583 <colspec colwidth="6*" align="center"/>
22584 <colspec colwidth="6*" align="right"/>
22587 <entry><option>gecos_name</option></entry>
22588 <entry>Use: <emphasis>main</emphasis></entry>
22589 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
22590 <entry>Default: <emphasis>unset</emphasis></entry>
22596 <indexterm role="concept">
22597 <primary>HP-UX</primary>
22599 <indexterm role="concept">
22600 <primary><quote>gecos</quote> field, parsing</primary>
22602 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
22603 password file to hold other information in addition to users’ real names. Exim
22604 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
22605 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
22606 of the field are used unchanged, except that, if an ampersand is encountered,
22607 it is replaced by the user’s login name with the first character forced to
22608 upper case, since this is a convention that is observed on many systems.
22611 When these options are set, <option>gecos_pattern</option> is treated as a regular
22612 expression that is to be applied to the field (again with & replaced by the
22613 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
22614 user’s name.
22617 <indexterm role="concept">
22618 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
22619 <secondary>in <option>gecos_name</option></secondary>
22621 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
22622 pick up sub-fields that were matched by the pattern. In HP-UX, where the user’s
22623 name terminates at the first comma, the following can be used:
22625 <literallayout class="monospaced">
22626 gecos_pattern = ([^,]*)
22630 <indexterm role="option">
22631 <primary><option>gecos_pattern</option></primary>
22634 <informaltable frame="all">
22635 <tgroup cols="4" colsep="0" rowsep="0">
22636 <colspec colwidth="8*" align="left"/>
22637 <colspec colwidth="6*" align="center"/>
22638 <colspec colwidth="6*" align="center"/>
22639 <colspec colwidth="6*" align="right"/>
22642 <entry><option>gecos_pattern</option></entry>
22643 <entry>Use: <emphasis>main</emphasis></entry>
22644 <entry>Type: <emphasis>string</emphasis></entry>
22645 <entry>Default: <emphasis>unset</emphasis></entry>
22651 See <option>gecos_name</option> above.
22654 <indexterm role="option">
22655 <primary><option>gnutls_require_kx</option></primary>
22658 <informaltable frame="all">
22659 <tgroup cols="4" colsep="0" rowsep="0">
22660 <colspec colwidth="8*" align="left"/>
22661 <colspec colwidth="6*" align="center"/>
22662 <colspec colwidth="6*" align="center"/>
22663 <colspec colwidth="6*" align="right"/>
22666 <entry><option>gnutls_require_kx</option></entry>
22667 <entry>Use: <emphasis>main</emphasis></entry>
22668 <entry>Type: <emphasis>string</emphasis></entry>
22669 <entry>Default: <emphasis>unset</emphasis></entry>
22675 This option controls the key exchange mechanisms when GnuTLS is used in an Exim
22676 server. For details, see section <xref linkend="SECTreqciphgnu"/>.
22679 <indexterm role="option">
22680 <primary><option>gnutls_require_mac</option></primary>
22683 <informaltable frame="all">
22684 <tgroup cols="4" colsep="0" rowsep="0">
22685 <colspec colwidth="8*" align="left"/>
22686 <colspec colwidth="6*" align="center"/>
22687 <colspec colwidth="6*" align="center"/>
22688 <colspec colwidth="6*" align="right"/>
22691 <entry><option>gnutls_require_mac</option></entry>
22692 <entry>Use: <emphasis>main</emphasis></entry>
22693 <entry>Type: <emphasis>string</emphasis></entry>
22694 <entry>Default: <emphasis>unset</emphasis></entry>
22700 This option controls the MAC algorithms when GnuTLS is used in an Exim
22701 server. For details, see section <xref linkend="SECTreqciphgnu"/>.
22704 <indexterm role="option">
22705 <primary><option>gnutls_require_protocols</option></primary>
22708 <informaltable frame="all">
22709 <tgroup cols="4" colsep="0" rowsep="0">
22710 <colspec colwidth="8*" align="left"/>
22711 <colspec colwidth="6*" align="center"/>
22712 <colspec colwidth="6*" align="center"/>
22713 <colspec colwidth="6*" align="right"/>
22716 <entry><option>gnutls_require_protocols</option></entry>
22717 <entry>Use: <emphasis>main</emphasis></entry>
22718 <entry>Type: <emphasis>string</emphasis></entry>
22719 <entry>Default: <emphasis>unset</emphasis></entry>
22725 This option controls the protocols when GnuTLS is used in an Exim
22726 server. For details, see section <xref linkend="SECTreqciphgnu"/>.
22728 <para revisionflag="changed">
22729 <indexterm role="option">
22730 <primary><option>gnutls_compat_mode</option></primary>
22733 <informaltable frame="all" revisionflag="changed">
22734 <tgroup cols="4" colsep="0" rowsep="0">
22735 <colspec colwidth="8*" align="left"/>
22736 <colspec colwidth="6*" align="center"/>
22737 <colspec colwidth="6*" align="center"/>
22738 <colspec colwidth="6*" align="right"/>
22741 <entry><option>gnutls_compat_mode</option></entry>
22742 <entry>Use: <emphasis>main</emphasis></entry>
22743 <entry>Type: <emphasis>boolean</emphasis></entry>
22744 <entry>Default: <emphasis>unset</emphasis></entry>
22749 <para revisionflag="changed">
22750 This option controls whether GnuTLS is used in compatibility mode in an Exim
22751 server. This reduces security slightly, but improves interworking with older
22752 implementations of TLS.
22755 <indexterm role="option">
22756 <primary><option>headers_charset</option></primary>
22759 <informaltable frame="all">
22760 <tgroup cols="4" colsep="0" rowsep="0">
22761 <colspec colwidth="8*" align="left"/>
22762 <colspec colwidth="6*" align="center"/>
22763 <colspec colwidth="6*" align="center"/>
22764 <colspec colwidth="6*" align="right"/>
22767 <entry><option>headers_charset</option></entry>
22768 <entry>Use: <emphasis>main</emphasis></entry>
22769 <entry>Type: <emphasis>string</emphasis></entry>
22770 <entry>Default: <emphasis>see below</emphasis></entry>
22776 This option sets a default character set for translating from encoded MIME
22777 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
22778 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
22779 ultimate default is ISO-8859-1. For more details see the description of header
22780 insertions in section <xref linkend="SECTexpansionitems"/>.
22783 <indexterm role="option">
22784 <primary><option>header_maxsize</option></primary>
22787 <informaltable frame="all">
22788 <tgroup cols="4" colsep="0" rowsep="0">
22789 <colspec colwidth="8*" align="left"/>
22790 <colspec colwidth="6*" align="center"/>
22791 <colspec colwidth="6*" align="center"/>
22792 <colspec colwidth="6*" align="right"/>
22795 <entry><option>header_maxsize</option></entry>
22796 <entry>Use: <emphasis>main</emphasis></entry>
22797 <entry>Type: <emphasis>integer</emphasis></entry>
22798 <entry>Default: <emphasis>see below</emphasis></entry>
22804 <indexterm role="concept">
22805 <primary>header section</primary>
22806 <secondary>maximum size of</secondary>
22808 <indexterm role="concept">
22809 <primary>limit</primary>
22810 <secondary>size of message header section</secondary>
22812 This option controls the overall maximum size of a message’s header
22813 section. The default is the value of HEADER_MAXSIZE in
22814 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
22815 sections are rejected.
22818 <indexterm role="option">
22819 <primary><option>header_line_maxsize</option></primary>
22822 <informaltable frame="all">
22823 <tgroup cols="4" colsep="0" rowsep="0">
22824 <colspec colwidth="8*" align="left"/>
22825 <colspec colwidth="6*" align="center"/>
22826 <colspec colwidth="6*" align="center"/>
22827 <colspec colwidth="6*" align="right"/>
22830 <entry><option>header_line_maxsize</option></entry>
22831 <entry>Use: <emphasis>main</emphasis></entry>
22832 <entry>Type: <emphasis>integer</emphasis></entry>
22833 <entry>Default: <emphasis>0</emphasis></entry>
22839 <indexterm role="concept">
22840 <primary>header lines</primary>
22841 <secondary>maximum size of</secondary>
22843 <indexterm role="concept">
22844 <primary>limit</primary>
22845 <secondary>size of one header line</secondary>
22847 This option limits the length of any individual header line in a message, after
22848 all the continuations have been joined together. Messages with individual
22849 header lines that are longer than the limit are rejected. The default value of
22850 zero means <quote>no limit</quote>.
22853 <indexterm role="option">
22854 <primary><option>helo_accept_junk_hosts</option></primary>
22857 <informaltable frame="all">
22858 <tgroup cols="4" colsep="0" rowsep="0">
22859 <colspec colwidth="8*" align="left"/>
22860 <colspec colwidth="6*" align="center"/>
22861 <colspec colwidth="6*" align="center"/>
22862 <colspec colwidth="6*" align="right"/>
22865 <entry><option>helo_accept_junk_hosts</option></entry>
22866 <entry>Use: <emphasis>main</emphasis></entry>
22867 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
22868 <entry>Default: <emphasis>unset</emphasis></entry>
22874 <indexterm role="concept">
22875 <primary>HELO</primary>
22876 <secondary>accepting junk data</secondary>
22878 <indexterm role="concept">
22879 <primary>EHLO</primary>
22880 <secondary>accepting junk data</secondary>
22882 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
22883 mail, and gives an error response for invalid data. Unfortunately, there are
22884 some SMTP clients that send syntactic junk. They can be accommodated by setting
22885 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
22886 if you want to do semantic checking.
22887 See also <option>helo_allow_chars</option> for a way of extending the permitted character
22891 <indexterm role="option">
22892 <primary><option>helo_allow_chars</option></primary>
22895 <informaltable frame="all">
22896 <tgroup cols="4" colsep="0" rowsep="0">
22897 <colspec colwidth="8*" align="left"/>
22898 <colspec colwidth="6*" align="center"/>
22899 <colspec colwidth="6*" align="center"/>
22900 <colspec colwidth="6*" align="right"/>
22903 <entry><option>helo_allow_chars</option></entry>
22904 <entry>Use: <emphasis>main</emphasis></entry>
22905 <entry>Type: <emphasis>string</emphasis></entry>
22906 <entry>Default: <emphasis>unset</emphasis></entry>
22912 <indexterm role="concept">
22913 <primary>HELO</primary>
22914 <secondary>underscores in</secondary>
22916 <indexterm role="concept">
22917 <primary>EHLO</primary>
22918 <secondary>underscores in</secondary>
22920 <indexterm role="concept">
22921 <primary>underscore in EHLO/HELO</primary>
22923 This option can be set to a string of rogue characters that are permitted in
22924 all EHLO and HELO names in addition to the standard letters, digits,
22925 hyphens, and dots. If you really must allow underscores, you can set
22927 <literallayout class="monospaced">
22928 helo_allow_chars = _
22931 Note that the value is one string, not a list.
22934 <indexterm role="option">
22935 <primary><option>helo_lookup_domains</option></primary>
22938 <informaltable frame="all">
22939 <tgroup cols="4" colsep="0" rowsep="0">
22940 <colspec colwidth="8*" align="left"/>
22941 <colspec colwidth="6*" align="center"/>
22942 <colspec colwidth="6*" align="center"/>
22943 <colspec colwidth="6*" align="right"/>
22946 <entry><option>helo_lookup_domains</option></entry>
22947 <entry>Use: <emphasis>main</emphasis></entry>
22948 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
22949 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
22955 <indexterm role="concept">
22956 <primary>HELO</primary>
22957 <secondary>forcing reverse lookup</secondary>
22959 <indexterm role="concept">
22960 <primary>EHLO</primary>
22961 <secondary>forcing reverse lookup</secondary>
22963 If the domain given by a client in a HELO or EHLO command matches this
22964 list, a reverse lookup is done in order to establish the host’s true name. The
22965 default forces a lookup if the client host gives the server’s name or any of
22966 its IP addresses (in brackets), something that broken clients have been seen to
22970 <indexterm role="option">
22971 <primary><option>helo_try_verify_hosts</option></primary>
22974 <informaltable frame="all">
22975 <tgroup cols="4" colsep="0" rowsep="0">
22976 <colspec colwidth="8*" align="left"/>
22977 <colspec colwidth="6*" align="center"/>
22978 <colspec colwidth="6*" align="center"/>
22979 <colspec colwidth="6*" align="right"/>
22982 <entry><option>helo_try_verify_hosts</option></entry>
22983 <entry>Use: <emphasis>main</emphasis></entry>
22984 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
22985 <entry>Default: <emphasis>unset</emphasis></entry>
22991 <indexterm role="concept">
22992 <primary>HELO verifying</primary>
22993 <secondary>optional</secondary>
22995 <indexterm role="concept">
22996 <primary>EHLO</primary>
22997 <secondary>verifying, optional</secondary>
22999 By default, Exim just checks the syntax of HELO and EHLO commands (see
23000 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
23001 to do more extensive checking of the data supplied by these commands. The ACL
23002 condition <literal>verify = helo</literal> is provided to make this possible.
23003 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
23004 to force the check to occur. From release 4.53 onwards, this is no longer
23005 necessary. If the check has not been done before <literal>verify = helo</literal> is
23006 encountered, it is done at that time. Consequently, this option is obsolete.
23007 Its specification is retained here for backwards compatibility.
23010 When an EHLO or HELO command is received, if the calling host matches
23011 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
23012 EHLO command either:
23017 is an IP literal matching the calling address of the host, or
23022 <indexterm role="concept">
23023 <primary>DNS</primary>
23024 <secondary>reverse lookup</secondary>
23026 <indexterm role="concept">
23027 <primary>reverse DNS lookup</primary>
23029 matches the host name that Exim obtains by doing a reverse lookup of the
23030 calling host address, or
23035 when looked up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when
23036 available) yields the calling host address.
23041 However, the EHLO or HELO command is not rejected if any of the checks
23042 fail. Processing continues, but the result of the check is remembered, and can
23043 be detected later in an ACL by the <literal>verify = helo</literal> condition.
23046 <indexterm role="option">
23047 <primary><option>helo_verify_hosts</option></primary>
23050 <informaltable frame="all">
23051 <tgroup cols="4" colsep="0" rowsep="0">
23052 <colspec colwidth="8*" align="left"/>
23053 <colspec colwidth="6*" align="center"/>
23054 <colspec colwidth="6*" align="center"/>
23055 <colspec colwidth="6*" align="right"/>
23058 <entry><option>helo_verify_hosts</option></entry>
23059 <entry>Use: <emphasis>main</emphasis></entry>
23060 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
23061 <entry>Default: <emphasis>unset</emphasis></entry>
23067 <indexterm role="concept">
23068 <primary>HELO verifying</primary>
23069 <secondary>mandatory</secondary>
23071 <indexterm role="concept">
23072 <primary>EHLO</primary>
23073 <secondary>verifying, mandatory</secondary>
23075 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
23076 backwards compatibility. For hosts that match this option, Exim checks the host
23077 name given in the HELO or EHLO in the same way as for
23078 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
23079 rejected with a 550 error, and entries are written to the main and reject logs.
23080 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
23084 <indexterm role="option">
23085 <primary><option>hold_domains</option></primary>
23088 <informaltable frame="all">
23089 <tgroup cols="4" colsep="0" rowsep="0">
23090 <colspec colwidth="8*" align="left"/>
23091 <colspec colwidth="6*" align="center"/>
23092 <colspec colwidth="6*" align="center"/>
23093 <colspec colwidth="6*" align="right"/>
23096 <entry><option>hold_domains</option></entry>
23097 <entry>Use: <emphasis>main</emphasis></entry>
23098 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
23099 <entry>Default: <emphasis>unset</emphasis></entry>
23105 <indexterm role="concept">
23106 <primary>domain</primary>
23107 <secondary>delaying delivery</secondary>
23109 <indexterm role="concept">
23110 <primary>delivery</primary>
23111 <secondary>delaying certain domains</secondary>
23113 This option allows mail for particular domains to be held on the queue
23114 manually. The option is overridden if a message delivery is forced with the
23115 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
23116 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
23117 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
23118 it is deferred every time the message is looked at.
23121 This option is intended as a temporary operational measure for delaying the
23122 delivery of mail while some problem is being sorted out, or some new
23123 configuration tested. If you just want to delay the processing of some
23124 domains until a queue run occurs, you should use <option>queue_domains</option> or
23125 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
23128 A setting of <option>hold_domains</option> does not override Exim’s code for removing
23129 messages from the queue if they have been there longer than the longest retry
23130 time in any retry rule. If you want to hold messages for longer than the normal
23131 retry times, insert a dummy retry rule with a long retry time.
23134 <indexterm role="option">
23135 <primary><option>host_lookup</option></primary>
23138 <informaltable frame="all">
23139 <tgroup cols="4" colsep="0" rowsep="0">
23140 <colspec colwidth="8*" align="left"/>
23141 <colspec colwidth="6*" align="center"/>
23142 <colspec colwidth="6*" align="center"/>
23143 <colspec colwidth="6*" align="right"/>
23146 <entry><option>host_lookup</option></entry>
23147 <entry>Use: <emphasis>main</emphasis></entry>
23148 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
23149 <entry>Default: <emphasis>unset</emphasis></entry>
23155 <indexterm role="concept">
23156 <primary>host name</primary>
23157 <secondary>lookup, forcing</secondary>
23159 Exim does not look up the name of a calling host from its IP address unless it
23160 is required to compare against some host list, or the host matches
23161 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
23162 option (which normally contains IP addresses rather than host names). The
23163 default configuration file contains
23165 <literallayout class="monospaced">
23169 which causes a lookup to happen for all hosts. If the expense of these lookups
23170 is felt to be too great, the setting can be changed or removed.
23173 After a successful reverse lookup, Exim does a forward lookup on the name it
23174 has obtained, to verify that it yields the IP address that it started with. If
23175 this check fails, Exim behaves as if the name lookup failed.
23178 <indexterm role="variable">
23179 <primary><varname>$host_lookup_failed</varname></primary>
23181 <indexterm role="variable">
23182 <primary><varname>$sender_host_name</varname></primary>
23184 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
23185 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
23186 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and
23187 <literal>verify = reverse_host_lookup</literal> in ACLs.
23190 <indexterm role="option">
23191 <primary><option>host_lookup_order</option></primary>
23194 <informaltable frame="all">
23195 <tgroup cols="4" colsep="0" rowsep="0">
23196 <colspec colwidth="8*" align="left"/>
23197 <colspec colwidth="6*" align="center"/>
23198 <colspec colwidth="6*" align="center"/>
23199 <colspec colwidth="6*" align="right"/>
23202 <entry><option>host_lookup_order</option></entry>
23203 <entry>Use: <emphasis>main</emphasis></entry>
23204 <entry>Type: <emphasis>string list</emphasis></entry>
23205 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
23211 This option specifies the order of different lookup methods when Exim is trying
23212 to find a host name from an IP address. The default is to do a DNS lookup
23213 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
23214 if that fails. You can change the order of these lookups, or omit one entirely,
23218 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
23219 multiple PTR records in the DNS and the IP address is not listed in
23220 <filename>/etc/hosts</filename>. Different operating systems give different results in this
23221 case. That is why the default tries a DNS lookup first.
23224 <indexterm role="option">
23225 <primary><option>host_reject_connection</option></primary>
23228 <informaltable frame="all">
23229 <tgroup cols="4" colsep="0" rowsep="0">
23230 <colspec colwidth="8*" align="left"/>
23231 <colspec colwidth="6*" align="center"/>
23232 <colspec colwidth="6*" align="center"/>
23233 <colspec colwidth="6*" align="right"/>
23236 <entry><option>host_reject_connection</option></entry>
23237 <entry>Use: <emphasis>main</emphasis></entry>
23238 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
23239 <entry>Default: <emphasis>unset</emphasis></entry>
23245 <indexterm role="concept">
23246 <primary>host</primary>
23247 <secondary>rejecting connections from</secondary>
23249 If this option is set, incoming SMTP calls from the hosts listed are rejected
23250 as soon as the connection is made.
23251 This option is obsolete, and retained only for backward compatibility, because
23252 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
23253 connections immediately.
23256 The ability to give an immediate rejection (either by this option or using an
23257 ACL) is provided for use in unusual cases. Many hosts will just try again,
23258 sometimes without much delay. Normally, it is better to use an ACL to reject
23259 incoming messages at a later stage, such as after RCPT commands. See
23260 chapter <xref linkend="CHAPACL"/>.
23263 <indexterm role="option">
23264 <primary><option>hosts_connection_nolog</option></primary>
23267 <informaltable frame="all">
23268 <tgroup cols="4" colsep="0" rowsep="0">
23269 <colspec colwidth="8*" align="left"/>
23270 <colspec colwidth="6*" align="center"/>
23271 <colspec colwidth="6*" align="center"/>
23272 <colspec colwidth="6*" align="right"/>
23275 <entry><option>hosts_connection_nolog</option></entry>
23276 <entry>Use: <emphasis>main</emphasis></entry>
23277 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
23278 <entry>Default: <emphasis>unset</emphasis></entry>
23284 <indexterm role="concept">
23285 <primary>host</primary>
23286 <secondary>not logging connections from</secondary>
23288 This option defines a list of hosts for which connection logging does not
23289 happen, even though the <option>smtp_connection</option> log selector is set. For example,
23290 you might want not to log SMTP connections from local processes, or from
23291 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
23292 the daemon; you should therefore strive to restrict its value to a short inline
23293 list of IP addresses and networks. To disable logging SMTP connections from
23294 local processes, you must create a host list with an empty item. For example:
23296 <literallayout class="monospaced">
23297 hosts_connection_nolog = :
23300 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
23303 <indexterm role="option">
23304 <primary><option>hosts_treat_as_local</option></primary>
23307 <informaltable frame="all">
23308 <tgroup cols="4" colsep="0" rowsep="0">
23309 <colspec colwidth="8*" align="left"/>
23310 <colspec colwidth="6*" align="center"/>
23311 <colspec colwidth="6*" align="center"/>
23312 <colspec colwidth="6*" align="right"/>
23315 <entry><option>hosts_treat_as_local</option></entry>
23316 <entry>Use: <emphasis>main</emphasis></entry>
23317 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
23318 <entry>Default: <emphasis>unset</emphasis></entry>
23324 <indexterm role="concept">
23325 <primary>local host</primary>
23326 <secondary>domains treated as</secondary>
23328 <indexterm role="concept">
23329 <primary>host</primary>
23330 <secondary>treated as local</secondary>
23332 If this option is set, any host names that match the domain list are treated as
23333 if they were the local host when Exim is scanning host lists obtained from MX
23335 or other sources. Note that the value of this option is a domain list, not a
23336 host list, because it is always used to check host names, not IP addresses.
23339 This option also applies when Exim is matching the special items
23340 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
23341 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
23342 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
23343 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
23344 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
23345 interfaces and recognizing the local host.
23348 <indexterm role="option">
23349 <primary><option>ibase_servers</option></primary>
23352 <informaltable frame="all">
23353 <tgroup cols="4" colsep="0" rowsep="0">
23354 <colspec colwidth="8*" align="left"/>
23355 <colspec colwidth="6*" align="center"/>
23356 <colspec colwidth="6*" align="center"/>
23357 <colspec colwidth="6*" align="right"/>
23360 <entry><option>ibase_servers</option></entry>
23361 <entry>Use: <emphasis>main</emphasis></entry>
23362 <entry>Type: <emphasis>string list</emphasis></entry>
23363 <entry>Default: <emphasis>unset</emphasis></entry>
23369 <indexterm role="concept">
23370 <primary>InterBase</primary>
23371 <secondary>server list</secondary>
23373 This option provides a list of InterBase servers and associated connection data,
23374 to be used in conjunction with <command>ibase</command> lookups (see section <xref linkend="SECID72"/>).
23375 The option is available only if Exim has been built with InterBase support.
23378 <indexterm role="option">
23379 <primary><option>ignore_bounce_errors_after</option></primary>
23382 <informaltable frame="all">
23383 <tgroup cols="4" colsep="0" rowsep="0">
23384 <colspec colwidth="8*" align="left"/>
23385 <colspec colwidth="6*" align="center"/>
23386 <colspec colwidth="6*" align="center"/>
23387 <colspec colwidth="6*" align="right"/>
23390 <entry><option>ignore_bounce_errors_after</option></entry>
23391 <entry>Use: <emphasis>main</emphasis></entry>
23392 <entry>Type: <emphasis>time</emphasis></entry>
23393 <entry>Default: <emphasis>10w</emphasis></entry>
23399 <indexterm role="concept">
23400 <primary>bounce message</primary>
23401 <secondary>discarding</secondary>
23403 <indexterm role="concept">
23404 <primary>discarding bounce message</primary>
23406 This option affects the processing of bounce messages that cannot be delivered,
23407 that is, those that suffer a permanent delivery failure. (Bounce messages that
23408 suffer temporary delivery failures are of course retried in the usual way.)
23411 After a permanent delivery failure, bounce messages are frozen,
23412 because there is no sender to whom they can be returned. When a frozen bounce
23413 message has been on the queue for more than the given time, it is unfrozen at
23414 the next queue run, and a further delivery is attempted. If delivery fails
23415 again, the bounce message is discarded. This makes it possible to keep failed
23416 bounce messages around for a shorter time than the normal maximum retry time
23417 for frozen messages. For example,
23419 <literallayout class="monospaced">
23420 ignore_bounce_errors_after = 12h
23423 retries failed bounce message deliveries after 12 hours, discarding any further
23424 failures. If the value of this option is set to a zero time period, bounce
23425 failures are discarded immediately. Setting a very long time (as in the default
23426 value) has the effect of disabling this option. For ways of automatically
23427 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
23428 <option>timeout_frozen_after</option>.
23431 <indexterm role="option">
23432 <primary><option>ignore_fromline_hosts</option></primary>
23435 <informaltable frame="all">
23436 <tgroup cols="4" colsep="0" rowsep="0">
23437 <colspec colwidth="8*" align="left"/>
23438 <colspec colwidth="6*" align="center"/>
23439 <colspec colwidth="6*" align="center"/>
23440 <colspec colwidth="6*" align="right"/>
23443 <entry><option>ignore_fromline_hosts</option></entry>
23444 <entry>Use: <emphasis>main</emphasis></entry>
23445 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
23446 <entry>Default: <emphasis>unset</emphasis></entry>
23452 <indexterm role="concept">
23453 <primary><quote>From</quote> line</primary>
23455 <indexterm role="concept">
23456 <primary>UUCP</primary>
23457 <secondary><quote>From</quote> line</secondary>
23459 Some broken SMTP clients insist on sending a UUCP-like <quote>From </quote> line before
23460 the headers of a message. By default this is treated as the start of the
23461 message’s body, which means that any following headers are not recognized as
23462 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
23463 match those hosts that insist on sending it. If the sender is actually a local
23464 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
23465 <option>ignore_fromline_local</option> must be set to achieve this effect.
23468 <indexterm role="option">
23469 <primary><option>ignore_fromline_local</option></primary>
23472 <informaltable frame="all">
23473 <tgroup cols="4" colsep="0" rowsep="0">
23474 <colspec colwidth="8*" align="left"/>
23475 <colspec colwidth="6*" align="center"/>
23476 <colspec colwidth="6*" align="center"/>
23477 <colspec colwidth="6*" align="right"/>
23480 <entry><option>ignore_fromline_local</option></entry>
23481 <entry>Use: <emphasis>main</emphasis></entry>
23482 <entry>Type: <emphasis>boolean</emphasis></entry>
23483 <entry>Default: <emphasis>false</emphasis></entry>
23489 See <option>ignore_fromline_hosts</option> above.
23492 <indexterm role="option">
23493 <primary><option>keep_malformed</option></primary>
23496 <informaltable frame="all">
23497 <tgroup cols="4" colsep="0" rowsep="0">
23498 <colspec colwidth="8*" align="left"/>
23499 <colspec colwidth="6*" align="center"/>
23500 <colspec colwidth="6*" align="center"/>
23501 <colspec colwidth="6*" align="right"/>
23504 <entry><option>keep_malformed</option></entry>
23505 <entry>Use: <emphasis>main</emphasis></entry>
23506 <entry>Type: <emphasis>time</emphasis></entry>
23507 <entry>Default: <emphasis>4d</emphasis></entry>
23513 This option specifies the length of time to keep messages whose spool files
23514 have been corrupted in some way. This should, of course, never happen. At the
23515 next attempt to deliver such a message, it gets removed. The incident is
23519 <indexterm role="option">
23520 <primary><option>ldap_default_servers</option></primary>
23523 <informaltable frame="all">
23524 <tgroup cols="4" colsep="0" rowsep="0">
23525 <colspec colwidth="8*" align="left"/>
23526 <colspec colwidth="6*" align="center"/>
23527 <colspec colwidth="6*" align="center"/>
23528 <colspec colwidth="6*" align="right"/>
23531 <entry><option>ldap_default_servers</option></entry>
23532 <entry>Use: <emphasis>main</emphasis></entry>
23533 <entry>Type: <emphasis>string list</emphasis></entry>
23534 <entry>Default: <emphasis>unset</emphasis></entry>
23540 <indexterm role="concept">
23541 <primary>LDAP</primary>
23542 <secondary>default servers</secondary>
23544 This option provides a list of LDAP servers which are tried in turn when an
23545 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
23546 details of LDAP queries. This option is available only when Exim has been built
23550 <indexterm role="option">
23551 <primary><option>ldap_version</option></primary>
23554 <informaltable frame="all">
23555 <tgroup cols="4" colsep="0" rowsep="0">
23556 <colspec colwidth="8*" align="left"/>
23557 <colspec colwidth="6*" align="center"/>
23558 <colspec colwidth="6*" align="center"/>
23559 <colspec colwidth="6*" align="right"/>
23562 <entry><option>ldap_version</option></entry>
23563 <entry>Use: <emphasis>main</emphasis></entry>
23564 <entry>Type: <emphasis>integer</emphasis></entry>
23565 <entry>Default: <emphasis>unset</emphasis></entry>
23571 <indexterm role="concept">
23572 <primary>LDAP</primary>
23573 <secondary>protocol version, forcing</secondary>
23575 This option can be used to force Exim to set a specific protocol version for
23576 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
23577 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
23578 the LDAP headers; otherwise it is 2. This option is available only when Exim
23579 has been built with LDAP support.
23582 <indexterm role="option">
23583 <primary><option>local_from_check</option></primary>
23586 <informaltable frame="all">
23587 <tgroup cols="4" colsep="0" rowsep="0">
23588 <colspec colwidth="8*" align="left"/>
23589 <colspec colwidth="6*" align="center"/>
23590 <colspec colwidth="6*" align="center"/>
23591 <colspec colwidth="6*" align="right"/>
23594 <entry><option>local_from_check</option></entry>
23595 <entry>Use: <emphasis>main</emphasis></entry>
23596 <entry>Type: <emphasis>boolean</emphasis></entry>
23597 <entry>Default: <emphasis>true</emphasis></entry>
23603 <indexterm role="concept">
23604 <primary><emphasis>Sender:</emphasis> header line</primary>
23605 <secondary>disabling addition of</secondary>
23607 <indexterm role="concept">
23608 <primary><emphasis>From:</emphasis> header line</primary>
23609 <secondary>disabling checking of</secondary>
23611 When a message is submitted locally (that is, not over a TCP/IP connection) by
23612 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
23613 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
23614 the domain specified by <option>qualify_domain</option>.
23617 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
23618 locally submitted message is automatically qualified by Exim, unless the
23619 <option>-bnq</option> command line option is used.
23622 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
23623 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
23624 <emphasis>Sender:</emphasis> header with an address constructed from the calling user’s login
23625 and the default qualify domain.
23628 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
23629 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
23630 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
23631 <option>local_sender_retain</option> to be true.
23634 <indexterm role="concept">
23635 <primary>envelope sender</primary>
23637 These options affect only the header lines in the message. The envelope sender
23638 is still forced to be the login id at the qualify domain unless
23639 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
23642 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
23643 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
23644 has more details about <emphasis>Sender:</emphasis> processing.
23647 <indexterm role="option">
23648 <primary><option>local_from_prefix</option></primary>
23651 <informaltable frame="all">
23652 <tgroup cols="4" colsep="0" rowsep="0">
23653 <colspec colwidth="8*" align="left"/>
23654 <colspec colwidth="6*" align="center"/>
23655 <colspec colwidth="6*" align="center"/>
23656 <colspec colwidth="6*" align="right"/>
23659 <entry><option>local_from_prefix</option></entry>
23660 <entry>Use: <emphasis>main</emphasis></entry>
23661 <entry>Type: <emphasis>string</emphasis></entry>
23662 <entry>Default: <emphasis>unset</emphasis></entry>
23668 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
23669 matching the login id (see <option>local_from_check</option> above), it can be configured to
23670 ignore certain prefixes and suffixes in the local part of the address. This is
23671 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
23672 appropriate lists, in the same form as the <option>local_part_prefix</option> and
23673 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
23676 <literallayout class="monospaced">
23677 local_from_prefix = *-
23680 is set, a <emphasis>From:</emphasis> line containing
23682 <literallayout class="monospaced">
23683 From: anything-user@your.domain.example
23686 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
23687 matches the actual sender address that is constructed from the login name and
23691 <indexterm role="option">
23692 <primary><option>local_from_suffix</option></primary>
23695 <informaltable frame="all">
23696 <tgroup cols="4" colsep="0" rowsep="0">
23697 <colspec colwidth="8*" align="left"/>
23698 <colspec colwidth="6*" align="center"/>
23699 <colspec colwidth="6*" align="center"/>
23700 <colspec colwidth="6*" align="right"/>
23703 <entry><option>local_from_suffix</option></entry>
23704 <entry>Use: <emphasis>main</emphasis></entry>
23705 <entry>Type: <emphasis>string</emphasis></entry>
23706 <entry>Default: <emphasis>unset</emphasis></entry>
23712 See <option>local_from_prefix</option> above.
23715 <indexterm role="option">
23716 <primary><option>local_interfaces</option></primary>
23719 <informaltable frame="all">
23720 <tgroup cols="4" colsep="0" rowsep="0">
23721 <colspec colwidth="8*" align="left"/>
23722 <colspec colwidth="6*" align="center"/>
23723 <colspec colwidth="6*" align="center"/>
23724 <colspec colwidth="6*" align="right"/>
23727 <entry><option>local_interfaces</option></entry>
23728 <entry>Use: <emphasis>main</emphasis></entry>
23729 <entry>Type: <emphasis>string list</emphasis></entry>
23730 <entry>Default: <emphasis>see below</emphasis></entry>
23736 This option controls which network interfaces are used by the daemon for
23737 listening; they are also used to identify the local host when routing. Chapter
23738 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
23739 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
23740 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
23741 <option>local_interfaces</option> is
23743 <literallayout class="monospaced">
23744 local_interfaces = 0.0.0.0
23747 when Exim is built without IPv6 support; otherwise it is
23749 <literallayout class="monospaced">
23750 local_interfaces = <; ::0 ; 0.0.0.0
23753 <indexterm role="option">
23754 <primary><option>local_scan_timeout</option></primary>
23757 <informaltable frame="all">
23758 <tgroup cols="4" colsep="0" rowsep="0">
23759 <colspec colwidth="8*" align="left"/>
23760 <colspec colwidth="6*" align="center"/>
23761 <colspec colwidth="6*" align="center"/>
23762 <colspec colwidth="6*" align="right"/>
23765 <entry><option>local_scan_timeout</option></entry>
23766 <entry>Use: <emphasis>main</emphasis></entry>
23767 <entry>Type: <emphasis>time</emphasis></entry>
23768 <entry>Default: <emphasis>5m</emphasis></entry>
23774 <indexterm role="concept">
23775 <primary>timeout</primary>
23776 <secondary>for <function>local_scan()</function> function</secondary>
23778 <indexterm role="concept">
23779 <primary><function>local_scan()</function> function</primary>
23780 <secondary>timeout</secondary>
23782 This timeout applies to the <function>local_scan()</function> function (see chapter
23783 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
23784 the incoming message is rejected with a temporary error if it is an SMTP
23785 message. For a non-SMTP message, the message is dropped and Exim ends with a
23786 non-zero code. The incident is logged on the main and reject logs.
23789 <indexterm role="option">
23790 <primary><option>local_sender_retain</option></primary>
23793 <informaltable frame="all">
23794 <tgroup cols="4" colsep="0" rowsep="0">
23795 <colspec colwidth="8*" align="left"/>
23796 <colspec colwidth="6*" align="center"/>
23797 <colspec colwidth="6*" align="center"/>
23798 <colspec colwidth="6*" align="right"/>
23801 <entry><option>local_sender_retain</option></entry>
23802 <entry>Use: <emphasis>main</emphasis></entry>
23803 <entry>Type: <emphasis>boolean</emphasis></entry>
23804 <entry>Default: <emphasis>false</emphasis></entry>
23810 <indexterm role="concept">
23811 <primary><emphasis>Sender:</emphasis> header line</primary>
23812 <secondary>retaining from local submission</secondary>
23814 When a message is submitted locally (that is, not over a TCP/IP connection) by
23815 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
23816 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
23817 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
23818 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
23819 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
23822 <indexterm role="option">
23823 <primary><option>localhost_number</option></primary>
23826 <informaltable frame="all">
23827 <tgroup cols="4" colsep="0" rowsep="0">
23828 <colspec colwidth="8*" align="left"/>
23829 <colspec colwidth="6*" align="center"/>
23830 <colspec colwidth="6*" align="center"/>
23831 <colspec colwidth="6*" align="right"/>
23834 <entry><option>localhost_number</option></entry>
23835 <entry>Use: <emphasis>main</emphasis></entry>
23836 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
23837 <entry>Default: <emphasis>unset</emphasis></entry>
23843 <indexterm role="concept">
23844 <primary>host</primary>
23845 <secondary>locally unique number for</secondary>
23847 <indexterm role="concept">
23848 <primary>message ids</primary>
23849 <secondary>with multiple hosts</secondary>
23851 <indexterm role="variable">
23852 <primary><varname>$localhost_number</varname></primary>
23854 Exim’s message ids are normally unique only within the local host. If
23855 uniqueness among a set of hosts is required, each host must set a different
23856 value for the <option>localhost_number</option> option. The string is expanded immediately
23857 after reading the configuration file (so that a number can be computed from the
23858 host name, for example) and the result of the expansion must be a number in the
23859 range 0–16 (or 0–10 on operating systems with case-insensitive file
23860 systems). This is available in subsequent string expansions via the variable
23861 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
23862 characters of the message id, instead of just being a fractional part of the
23863 time, are computed from the time and the local host number as described in
23864 section <xref linkend="SECTmessiden"/>.
23867 <indexterm role="option">
23868 <primary><option>log_file_path</option></primary>
23871 <informaltable frame="all">
23872 <tgroup cols="4" colsep="0" rowsep="0">
23873 <colspec colwidth="8*" align="left"/>
23874 <colspec colwidth="6*" align="center"/>
23875 <colspec colwidth="6*" align="center"/>
23876 <colspec colwidth="6*" align="right"/>
23879 <entry><option>log_file_path</option></entry>
23880 <entry>Use: <emphasis>main</emphasis></entry>
23881 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
23882 <entry>Default: <emphasis>set at compile time</emphasis></entry>
23888 <indexterm role="concept">
23889 <primary>log</primary>
23890 <secondary>file path for</secondary>
23892 This option sets the path which is used to determine the names of Exim’s log
23893 files, or indicates that logging is to be to syslog, or both. It is expanded
23894 when Exim is entered, so it can, for example, contain a reference to the host
23895 name. If no specific path is set for the log files at compile or run time, they
23896 are written in a sub-directory called <filename>log</filename> in Exim’s spool directory.
23897 Chapter <xref linkend="CHAPlog"/> contains further details about Exim’s logging, and
23898 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
23899 used. If this string is fixed at your installation (contains no expansion
23900 variables) it is recommended that you do not set this option in the
23901 configuration file, but instead supply the path using LOG_FILE_PATH in
23902 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
23903 early on – in particular, failure to read the configuration file.
23906 <indexterm role="option">
23907 <primary><option>log_selector</option></primary>
23910 <informaltable frame="all">
23911 <tgroup cols="4" colsep="0" rowsep="0">
23912 <colspec colwidth="8*" align="left"/>
23913 <colspec colwidth="6*" align="center"/>
23914 <colspec colwidth="6*" align="center"/>
23915 <colspec colwidth="6*" align="right"/>
23918 <entry><option>log_selector</option></entry>
23919 <entry>Use: <emphasis>main</emphasis></entry>
23920 <entry>Type: <emphasis>string</emphasis></entry>
23921 <entry>Default: <emphasis>unset</emphasis></entry>
23927 <indexterm role="concept">
23928 <primary>log</primary>
23929 <secondary>selectors</secondary>
23931 This option can be used to reduce or increase the number of things that Exim
23932 writes to its log files. Its argument is made up of names preceded by plus or
23933 minus characters. For example:
23935 <literallayout class="monospaced">
23936 log_selector = +arguments -retry_defer
23939 A list of possible names and what they control is given in the chapter on
23940 logging, in section <xref linkend="SECTlogselector"/>.
23943 <indexterm role="option">
23944 <primary><option>log_timezone</option></primary>
23947 <informaltable frame="all">
23948 <tgroup cols="4" colsep="0" rowsep="0">
23949 <colspec colwidth="8*" align="left"/>
23950 <colspec colwidth="6*" align="center"/>
23951 <colspec colwidth="6*" align="center"/>
23952 <colspec colwidth="6*" align="right"/>
23955 <entry><option>log_timezone</option></entry>
23956 <entry>Use: <emphasis>main</emphasis></entry>
23957 <entry>Type: <emphasis>boolean</emphasis></entry>
23958 <entry>Default: <emphasis>false</emphasis></entry>
23964 <indexterm role="concept">
23965 <primary>log</primary>
23966 <secondary>timezone for entries</secondary>
23968 <indexterm role="variable">
23969 <primary><varname>$tod_log</varname></primary>
23971 <indexterm role="variable">
23972 <primary><varname>$tod_zone</varname></primary>
23974 By default, the timestamps on log lines are in local time without the
23975 timezone. This means that if your timezone changes twice a year, the timestamps
23976 in log lines are ambiguous for an hour when the clocks go back. One way of
23977 avoiding this problem is to set the timezone to UTC. An alternative is to set
23978 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
23979 timestamps in log lines. Turning on this option can add quite a lot to the size
23980 of log files because each line is extended by 6 characters. Note that the
23981 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
23982 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
23985 <indexterm role="option">
23986 <primary><option>lookup_open_max</option></primary>
23989 <informaltable frame="all">
23990 <tgroup cols="4" colsep="0" rowsep="0">
23991 <colspec colwidth="8*" align="left"/>
23992 <colspec colwidth="6*" align="center"/>
23993 <colspec colwidth="6*" align="center"/>
23994 <colspec colwidth="6*" align="right"/>
23997 <entry><option>lookup_open_max</option></entry>
23998 <entry>Use: <emphasis>main</emphasis></entry>
23999 <entry>Type: <emphasis>integer</emphasis></entry>
24000 <entry>Default: <emphasis>25</emphasis></entry>
24006 <indexterm role="concept">
24007 <primary>too many open files</primary>
24009 <indexterm role="concept">
24010 <primary>open files, too many</primary>
24012 <indexterm role="concept">
24013 <primary>file</primary>
24014 <secondary>too many open</secondary>
24016 <indexterm role="concept">
24017 <primary>lookup</primary>
24018 <secondary>maximum open files</secondary>
24020 <indexterm role="concept">
24021 <primary>limit</primary>
24022 <secondary>open files for lookups</secondary>
24024 This option limits the number of simultaneously open files for single-key
24025 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
24026 Exim normally keeps these files open during routing, because often the same
24027 file is required several times. If the limit is reached, Exim closes the least
24028 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
24029 actually opens two files for each logical DBM database, though it still counts
24030 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
24031 open files</quote> errors with NDBM, you need to reduce the value of
24032 <option>lookup_open_max</option>.
24035 <indexterm role="option">
24036 <primary><option>max_username_length</option></primary>
24039 <informaltable frame="all">
24040 <tgroup cols="4" colsep="0" rowsep="0">
24041 <colspec colwidth="8*" align="left"/>
24042 <colspec colwidth="6*" align="center"/>
24043 <colspec colwidth="6*" align="center"/>
24044 <colspec colwidth="6*" align="right"/>
24047 <entry><option>max_username_length</option></entry>
24048 <entry>Use: <emphasis>main</emphasis></entry>
24049 <entry>Type: <emphasis>integer</emphasis></entry>
24050 <entry>Default: <emphasis>0</emphasis></entry>
24056 <indexterm role="concept">
24057 <primary>length of login name</primary>
24059 <indexterm role="concept">
24060 <primary>user name</primary>
24061 <secondary>maximum length</secondary>
24063 <indexterm role="concept">
24064 <primary>limit</primary>
24065 <secondary>user name length</secondary>
24067 Some operating systems are broken in that they truncate long arguments to
24068 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
24069 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
24070 an argument that is longer behaves as if <function>getpwnam()</function> failed.
24073 <indexterm role="option">
24074 <primary><option>message_body_newlines</option></primary>
24077 <informaltable frame="all">
24078 <tgroup cols="4" colsep="0" rowsep="0">
24079 <colspec colwidth="8*" align="left"/>
24080 <colspec colwidth="6*" align="center"/>
24081 <colspec colwidth="6*" align="center"/>
24082 <colspec colwidth="6*" align="right"/>
24085 <entry><option>message_body_newlines</option></entry>
24086 <entry>Use: <emphasis>main</emphasis></entry>
24087 <entry>Type: <emphasis>bool</emphasis></entry>
24088 <entry>Default: <emphasis>false</emphasis></entry>
24094 <indexterm role="concept">
24095 <primary>message body</primary>
24096 <secondary>newlines in variables</secondary>
24098 <indexterm role="concept">
24099 <primary>newline</primary>
24100 <secondary>in message body variables</secondary>
24102 <indexterm role="variable">
24103 <primary><varname>$message_body</varname></primary>
24105 <indexterm role="variable">
24106 <primary><varname>$message_body_end</varname></primary>
24108 By default, newlines in the message body are replaced by spaces when setting
24109 the <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables. If this
24110 option is set true, this no longer happens.
24113 <indexterm role="option">
24114 <primary><option>message_body_visible</option></primary>
24117 <informaltable frame="all">
24118 <tgroup cols="4" colsep="0" rowsep="0">
24119 <colspec colwidth="8*" align="left"/>
24120 <colspec colwidth="6*" align="center"/>
24121 <colspec colwidth="6*" align="center"/>
24122 <colspec colwidth="6*" align="right"/>
24125 <entry><option>message_body_visible</option></entry>
24126 <entry>Use: <emphasis>main</emphasis></entry>
24127 <entry>Type: <emphasis>integer</emphasis></entry>
24128 <entry>Default: <emphasis>500</emphasis></entry>
24134 <indexterm role="concept">
24135 <primary>body of message</primary>
24136 <secondary>visible size</secondary>
24138 <indexterm role="concept">
24139 <primary>message body</primary>
24140 <secondary>visible size</secondary>
24142 <indexterm role="variable">
24143 <primary><varname>$message_body</varname></primary>
24145 <indexterm role="variable">
24146 <primary><varname>$message_body_end</varname></primary>
24148 This option specifies how much of a message’s body is to be included in the
24149 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
24152 <indexterm role="option">
24153 <primary><option>message_id_header_domain</option></primary>
24156 <informaltable frame="all">
24157 <tgroup cols="4" colsep="0" rowsep="0">
24158 <colspec colwidth="8*" align="left"/>
24159 <colspec colwidth="6*" align="center"/>
24160 <colspec colwidth="6*" align="center"/>
24161 <colspec colwidth="6*" align="right"/>
24164 <entry><option>message_id_header_domain</option></entry>
24165 <entry>Use: <emphasis>main</emphasis></entry>
24166 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
24167 <entry>Default: <emphasis>unset</emphasis></entry>
24173 <indexterm role="concept">
24174 <primary><emphasis>Message-ID:</emphasis> header line</primary>
24176 If this option is set, the string is expanded and used as the right hand side
24177 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
24178 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
24179 means <quote>not received over TCP/IP.</quote>
24180 Otherwise, the primary host name is used.
24181 Only letters, digits, dot and hyphen are accepted; any other characters are
24182 replaced by hyphens. If the expansion is forced to fail, or if the result is an
24183 empty string, the option is ignored.
24186 <indexterm role="option">
24187 <primary><option>message_id_header_text</option></primary>
24190 <informaltable frame="all">
24191 <tgroup cols="4" colsep="0" rowsep="0">
24192 <colspec colwidth="8*" align="left"/>
24193 <colspec colwidth="6*" align="center"/>
24194 <colspec colwidth="6*" align="center"/>
24195 <colspec colwidth="6*" align="right"/>
24198 <entry><option>message_id_header_text</option></entry>
24199 <entry>Use: <emphasis>main</emphasis></entry>
24200 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
24201 <entry>Default: <emphasis>unset</emphasis></entry>
24207 If this variable is set, the string is expanded and used to augment the text of
24208 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
24209 message does not have one. The text of this header is required by RFC 2822 to
24210 take the form of an address. By default, Exim uses its internal message id as
24211 the local part, and the primary host name as the domain. If this option is set,
24212 it is expanded, and provided the expansion is not forced to fail, and does not
24213 yield an empty string, the result is inserted into the header immediately
24214 before the @, separated from the internal message id by a dot. Any characters
24215 that are illegal in an address are automatically converted into hyphens. This
24216 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
24217 colons will become hyphens.
24220 <indexterm role="option">
24221 <primary><option>message_logs</option></primary>
24224 <informaltable frame="all">
24225 <tgroup cols="4" colsep="0" rowsep="0">
24226 <colspec colwidth="8*" align="left"/>
24227 <colspec colwidth="6*" align="center"/>
24228 <colspec colwidth="6*" align="center"/>
24229 <colspec colwidth="6*" align="right"/>
24232 <entry><option>message_logs</option></entry>
24233 <entry>Use: <emphasis>main</emphasis></entry>
24234 <entry>Type: <emphasis>boolean</emphasis></entry>
24235 <entry>Default: <emphasis>true</emphasis></entry>
24241 <indexterm role="concept">
24242 <primary>message logs</primary>
24243 <secondary>disabling</secondary>
24245 <indexterm role="concept">
24246 <primary>log</primary>
24247 <secondary>message log; disabling</secondary>
24249 If this option is turned off, per-message log files are not created in the
24250 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
24251 Exim, by reducing the number of files involved in handling a message from a
24252 minimum of four (header spool file, body spool file, delivery journal, and
24253 per-message log) to three. The other major I/O activity is Exim’s main log,
24254 which is not affected by this option.
24257 <indexterm role="option">
24258 <primary><option>message_size_limit</option></primary>
24261 <informaltable frame="all">
24262 <tgroup cols="4" colsep="0" rowsep="0">
24263 <colspec colwidth="8*" align="left"/>
24264 <colspec colwidth="6*" align="center"/>
24265 <colspec colwidth="6*" align="center"/>
24266 <colspec colwidth="6*" align="right"/>
24269 <entry><option>message_size_limit</option></entry>
24270 <entry>Use: <emphasis>main</emphasis></entry>
24271 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
24272 <entry>Default: <emphasis>50M</emphasis></entry>
24278 <indexterm role="concept">
24279 <primary>message</primary>
24280 <secondary>size limit</secondary>
24282 <indexterm role="concept">
24283 <primary>limit</primary>
24284 <secondary>message size</secondary>
24286 <indexterm role="concept">
24287 <primary>size</primary>
24288 <secondary>of message, limit</secondary>
24290 This option limits the maximum size of message that Exim will process. The
24291 value is expanded for each incoming connection so, for example, it can be made
24292 to depend on the IP address of the remote host for messages arriving via
24293 TCP/IP. After expansion, the value must be a sequence of decimal digits,
24294 optionally followed by K or M.
24297 <emphasis role="bold">Note</emphasis>: This limit cannot be made to depend on a message’s sender or any
24298 other properties of an individual message, because it has to be advertised in
24299 the server’s response to EHLO. String expansion failure causes a temporary
24300 error. A value of zero means no limit, but its use is not recommended. See also
24301 <option>bounce_return_size_limit</option>.
24304 Incoming SMTP messages are failed with a 552 error if the limit is
24305 exceeded; locally-generated messages either get a stderr message or a delivery
24306 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
24307 an oversized message is logged in both the main and the reject logs. See also
24308 the generic transport option <option>message_size_limit</option>, which limits the size of
24309 message that an individual transport can process.
24312 <indexterm role="option">
24313 <primary><option>move_frozen_messages</option></primary>
24316 <informaltable frame="all">
24317 <tgroup cols="4" colsep="0" rowsep="0">
24318 <colspec colwidth="8*" align="left"/>
24319 <colspec colwidth="6*" align="center"/>
24320 <colspec colwidth="6*" align="center"/>
24321 <colspec colwidth="6*" align="right"/>
24324 <entry><option>move_frozen_messages</option></entry>
24325 <entry>Use: <emphasis>main</emphasis></entry>
24326 <entry>Type: <emphasis>boolean</emphasis></entry>
24327 <entry>Default: <emphasis>false</emphasis></entry>
24333 <indexterm role="concept">
24334 <primary>frozen messages</primary>
24335 <secondary>moving</secondary>
24337 This option, which is available only if Exim has been built with the setting
24339 <literallayout class="monospaced">
24340 SUPPORT_MOVE_FROZEN_MESSAGES=yes
24343 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
24344 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
24345 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
24346 standard utilities for handling such moved messages, and they do not show up in
24347 lists generated by <option>-bp</option> or by the Exim monitor.
24350 <indexterm role="option">
24351 <primary><option>mua_wrapper</option></primary>
24354 <informaltable frame="all">
24355 <tgroup cols="4" colsep="0" rowsep="0">
24356 <colspec colwidth="8*" align="left"/>
24357 <colspec colwidth="6*" align="center"/>
24358 <colspec colwidth="6*" align="center"/>
24359 <colspec colwidth="6*" align="right"/>
24362 <entry><option>mua_wrapper</option></entry>
24363 <entry>Use: <emphasis>main</emphasis></entry>
24364 <entry>Type: <emphasis>boolean</emphasis></entry>
24365 <entry>Default: <emphasis>false</emphasis></entry>
24371 Setting this option true causes Exim to run in a very restrictive mode in which
24372 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
24373 contains a full description of this facility.
24376 <indexterm role="option">
24377 <primary><option>mysql_servers</option></primary>
24380 <informaltable frame="all">
24381 <tgroup cols="4" colsep="0" rowsep="0">
24382 <colspec colwidth="8*" align="left"/>
24383 <colspec colwidth="6*" align="center"/>
24384 <colspec colwidth="6*" align="center"/>
24385 <colspec colwidth="6*" align="right"/>
24388 <entry><option>mysql_servers</option></entry>
24389 <entry>Use: <emphasis>main</emphasis></entry>
24390 <entry>Type: <emphasis>string list</emphasis></entry>
24391 <entry>Default: <emphasis>unset</emphasis></entry>
24397 <indexterm role="concept">
24398 <primary>MySQL</primary>
24399 <secondary>server list</secondary>
24401 This option provides a list of MySQL servers and associated connection data, to
24402 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECID72"/>). The
24403 option is available only if Exim has been built with MySQL support.
24406 <indexterm role="option">
24407 <primary><option>never_users</option></primary>
24410 <informaltable frame="all">
24411 <tgroup cols="4" colsep="0" rowsep="0">
24412 <colspec colwidth="8*" align="left"/>
24413 <colspec colwidth="6*" align="center"/>
24414 <colspec colwidth="6*" align="center"/>
24415 <colspec colwidth="6*" align="right"/>
24418 <entry><option>never_users</option></entry>
24419 <entry>Use: <emphasis>main</emphasis></entry>
24420 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
24421 <entry>Default: <emphasis>unset</emphasis></entry>
24427 This option is expanded just once, at the start of Exim’s processing. Local
24428 message deliveries are normally run in processes that are setuid to the
24429 recipient, and remote deliveries are normally run under Exim’s own uid and gid.
24430 It is usually desirable to prevent any deliveries from running as root, as a
24434 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
24435 list of users that must not be used for local deliveries. This list is fixed in
24436 the binary and cannot be overridden by the configuration file. By default, it
24437 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
24438 can be used to add more users to the fixed list.
24441 If a message is to be delivered as one of the users on the fixed list or the
24442 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
24445 <literallayout class="monospaced">
24446 never_users = root:daemon:bin
24449 Including root is redundant if it is also on the fixed list, but it does no
24450 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
24454 <indexterm role="option">
24455 <primary><option>oracle_servers</option></primary>
24458 <informaltable frame="all">
24459 <tgroup cols="4" colsep="0" rowsep="0">
24460 <colspec colwidth="8*" align="left"/>
24461 <colspec colwidth="6*" align="center"/>
24462 <colspec colwidth="6*" align="center"/>
24463 <colspec colwidth="6*" align="right"/>
24466 <entry><option>oracle_servers</option></entry>
24467 <entry>Use: <emphasis>main</emphasis></entry>
24468 <entry>Type: <emphasis>string list</emphasis></entry>
24469 <entry>Default: <emphasis>unset</emphasis></entry>
24475 <indexterm role="concept">
24476 <primary>Oracle</primary>
24477 <secondary>server list</secondary>
24479 This option provides a list of Oracle servers and associated connection data,
24480 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECID72"/>).
24481 The option is available only if Exim has been built with Oracle support.
24484 <indexterm role="option">
24485 <primary><option>percent_hack_domains</option></primary>
24488 <informaltable frame="all">
24489 <tgroup cols="4" colsep="0" rowsep="0">
24490 <colspec colwidth="8*" align="left"/>
24491 <colspec colwidth="6*" align="center"/>
24492 <colspec colwidth="6*" align="center"/>
24493 <colspec colwidth="6*" align="right"/>
24496 <entry><option>percent_hack_domains</option></entry>
24497 <entry>Use: <emphasis>main</emphasis></entry>
24498 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
24499 <entry>Default: <emphasis>unset</emphasis></entry>
24505 <indexterm role="concept">
24506 <primary><quote>percent hack</quote></primary>
24508 <indexterm role="concept">
24509 <primary>source routing</primary>
24510 <secondary>in email address</secondary>
24512 <indexterm role="concept">
24513 <primary>address</primary>
24514 <secondary>source-routed</secondary>
24516 The <quote>percent hack</quote> is the convention whereby a local part containing a
24517 percent sign is re-interpreted as a new email address, with the percent
24518 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
24519 also applied to RFC 2822 addresses that begin with an @ character. If this
24520 option is set, Exim implements the percent facility for those domains listed,
24521 but no others. This happens before an incoming SMTP address is tested against
24525 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
24526 trying to get round relaying restrictions. For this reason, it is best avoided
24527 if at all possible. Unfortunately, a number of less security-conscious MTAs
24528 implement it unconditionally. If you are running Exim on a gateway host, and
24529 routing mail through to internal MTAs without processing the local parts, it is
24530 a good idea to reject recipient addresses with percent characters in their
24531 local parts. Exim’s default configuration does this.
24534 <indexterm role="option">
24535 <primary><option>perl_at_start</option></primary>
24538 <informaltable frame="all">
24539 <tgroup cols="4" colsep="0" rowsep="0">
24540 <colspec colwidth="8*" align="left"/>
24541 <colspec colwidth="6*" align="center"/>
24542 <colspec colwidth="6*" align="center"/>
24543 <colspec colwidth="6*" align="right"/>
24546 <entry><option>perl_at_start</option></entry>
24547 <entry>Use: <emphasis>main</emphasis></entry>
24548 <entry>Type: <emphasis>boolean</emphasis></entry>
24549 <entry>Default: <emphasis>false</emphasis></entry>
24555 This option is available only when Exim is built with an embedded Perl
24556 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
24559 <indexterm role="option">
24560 <primary><option>perl_startup</option></primary>
24563 <informaltable frame="all">
24564 <tgroup cols="4" colsep="0" rowsep="0">
24565 <colspec colwidth="8*" align="left"/>
24566 <colspec colwidth="6*" align="center"/>
24567 <colspec colwidth="6*" align="center"/>
24568 <colspec colwidth="6*" align="right"/>
24571 <entry><option>perl_startup</option></entry>
24572 <entry>Use: <emphasis>main</emphasis></entry>
24573 <entry>Type: <emphasis>string</emphasis></entry>
24574 <entry>Default: <emphasis>unset</emphasis></entry>
24580 This option is available only when Exim is built with an embedded Perl
24581 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
24584 <indexterm role="option">
24585 <primary><option>pgsql_servers</option></primary>
24588 <informaltable frame="all">
24589 <tgroup cols="4" colsep="0" rowsep="0">
24590 <colspec colwidth="8*" align="left"/>
24591 <colspec colwidth="6*" align="center"/>
24592 <colspec colwidth="6*" align="center"/>
24593 <colspec colwidth="6*" align="right"/>
24596 <entry><option>pgsql_servers</option></entry>
24597 <entry>Use: <emphasis>main</emphasis></entry>
24598 <entry>Type: <emphasis>string list</emphasis></entry>
24599 <entry>Default: <emphasis>unset</emphasis></entry>
24605 <indexterm role="concept">
24606 <primary>PostgreSQL lookup type</primary>
24607 <secondary>server list</secondary>
24609 This option provides a list of PostgreSQL servers and associated connection
24610 data, to be used in conjunction with <command>pgsql</command> lookups (see section
24611 <xref linkend="SECID72"/>). The option is available only if Exim has been built with
24612 PostgreSQL support.
24615 <indexterm role="option">
24616 <primary><option>pid_file_path</option></primary>
24619 <informaltable frame="all">
24620 <tgroup cols="4" colsep="0" rowsep="0">
24621 <colspec colwidth="8*" align="left"/>
24622 <colspec colwidth="6*" align="center"/>
24623 <colspec colwidth="6*" align="center"/>
24624 <colspec colwidth="6*" align="right"/>
24627 <entry><option>pid_file_path</option></entry>
24628 <entry>Use: <emphasis>main</emphasis></entry>
24629 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
24630 <entry>Default: <emphasis>set at compile time</emphasis></entry>
24636 <indexterm role="concept">
24637 <primary>daemon</primary>
24638 <secondary>pid file path</secondary>
24640 <indexterm role="concept">
24641 <primary>pid file, path for</primary>
24643 This option sets the name of the file to which the Exim daemon writes its
24644 process id. The string is expanded, so it can contain, for example, references
24647 <literallayout class="monospaced">
24648 pid_file_path = /var/log/$primary_hostname/exim.pid
24651 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim’s
24653 The value set by the option can be overridden by the <option>-oP</option> command line
24654 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
24655 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
24658 <indexterm role="option">
24659 <primary><option>pipelining_advertise_hosts</option></primary>
24662 <informaltable frame="all">
24663 <tgroup cols="4" colsep="0" rowsep="0">
24664 <colspec colwidth="8*" align="left"/>
24665 <colspec colwidth="6*" align="center"/>
24666 <colspec colwidth="6*" align="center"/>
24667 <colspec colwidth="6*" align="right"/>
24670 <entry><option>pipelining_advertise_hosts</option></entry>
24671 <entry>Use: <emphasis>main</emphasis></entry>
24672 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
24673 <entry>Default: <emphasis>*</emphasis></entry>
24679 <indexterm role="concept">
24680 <primary>PIPELINING</primary>
24681 <secondary>suppressing advertising</secondary>
24683 This option can be used to suppress the advertisement of the SMTP
24684 PIPELINING extension to specific hosts. See also the <emphasis role="bold">no_pipelining</emphasis>
24685 control in section <xref linkend="SECTcontrols"/>. When PIPELINING is not advertised and
24686 <option>smtp_enforce_sync</option> is true, an Exim server enforces strict synchronization
24687 for each SMTP command and response. When PIPELINING is advertised, Exim assumes
24688 that clients will use it; <quote>out of order</quote> commands that are <quote>expected</quote> do
24689 not count as protocol errors (see <option>smtp_max_synprot_errors</option>).
24692 <indexterm role="option">
24693 <primary><option>preserve_message_logs</option></primary>
24696 <informaltable frame="all">
24697 <tgroup cols="4" colsep="0" rowsep="0">
24698 <colspec colwidth="8*" align="left"/>
24699 <colspec colwidth="6*" align="center"/>
24700 <colspec colwidth="6*" align="center"/>
24701 <colspec colwidth="6*" align="right"/>
24704 <entry><option>preserve_message_logs</option></entry>
24705 <entry>Use: <emphasis>main</emphasis></entry>
24706 <entry>Type: <emphasis>boolean</emphasis></entry>
24707 <entry>Default: <emphasis>false</emphasis></entry>
24713 <indexterm role="concept">
24714 <primary>message logs</primary>
24715 <secondary>preserving</secondary>
24717 If this option is set, message log files are not deleted when messages are
24718 completed. Instead, they are moved to a sub-directory of the spool directory
24719 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
24720 purposes. This is a dangerous option to set on systems with any appreciable
24721 volume of mail. Use with care!
24724 <indexterm role="option">
24725 <primary><option>primary_hostname</option></primary>
24728 <informaltable frame="all">
24729 <tgroup cols="4" colsep="0" rowsep="0">
24730 <colspec colwidth="8*" align="left"/>
24731 <colspec colwidth="6*" align="center"/>
24732 <colspec colwidth="6*" align="center"/>
24733 <colspec colwidth="6*" align="right"/>
24736 <entry><option>primary_hostname</option></entry>
24737 <entry>Use: <emphasis>main</emphasis></entry>
24738 <entry>Type: <emphasis>string</emphasis></entry>
24739 <entry>Default: <emphasis>see below</emphasis></entry>
24745 <indexterm role="concept">
24746 <primary>name</primary>
24747 <secondary>of local host</secondary>
24749 <indexterm role="concept">
24750 <primary>host</primary>
24751 <secondary>name of local</secondary>
24753 <indexterm role="concept">
24754 <primary>local host</primary>
24755 <secondary>name of</secondary>
24757 <indexterm role="variable">
24758 <primary><varname>$primary_hostname</varname></primary>
24760 This specifies the name of the current host. It is used in the default EHLO or
24761 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
24762 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
24763 The value is also used by default in some SMTP response messages from an Exim
24764 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
24767 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
24768 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
24769 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
24770 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
24771 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
24772 explicitly by this option, or defaulted.
24775 <indexterm role="option">
24776 <primary><option>print_topbitchars</option></primary>
24779 <informaltable frame="all">
24780 <tgroup cols="4" colsep="0" rowsep="0">
24781 <colspec colwidth="8*" align="left"/>
24782 <colspec colwidth="6*" align="center"/>
24783 <colspec colwidth="6*" align="center"/>
24784 <colspec colwidth="6*" align="right"/>
24787 <entry><option>print_topbitchars</option></entry>
24788 <entry>Use: <emphasis>main</emphasis></entry>
24789 <entry>Type: <emphasis>boolean</emphasis></entry>
24790 <entry>Default: <emphasis>false</emphasis></entry>
24796 <indexterm role="concept">
24797 <primary>printing characters</primary>
24799 <indexterm role="concept">
24800 <primary>8-bit characters</primary>
24802 By default, Exim considers only those characters whose codes lie in the range
24803 32–126 to be printing characters. In a number of circumstances (for example,
24804 when writing log entries) non-printing characters are converted into escape
24805 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
24806 is set, code values of 128 and above are also considered to be printing
24810 This option also affects the header syntax checks performed by the
24811 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
24812 the user’s full name when constructing From: and Sender: addresses (as
24813 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
24814 Exim to generate eight bit message headers that do not conform to the
24818 <indexterm role="option">
24819 <primary><option>process_log_path</option></primary>
24822 <informaltable frame="all">
24823 <tgroup cols="4" colsep="0" rowsep="0">
24824 <colspec colwidth="8*" align="left"/>
24825 <colspec colwidth="6*" align="center"/>
24826 <colspec colwidth="6*" align="center"/>
24827 <colspec colwidth="6*" align="right"/>
24830 <entry><option>process_log_path</option></entry>
24831 <entry>Use: <emphasis>main</emphasis></entry>
24832 <entry>Type: <emphasis>string</emphasis></entry>
24833 <entry>Default: <emphasis>unset</emphasis></entry>
24839 <indexterm role="concept">
24840 <primary>process log path</primary>
24842 <indexterm role="concept">
24843 <primary>log</primary>
24844 <secondary>process log</secondary>
24846 <indexterm role="concept">
24847 <primary><emphasis>exiwhat</emphasis></primary>
24849 This option sets the name of the file to which an Exim process writes its
24850 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
24851 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
24852 in Exim’s spool directory is used. The ability to specify the name explicitly
24853 can be useful in environments where two different Exims are running, using
24854 different spool directories.
24857 <indexterm role="option">
24858 <primary><option>prod_requires_admin</option></primary>
24861 <informaltable frame="all">
24862 <tgroup cols="4" colsep="0" rowsep="0">
24863 <colspec colwidth="8*" align="left"/>
24864 <colspec colwidth="6*" align="center"/>
24865 <colspec colwidth="6*" align="center"/>
24866 <colspec colwidth="6*" align="right"/>
24869 <entry><option>prod_requires_admin</option></entry>
24870 <entry>Use: <emphasis>main</emphasis></entry>
24871 <entry>Type: <emphasis>boolean</emphasis></entry>
24872 <entry>Default: <emphasis>true</emphasis></entry>
24878 <indexterm role="option">
24879 <primary><option>-M</option></primary>
24881 <indexterm role="option">
24882 <primary><option>-R</option></primary>
24884 <indexterm role="option">
24885 <primary><option>-q</option></primary>
24887 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
24888 admin user unless <option>prod_requires_admin</option> is set false. See also
24889 <option>queue_list_requires_admin</option>.
24892 <indexterm role="option">
24893 <primary><option>qualify_domain</option></primary>
24896 <informaltable frame="all">
24897 <tgroup cols="4" colsep="0" rowsep="0">
24898 <colspec colwidth="8*" align="left"/>
24899 <colspec colwidth="6*" align="center"/>
24900 <colspec colwidth="6*" align="center"/>
24901 <colspec colwidth="6*" align="right"/>
24904 <entry><option>qualify_domain</option></entry>
24905 <entry>Use: <emphasis>main</emphasis></entry>
24906 <entry>Type: <emphasis>string</emphasis></entry>
24907 <entry>Default: <emphasis>see below</emphasis></entry>
24913 <indexterm role="concept">
24914 <primary>domain</primary>
24915 <secondary>for qualifying addresses</secondary>
24917 <indexterm role="concept">
24918 <primary>address</primary>
24919 <secondary>qualification</secondary>
24921 This option specifies the domain name that is added to any envelope sender
24922 addresses that do not have a domain qualification. It also applies to
24923 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
24924 are accepted by default only for locally-generated messages. Qualification is
24925 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
24926 locally-generated messages, unless the <option>-bnq</option> command line option is used.
24929 Messages from external sources must always contain fully qualified addresses,
24930 unless the sending host matches <option>sender_unqualified_hosts</option> or
24931 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
24932 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
24933 necessary. Internally, Exim always works with fully qualified envelope
24934 addresses. If <option>qualify_domain</option> is not set, it defaults to the
24935 <option>primary_hostname</option> value.
24938 <indexterm role="option">
24939 <primary><option>qualify_recipient</option></primary>
24942 <informaltable frame="all">
24943 <tgroup cols="4" colsep="0" rowsep="0">
24944 <colspec colwidth="8*" align="left"/>
24945 <colspec colwidth="6*" align="center"/>
24946 <colspec colwidth="6*" align="center"/>
24947 <colspec colwidth="6*" align="right"/>
24950 <entry><option>qualify_recipient</option></entry>
24951 <entry>Use: <emphasis>main</emphasis></entry>
24952 <entry>Type: <emphasis>string</emphasis></entry>
24953 <entry>Default: <emphasis>see below</emphasis></entry>
24959 This option allows you to specify a different domain for qualifying recipient
24960 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
24963 <indexterm role="option">
24964 <primary><option>queue_domains</option></primary>
24967 <informaltable frame="all">
24968 <tgroup cols="4" colsep="0" rowsep="0">
24969 <colspec colwidth="8*" align="left"/>
24970 <colspec colwidth="6*" align="center"/>
24971 <colspec colwidth="6*" align="center"/>
24972 <colspec colwidth="6*" align="right"/>
24975 <entry><option>queue_domains</option></entry>
24976 <entry>Use: <emphasis>main</emphasis></entry>
24977 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
24978 <entry>Default: <emphasis>unset</emphasis></entry>
24984 <indexterm role="concept">
24985 <primary>domain</primary>
24986 <secondary>specifying non-immediate delivery</secondary>
24988 <indexterm role="concept">
24989 <primary>queueing incoming messages</primary>
24991 <indexterm role="concept">
24992 <primary>message</primary>
24993 <secondary>queueing certain domains</secondary>
24995 This option lists domains for which immediate delivery is not required.
24996 A delivery process is started whenever a message is received, but only those
24997 domains that do not match are processed. All other deliveries wait until the
24998 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
25001 <indexterm role="option">
25002 <primary><option>queue_list_requires_admin</option></primary>
25005 <informaltable frame="all">
25006 <tgroup cols="4" colsep="0" rowsep="0">
25007 <colspec colwidth="8*" align="left"/>
25008 <colspec colwidth="6*" align="center"/>
25009 <colspec colwidth="6*" align="center"/>
25010 <colspec colwidth="6*" align="right"/>
25013 <entry><option>queue_list_requires_admin</option></entry>
25014 <entry>Use: <emphasis>main</emphasis></entry>
25015 <entry>Type: <emphasis>boolean</emphasis></entry>
25016 <entry>Default: <emphasis>true</emphasis></entry>
25022 <indexterm role="option">
25023 <primary><option>-bp</option></primary>
25025 The <option>-bp</option> command-line option, which lists the messages that are on the
25026 queue, requires the caller to be an admin user unless
25027 <option>queue_list_requires_admin</option> is set false. See also <option>prod_requires_admin</option>.
25030 <indexterm role="option">
25031 <primary><option>queue_only</option></primary>
25034 <informaltable frame="all">
25035 <tgroup cols="4" colsep="0" rowsep="0">
25036 <colspec colwidth="8*" align="left"/>
25037 <colspec colwidth="6*" align="center"/>
25038 <colspec colwidth="6*" align="center"/>
25039 <colspec colwidth="6*" align="right"/>
25042 <entry><option>queue_only</option></entry>
25043 <entry>Use: <emphasis>main</emphasis></entry>
25044 <entry>Type: <emphasis>boolean</emphasis></entry>
25045 <entry>Default: <emphasis>false</emphasis></entry>
25051 <indexterm role="concept">
25052 <primary>queueing incoming messages</primary>
25054 <indexterm role="concept">
25055 <primary>message</primary>
25056 <secondary>queueing unconditionally</secondary>
25058 If <option>queue_only</option> is set, a delivery process is not automatically started
25059 whenever a message is received. Instead, the message waits on the queue for the
25060 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
25061 delivered immediately when certain conditions (such as heavy load) occur.
25064 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
25065 and <option>-odi</option> command line options override <option>queue_only</option> unless
25066 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
25067 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
25070 <indexterm role="option">
25071 <primary><option>queue_only_file</option></primary>
25074 <informaltable frame="all">
25075 <tgroup cols="4" colsep="0" rowsep="0">
25076 <colspec colwidth="8*" align="left"/>
25077 <colspec colwidth="6*" align="center"/>
25078 <colspec colwidth="6*" align="center"/>
25079 <colspec colwidth="6*" align="right"/>
25082 <entry><option>queue_only_file</option></entry>
25083 <entry>Use: <emphasis>main</emphasis></entry>
25084 <entry>Type: <emphasis>string</emphasis></entry>
25085 <entry>Default: <emphasis>unset</emphasis></entry>
25091 <indexterm role="concept">
25092 <primary>queueing incoming messages</primary>
25094 <indexterm role="concept">
25095 <primary>message</primary>
25096 <secondary>queueing by file existence</secondary>
25098 This option can be set to a colon-separated list of absolute path names, each
25099 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
25100 it tests for the existence of each listed path using a call to <function>stat()</function>. For
25101 each path that exists, the corresponding queueing option is set.
25102 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
25103 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
25105 <literallayout class="monospaced">
25106 queue_only_file = smtp/some/file
25109 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
25110 <filename>/some/file</filename> exists.
25113 <indexterm role="option">
25114 <primary><option>queue_only_load</option></primary>
25117 <informaltable frame="all">
25118 <tgroup cols="4" colsep="0" rowsep="0">
25119 <colspec colwidth="8*" align="left"/>
25120 <colspec colwidth="6*" align="center"/>
25121 <colspec colwidth="6*" align="center"/>
25122 <colspec colwidth="6*" align="right"/>
25125 <entry><option>queue_only_load</option></entry>
25126 <entry>Use: <emphasis>main</emphasis></entry>
25127 <entry>Type: <emphasis>fixed-point</emphasis></entry>
25128 <entry>Default: <emphasis>unset</emphasis></entry>
25134 <indexterm role="concept">
25135 <primary>load average</primary>
25137 <indexterm role="concept">
25138 <primary>queueing incoming messages</primary>
25140 <indexterm role="concept">
25141 <primary>message</primary>
25142 <secondary>queueing by load</secondary>
25144 If the system load average is higher than this value, incoming messages from
25145 all sources are queued, and no automatic deliveries are started. If this
25146 happens during local or remote SMTP input, all subsequent messages received on
25147 the same SMTP connection are queued by default, whatever happens to the load in
25148 the meantime, but this can be changed by setting <option>queue_only_load_latch</option>
25152 Deliveries will subsequently be performed by queue runner processes. This
25153 option has no effect on ancient operating systems on which Exim cannot
25154 determine the load average. See also <option>deliver_queue_load_max</option> and
25155 <option>smtp_load_reserve</option>.
25158 <indexterm role="option">
25159 <primary><option>queue_only_load_latch</option></primary>
25162 <informaltable frame="all">
25163 <tgroup cols="4" colsep="0" rowsep="0">
25164 <colspec colwidth="8*" align="left"/>
25165 <colspec colwidth="6*" align="center"/>
25166 <colspec colwidth="6*" align="center"/>
25167 <colspec colwidth="6*" align="right"/>
25170 <entry><option>queue_only_load_latch</option></entry>
25171 <entry>Use: <emphasis>main</emphasis></entry>
25172 <entry>Type: <emphasis>boolean</emphasis></entry>
25173 <entry>Default: <emphasis>true</emphasis></entry>
25179 <indexterm role="concept">
25180 <primary>load average</primary>
25181 <secondary>re-evaluating per message</secondary>
25183 When this option is true (the default), once one message has been queued
25184 because the load average is higher than the value set by <option>queue_only_load</option>,
25185 all subsequent messages received on the same SMTP connection are also queued.
25186 This is a deliberate choice; even though the load average may fall below the
25187 threshold, it doesn’t seem right to deliver later messages on the same
25188 connection when not delivering earlier ones. However, there are special
25189 circumstances such as very long-lived connections from scanning appliances
25190 where this is not the best strategy. In such cases, <option>queue_only_load_latch</option>
25191 should be set false. This causes the value of the load average to be
25192 re-evaluated for each message.
25195 <indexterm role="option">
25196 <primary><option>queue_only_override</option></primary>
25199 <informaltable frame="all">
25200 <tgroup cols="4" colsep="0" rowsep="0">
25201 <colspec colwidth="8*" align="left"/>
25202 <colspec colwidth="6*" align="center"/>
25203 <colspec colwidth="6*" align="center"/>
25204 <colspec colwidth="6*" align="right"/>
25207 <entry><option>queue_only_override</option></entry>
25208 <entry>Use: <emphasis>main</emphasis></entry>
25209 <entry>Type: <emphasis>boolean</emphasis></entry>
25210 <entry>Default: <emphasis>true</emphasis></entry>
25216 <indexterm role="concept">
25217 <primary>queueing incoming messages</primary>
25219 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
25220 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
25221 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
25222 to override; they are accepted, but ignored.
25225 <indexterm role="option">
25226 <primary><option>queue_run_in_order</option></primary>
25229 <informaltable frame="all">
25230 <tgroup cols="4" colsep="0" rowsep="0">
25231 <colspec colwidth="8*" align="left"/>
25232 <colspec colwidth="6*" align="center"/>
25233 <colspec colwidth="6*" align="center"/>
25234 <colspec colwidth="6*" align="right"/>
25237 <entry><option>queue_run_in_order</option></entry>
25238 <entry>Use: <emphasis>main</emphasis></entry>
25239 <entry>Type: <emphasis>boolean</emphasis></entry>
25240 <entry>Default: <emphasis>false</emphasis></entry>
25246 <indexterm role="concept">
25247 <primary>queue runner</primary>
25248 <secondary>processing messages in order</secondary>
25250 If this option is set, queue runs happen in order of message arrival instead of
25251 in an arbitrary order. For this to happen, a complete list of the entire queue
25252 must be set up before the deliveries start. When the queue is all held in a
25253 single directory (the default), a single list is created for both the ordered
25254 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
25255 single list is not created when <option>queue_run_in_order</option> is false. In this case,
25256 the sub-directories are processed one at a time (in a random order), and this
25257 avoids setting up one huge list for the whole queue. Thus, setting
25258 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
25259 when the queue is large, because of the extra work in setting up the single,
25260 large list. In most situations, <option>queue_run_in_order</option> should not be set.
25263 <indexterm role="option">
25264 <primary><option>queue_run_max</option></primary>
25267 <informaltable frame="all">
25268 <tgroup cols="4" colsep="0" rowsep="0">
25269 <colspec colwidth="8*" align="left"/>
25270 <colspec colwidth="6*" align="center"/>
25271 <colspec colwidth="6*" align="center"/>
25272 <colspec colwidth="6*" align="right"/>
25275 <entry><option>queue_run_max</option></entry>
25276 <entry>Use: <emphasis>main</emphasis></entry>
25277 <entry>Type: <emphasis>integer</emphasis></entry>
25278 <entry>Default: <emphasis>5</emphasis></entry>
25284 <indexterm role="concept">
25285 <primary>queue runner</primary>
25286 <secondary>maximum number of</secondary>
25288 This controls the maximum number of queue runner processes that an Exim daemon
25289 can run simultaneously. This does not mean that it starts them all at once,
25290 but rather that if the maximum number are still running when the time comes to
25291 start another one, it refrains from starting another one. This can happen with
25292 very large queues and/or very sluggish deliveries. This option does not,
25293 however, interlock with other processes, so additional queue runners can be
25294 started by other means, or by killing and restarting the daemon.
25297 Setting this option to zero does not suppress queue runs; rather, it disables
25298 the limit, allowing any number of simultaneous queue runner processes to be
25299 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
25300 the daemon’s command line.
25303 <indexterm role="option">
25304 <primary><option>queue_smtp_domains</option></primary>
25307 <informaltable frame="all">
25308 <tgroup cols="4" colsep="0" rowsep="0">
25309 <colspec colwidth="8*" align="left"/>
25310 <colspec colwidth="6*" align="center"/>
25311 <colspec colwidth="6*" align="center"/>
25312 <colspec colwidth="6*" align="right"/>
25315 <entry><option>queue_smtp_domains</option></entry>
25316 <entry>Use: <emphasis>main</emphasis></entry>
25317 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
25318 <entry>Default: <emphasis>unset</emphasis></entry>
25324 <indexterm role="concept">
25325 <primary>queueing incoming messages</primary>
25327 <indexterm role="concept">
25328 <primary>message</primary>
25329 <secondary>queueing remote deliveries</secondary>
25331 When this option is set, a delivery process is started whenever a message is
25332 received, routing is performed, and local deliveries take place.
25333 However, if any SMTP deliveries are required for domains that match
25334 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
25335 message waits on the queue for the next queue run. Since routing of the message
25336 has taken place, Exim knows to which remote hosts it must be delivered, and so
25337 when the queue run happens, multiple messages for the same host are delivered
25338 over a single SMTP connection. The <option>-odqs</option> command line option causes all
25339 SMTP deliveries to be queued in this way, and is equivalent to setting
25340 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
25341 <option>queue_domains</option>.
25344 <indexterm role="option">
25345 <primary><option>receive_timeout</option></primary>
25348 <informaltable frame="all">
25349 <tgroup cols="4" colsep="0" rowsep="0">
25350 <colspec colwidth="8*" align="left"/>
25351 <colspec colwidth="6*" align="center"/>
25352 <colspec colwidth="6*" align="center"/>
25353 <colspec colwidth="6*" align="right"/>
25356 <entry><option>receive_timeout</option></entry>
25357 <entry>Use: <emphasis>main</emphasis></entry>
25358 <entry>Type: <emphasis>time</emphasis></entry>
25359 <entry>Default: <emphasis>0s</emphasis></entry>
25365 <indexterm role="concept">
25366 <primary>timeout</primary>
25367 <secondary>for non-SMTP input</secondary>
25369 This option sets the timeout for accepting a non-SMTP message, that is, the
25370 maximum time that Exim waits when reading a message on the standard input. If
25371 the value is zero, it will wait for ever. This setting is overridden by the
25372 <option>-or</option> command line option. The timeout for incoming SMTP messages is
25373 controlled by <option>smtp_receive_timeout</option>.
25376 <indexterm role="option">
25377 <primary><option>received_header_text</option></primary>
25380 <informaltable frame="all">
25381 <tgroup cols="4" colsep="0" rowsep="0">
25382 <colspec colwidth="8*" align="left"/>
25383 <colspec colwidth="6*" align="center"/>
25384 <colspec colwidth="6*" align="center"/>
25385 <colspec colwidth="6*" align="right"/>
25388 <entry><option>received_header_text</option></entry>
25389 <entry>Use: <emphasis>main</emphasis></entry>
25390 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
25391 <entry>Default: <emphasis>see below</emphasis></entry>
25397 <indexterm role="concept">
25398 <primary>customizing</primary>
25399 <secondary><emphasis>Received:</emphasis> header</secondary>
25401 <indexterm role="concept">
25402 <primary><emphasis>Received:</emphasis> header line</primary>
25403 <secondary>customizing</secondary>
25405 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
25406 added to each message, except for the timestamp, which is automatically added
25407 on at the end (preceded by a semicolon). The string is expanded each time it is
25408 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
25409 added to the message. Otherwise, the string should start with the text
25410 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
25411 header lines. The default setting is:
25413 <literallayout class="monospaced">
25414 received_header_text = Received: \
25415 ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
25416 {${if def:sender_ident \
25417 {from ${quote_local_part:$sender_ident} }}\
25418 ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
25419 by $primary_hostname \
25420 ${if def:received_protocol {with $received_protocol}} \
25421 ${if def:tls_cipher {($tls_cipher)\n\t}}\
25422 (Exim $version_number)\n\t\
25423 ${if def:sender_address \
25424 {(envelope-from <$sender_address>)\n\t}}\
25425 id $message_exim_id\
25426 ${if def:received_for {\n\tfor $received_for}}
25429 The reference to the TLS cipher is omitted when Exim is built without TLS
25430 support. The use of conditional expansions ensures that this works for both
25431 locally generated messages and messages received from remote hosts, giving
25432 header lines such as the following:
25434 <literallayout class="monospaced">
25435 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
25436 by marley.carol.example with esmtp (Exim 4.00)
25437 (envelope-from <bob@carol.example>)
25438 id 16IOWa-00019l-00
25439 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
25440 Received: by scrooge.carol.example with local (Exim 4.00)
25441 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
25444 Until the body of the message has been received, the timestamp is the time when
25445 the message started to be received. Once the body has arrived, and all policy
25446 checks have taken place, the timestamp is updated to the time at which the
25447 message was accepted.
25450 <indexterm role="option">
25451 <primary><option>received_headers_max</option></primary>
25454 <informaltable frame="all">
25455 <tgroup cols="4" colsep="0" rowsep="0">
25456 <colspec colwidth="8*" align="left"/>
25457 <colspec colwidth="6*" align="center"/>
25458 <colspec colwidth="6*" align="center"/>
25459 <colspec colwidth="6*" align="right"/>
25462 <entry><option>received_headers_max</option></entry>
25463 <entry>Use: <emphasis>main</emphasis></entry>
25464 <entry>Type: <emphasis>integer</emphasis></entry>
25465 <entry>Default: <emphasis>30</emphasis></entry>
25471 <indexterm role="concept">
25472 <primary>loop</primary>
25473 <secondary>prevention</secondary>
25475 <indexterm role="concept">
25476 <primary>mail loop prevention</primary>
25478 <indexterm role="concept">
25479 <primary><emphasis>Received:</emphasis> header line</primary>
25480 <secondary>counting</secondary>
25482 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
25483 counted, and if it is greater than this parameter, a mail loop is assumed to
25484 have occurred, the delivery is abandoned, and an error message is generated.
25485 This applies to both local and remote deliveries.
25488 <indexterm role="option">
25489 <primary><option>recipient_unqualified_hosts</option></primary>
25492 <informaltable frame="all">
25493 <tgroup cols="4" colsep="0" rowsep="0">
25494 <colspec colwidth="8*" align="left"/>
25495 <colspec colwidth="6*" align="center"/>
25496 <colspec colwidth="6*" align="center"/>
25497 <colspec colwidth="6*" align="right"/>
25500 <entry><option>recipient_unqualified_hosts</option></entry>
25501 <entry>Use: <emphasis>main</emphasis></entry>
25502 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
25503 <entry>Default: <emphasis>unset</emphasis></entry>
25509 <indexterm role="concept">
25510 <primary>unqualified addresses</primary>
25512 <indexterm role="concept">
25513 <primary>host</primary>
25514 <secondary>unqualified addresses from</secondary>
25516 This option lists those hosts from which Exim is prepared to accept unqualified
25517 recipient addresses in message envelopes. The addresses are made fully
25518 qualified by the addition of the <option>qualify_recipient</option> value. This option also
25519 affects message header lines. Exim does not reject unqualified recipient
25520 addresses in headers, but it qualifies them only if the message came from a
25521 host that matches <option>recipient_unqualified_hosts</option>,
25522 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
25523 option was not set.
25526 <indexterm role="option">
25527 <primary><option>recipients_max</option></primary>
25530 <informaltable frame="all">
25531 <tgroup cols="4" colsep="0" rowsep="0">
25532 <colspec colwidth="8*" align="left"/>
25533 <colspec colwidth="6*" align="center"/>
25534 <colspec colwidth="6*" align="center"/>
25535 <colspec colwidth="6*" align="right"/>
25538 <entry><option>recipients_max</option></entry>
25539 <entry>Use: <emphasis>main</emphasis></entry>
25540 <entry>Type: <emphasis>integer</emphasis></entry>
25541 <entry>Default: <emphasis>0</emphasis></entry>
25547 <indexterm role="concept">
25548 <primary>limit</primary>
25549 <secondary>number of recipients</secondary>
25551 <indexterm role="concept">
25552 <primary>recipient</primary>
25553 <secondary>maximum number</secondary>
25555 If this option is set greater than zero, it specifies the maximum number of
25556 original recipients for any message. Additional recipients that are generated
25557 by aliasing or forwarding do not count. SMTP messages get a 452 response for
25558 all recipients over the limit; earlier recipients are delivered as normal.
25559 Non-SMTP messages with too many recipients are failed, and no deliveries are
25563 <indexterm role="concept">
25564 <primary>RCPT</primary>
25565 <secondary>maximum number of incoming</secondary>
25567 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
25568 RCPT commands in a single message.
25571 <indexterm role="option">
25572 <primary><option>recipients_max_reject</option></primary>
25575 <informaltable frame="all">
25576 <tgroup cols="4" colsep="0" rowsep="0">
25577 <colspec colwidth="8*" align="left"/>
25578 <colspec colwidth="6*" align="center"/>
25579 <colspec colwidth="6*" align="center"/>
25580 <colspec colwidth="6*" align="right"/>
25583 <entry><option>recipients_max_reject</option></entry>
25584 <entry>Use: <emphasis>main</emphasis></entry>
25585 <entry>Type: <emphasis>boolean</emphasis></entry>
25586 <entry>Default: <emphasis>false</emphasis></entry>
25592 If this option is set true, Exim rejects SMTP messages containing too many
25593 recipients by giving 552 errors to the surplus RCPT commands, and a 554
25594 error to the eventual DATA command. Otherwise (the default) it gives a 452
25595 error to the surplus RCPT commands and accepts the message on behalf of the
25596 initial set of recipients. The remote server should then re-send the message
25597 for the remaining recipients at a later time.
25600 <indexterm role="option">
25601 <primary><option>remote_max_parallel</option></primary>
25604 <informaltable frame="all">
25605 <tgroup cols="4" colsep="0" rowsep="0">
25606 <colspec colwidth="8*" align="left"/>
25607 <colspec colwidth="6*" align="center"/>
25608 <colspec colwidth="6*" align="center"/>
25609 <colspec colwidth="6*" align="right"/>
25612 <entry><option>remote_max_parallel</option></entry>
25613 <entry>Use: <emphasis>main</emphasis></entry>
25614 <entry>Type: <emphasis>integer</emphasis></entry>
25615 <entry>Default: <emphasis>2</emphasis></entry>
25621 <indexterm role="concept">
25622 <primary>delivery</primary>
25623 <secondary>parallelism for remote</secondary>
25625 This option controls parallel delivery of one message to a number of remote
25626 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
25627 does all the remote deliveries for a message one by one. Otherwise, if a single
25628 message has to be delivered to more than one remote host, or if several copies
25629 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
25630 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
25631 deliveries are required, the maximum number of processes are started, and as
25632 each one finishes, another is begun. The order of starting processes is the
25633 same as if sequential delivery were being done, and can be controlled by the
25634 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
25635 with debugging turned on, the debugging output from each delivery process is
25636 tagged with its process id.
25639 This option controls only the maximum number of parallel deliveries for one
25640 message in one Exim delivery process. Because Exim has no central queue
25641 manager, there is no way of controlling the total number of simultaneous
25642 deliveries if the configuration allows a delivery attempt as soon as a message
25646 <indexterm role="concept">
25647 <primary>number of deliveries</primary>
25649 <indexterm role="concept">
25650 <primary>delivery</primary>
25651 <secondary>maximum number of</secondary>
25653 If you want to control the total number of deliveries on the system, you
25654 need to set the <option>queue_only</option> option. This ensures that all incoming messages
25655 are added to the queue without starting a delivery process. Then set up an Exim
25656 daemon to start queue runner processes at appropriate intervals (probably
25657 fairly often, for example, every minute), and limit the total number of queue
25658 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
25659 delivers only one message at a time, the maximum number of deliveries that can
25660 then take place at once is <option>queue_run_max</option> multiplied by
25661 <option>remote_max_parallel</option>.
25664 If it is purely remote deliveries you want to control, use
25665 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
25666 doing the SMTP routing before queueing, so that several messages for the same
25667 host will eventually get delivered down the same connection.
25670 <indexterm role="option">
25671 <primary><option>remote_sort_domains</option></primary>
25674 <informaltable frame="all">
25675 <tgroup cols="4" colsep="0" rowsep="0">
25676 <colspec colwidth="8*" align="left"/>
25677 <colspec colwidth="6*" align="center"/>
25678 <colspec colwidth="6*" align="center"/>
25679 <colspec colwidth="6*" align="right"/>
25682 <entry><option>remote_sort_domains</option></entry>
25683 <entry>Use: <emphasis>main</emphasis></entry>
25684 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
25685 <entry>Default: <emphasis>unset</emphasis></entry>
25691 <indexterm role="concept">
25692 <primary>sorting remote deliveries</primary>
25694 <indexterm role="concept">
25695 <primary>delivery</primary>
25696 <secondary>sorting remote</secondary>
25698 When there are a number of remote deliveries for a message, they are sorted by
25699 domain into the order given by this list. For example,
25701 <literallayout class="monospaced">
25702 remote_sort_domains = *.cam.ac.uk:*.uk
25705 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
25706 then to those in the <option>uk</option> domain, then to any others.
25709 <indexterm role="option">
25710 <primary><option>retry_data_expire</option></primary>
25713 <informaltable frame="all">
25714 <tgroup cols="4" colsep="0" rowsep="0">
25715 <colspec colwidth="8*" align="left"/>
25716 <colspec colwidth="6*" align="center"/>
25717 <colspec colwidth="6*" align="center"/>
25718 <colspec colwidth="6*" align="right"/>
25721 <entry><option>retry_data_expire</option></entry>
25722 <entry>Use: <emphasis>main</emphasis></entry>
25723 <entry>Type: <emphasis>time</emphasis></entry>
25724 <entry>Default: <emphasis>7d</emphasis></entry>
25730 <indexterm role="concept">
25731 <primary>hints database</primary>
25732 <secondary>data expiry</secondary>
25734 This option sets a <quote>use before</quote> time on retry information in Exim’s hints
25735 database. Any older retry data is ignored. This means that, for example, once a
25736 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
25740 <indexterm role="option">
25741 <primary><option>retry_interval_max</option></primary>
25744 <informaltable frame="all">
25745 <tgroup cols="4" colsep="0" rowsep="0">
25746 <colspec colwidth="8*" align="left"/>
25747 <colspec colwidth="6*" align="center"/>
25748 <colspec colwidth="6*" align="center"/>
25749 <colspec colwidth="6*" align="right"/>
25752 <entry><option>retry_interval_max</option></entry>
25753 <entry>Use: <emphasis>main</emphasis></entry>
25754 <entry>Type: <emphasis>time</emphasis></entry>
25755 <entry>Default: <emphasis>24h</emphasis></entry>
25761 <indexterm role="concept">
25762 <primary>retry</primary>
25763 <secondary>limit on interval</secondary>
25765 <indexterm role="concept">
25766 <primary>limit</primary>
25767 <secondary>on retry interval</secondary>
25769 Chapter <xref linkend="CHAPretry"/> describes Exim’s mechanisms for controlling the
25770 intervals between delivery attempts for messages that cannot be delivered
25771 straight away. This option sets an overall limit to the length of time between
25772 retries. It cannot be set greater than 24 hours; any attempt to do so forces
25776 <indexterm role="option">
25777 <primary><option>return_path_remove</option></primary>
25780 <informaltable frame="all">
25781 <tgroup cols="4" colsep="0" rowsep="0">
25782 <colspec colwidth="8*" align="left"/>
25783 <colspec colwidth="6*" align="center"/>
25784 <colspec colwidth="6*" align="center"/>
25785 <colspec colwidth="6*" align="right"/>
25788 <entry><option>return_path_remove</option></entry>
25789 <entry>Use: <emphasis>main</emphasis></entry>
25790 <entry>Type: <emphasis>boolean</emphasis></entry>
25791 <entry>Default: <emphasis>true</emphasis></entry>
25797 <indexterm role="concept">
25798 <primary><emphasis>Return-path:</emphasis> header line</primary>
25799 <secondary>removing</secondary>
25801 RFC 2821, section 4.4, states that an SMTP server must insert a
25802 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
25803 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
25804 MAIL command. This description implies that this header should not be present
25805 in an incoming message. If <option>return_path_remove</option> is true, any existing
25806 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
25807 received. Exim’s transports have options for adding <emphasis>Return-path:</emphasis> headers at
25808 the time of delivery. They are normally used only for final local deliveries.
25811 <indexterm role="option">
25812 <primary><option>return_size_limit</option></primary>
25815 <informaltable frame="all">
25816 <tgroup cols="4" colsep="0" rowsep="0">
25817 <colspec colwidth="8*" align="left"/>
25818 <colspec colwidth="6*" align="center"/>
25819 <colspec colwidth="6*" align="center"/>
25820 <colspec colwidth="6*" align="right"/>
25823 <entry><option>return_size_limit</option></entry>
25824 <entry>Use: <emphasis>main</emphasis></entry>
25825 <entry>Type: <emphasis>integer</emphasis></entry>
25826 <entry>Default: <emphasis>100K</emphasis></entry>
25832 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
25835 <indexterm role="option">
25836 <primary><option>rfc1413_hosts</option></primary>
25839 <informaltable frame="all">
25840 <tgroup cols="4" colsep="0" rowsep="0">
25841 <colspec colwidth="8*" align="left"/>
25842 <colspec colwidth="6*" align="center"/>
25843 <colspec colwidth="6*" align="center"/>
25844 <colspec colwidth="6*" align="right"/>
25847 <entry><option>rfc1413_hosts</option></entry>
25848 <entry>Use: <emphasis>main</emphasis></entry>
25849 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
25850 <entry>Default: <emphasis>*</emphasis></entry>
25856 <indexterm role="concept">
25857 <primary>RFC 1413</primary>
25859 <indexterm role="concept">
25860 <primary>host</primary>
25861 <secondary>for RFC 1413 calls</secondary>
25863 RFC 1413 identification calls are made to any client host which matches an item
25867 <indexterm role="option">
25868 <primary><option>rfc1413_query_timeout</option></primary>
25871 <informaltable frame="all">
25872 <tgroup cols="4" colsep="0" rowsep="0">
25873 <colspec colwidth="8*" align="left"/>
25874 <colspec colwidth="6*" align="center"/>
25875 <colspec colwidth="6*" align="center"/>
25876 <colspec colwidth="6*" align="right"/>
25879 <entry><option>rfc1413_query_timeout</option></entry>
25880 <entry>Use: <emphasis>main</emphasis></entry>
25881 <entry>Type: <emphasis>time</emphasis></entry>
25882 <entry>Default: <emphasis>5s</emphasis></entry>
25888 <indexterm role="concept">
25889 <primary>RFC 1413</primary>
25890 <secondary>query timeout</secondary>
25892 <indexterm role="concept">
25893 <primary>timeout</primary>
25894 <secondary>for RFC 1413 call</secondary>
25896 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
25897 no RFC 1413 calls are ever made.
25900 <indexterm role="option">
25901 <primary><option>sender_unqualified_hosts</option></primary>
25904 <informaltable frame="all">
25905 <tgroup cols="4" colsep="0" rowsep="0">
25906 <colspec colwidth="8*" align="left"/>
25907 <colspec colwidth="6*" align="center"/>
25908 <colspec colwidth="6*" align="center"/>
25909 <colspec colwidth="6*" align="right"/>
25912 <entry><option>sender_unqualified_hosts</option></entry>
25913 <entry>Use: <emphasis>main</emphasis></entry>
25914 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
25915 <entry>Default: <emphasis>unset</emphasis></entry>
25921 <indexterm role="concept">
25922 <primary>unqualified addresses</primary>
25924 <indexterm role="concept">
25925 <primary>host</primary>
25926 <secondary>unqualified addresses from</secondary>
25928 This option lists those hosts from which Exim is prepared to accept unqualified
25929 sender addresses. The addresses are made fully qualified by the addition of
25930 <option>qualify_domain</option>. This option also affects message header lines. Exim does
25931 not reject unqualified addresses in headers that contain sender addresses, but
25932 it qualifies them only if the message came from a host that matches
25933 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
25934 using TCP/IP), and the <option>-bnq</option> option was not set.
25937 <indexterm role="option">
25938 <primary><option>smtp_accept_keepalive</option></primary>
25941 <informaltable frame="all">
25942 <tgroup cols="4" colsep="0" rowsep="0">
25943 <colspec colwidth="8*" align="left"/>
25944 <colspec colwidth="6*" align="center"/>
25945 <colspec colwidth="6*" align="center"/>
25946 <colspec colwidth="6*" align="right"/>
25949 <entry><option>smtp_accept_keepalive</option></entry>
25950 <entry>Use: <emphasis>main</emphasis></entry>
25951 <entry>Type: <emphasis>boolean</emphasis></entry>
25952 <entry>Default: <emphasis>true</emphasis></entry>
25958 <indexterm role="concept">
25959 <primary>keepalive</primary>
25960 <secondary>on incoming connection</secondary>
25962 This option controls the setting of the SO_KEEPALIVE option on incoming
25963 TCP/IP socket connections. When set, it causes the kernel to probe idle
25964 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
25965 other end of the connection should send an acknowledgment if the connection is
25966 still okay or a reset if the connection has been aborted. The reason for doing
25967 this is that it has the beneficial effect of freeing up certain types of
25968 connection that can get stuck when the remote host is disconnected without
25969 tidying up the TCP/IP call properly. The keepalive mechanism takes several
25970 hours to detect unreachable hosts.
25973 <indexterm role="option">
25974 <primary><option>smtp_accept_max</option></primary>
25977 <informaltable frame="all">
25978 <tgroup cols="4" colsep="0" rowsep="0">
25979 <colspec colwidth="8*" align="left"/>
25980 <colspec colwidth="6*" align="center"/>
25981 <colspec colwidth="6*" align="center"/>
25982 <colspec colwidth="6*" align="right"/>
25985 <entry><option>smtp_accept_max</option></entry>
25986 <entry>Use: <emphasis>main</emphasis></entry>
25987 <entry>Type: <emphasis>integer</emphasis></entry>
25988 <entry>Default: <emphasis>20</emphasis></entry>
25994 <indexterm role="concept">
25995 <primary>limit</primary>
25996 <secondary>incoming SMTP connections</secondary>
25998 <indexterm role="concept">
25999 <primary>SMTP</primary>
26000 <secondary>incoming connection count</secondary>
26002 <indexterm role="concept">
26003 <primary>inetd</primary>
26005 This option specifies the maximum number of simultaneous incoming SMTP calls
26006 that Exim will accept. It applies only to the listening daemon; there is no
26007 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
26008 value is set to zero, no limit is applied. However, it is required to be
26009 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
26010 set. See also <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option>.
26013 A new SMTP connection is immediately rejected if the <option>smtp_accept_max</option> limit
26014 has been reached. If not, Exim first checks <option>smtp_accept_max_per_host</option>. If
26015 that limit has not been reached for the client host, <option>smtp_accept_reserve</option>
26016 and <option>smtp_load_reserve</option> are then checked before accepting the connection.
26019 <indexterm role="option">
26020 <primary><option>smtp_accept_max_nonmail</option></primary>
26023 <informaltable frame="all">
26024 <tgroup cols="4" colsep="0" rowsep="0">
26025 <colspec colwidth="8*" align="left"/>
26026 <colspec colwidth="6*" align="center"/>
26027 <colspec colwidth="6*" align="center"/>
26028 <colspec colwidth="6*" align="right"/>
26031 <entry><option>smtp_accept_max_nonmail</option></entry>
26032 <entry>Use: <emphasis>main</emphasis></entry>
26033 <entry>Type: <emphasis>integer</emphasis></entry>
26034 <entry>Default: <emphasis>10</emphasis></entry>
26040 <indexterm role="concept">
26041 <primary>limit</primary>
26042 <secondary>non-mail SMTP commands</secondary>
26044 <indexterm role="concept">
26045 <primary>SMTP</primary>
26046 <secondary>limiting non-mail commands</secondary>
26048 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
26049 the connection if there are too many. This option defines <quote>too many</quote>. The
26050 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
26051 client looping sending EHLO, for example. The check is applied only if the
26052 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
26055 When a new message is expected, one occurrence of RSET is not counted. This
26056 allows a client to send one RSET between messages (this is not necessary,
26057 but some clients do it). Exim also allows one uncounted occurrence of HELO
26058 or EHLO, and one occurrence of STARTTLS between messages. After
26059 starting up a TLS session, another EHLO is expected, and so it too is not
26060 counted. The first occurrence of AUTH in a connection, or immediately
26061 following STARTTLS is not counted. Otherwise, all commands other than
26062 MAIL, RCPT, DATA, and QUIT are counted.
26065 <indexterm role="option">
26066 <primary><option>smtp_accept_max_nonmail_hosts</option></primary>
26069 <informaltable frame="all">
26070 <tgroup cols="4" colsep="0" rowsep="0">
26071 <colspec colwidth="8*" align="left"/>
26072 <colspec colwidth="6*" align="center"/>
26073 <colspec colwidth="6*" align="center"/>
26074 <colspec colwidth="6*" align="right"/>
26077 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
26078 <entry>Use: <emphasis>main</emphasis></entry>
26079 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
26080 <entry>Default: <emphasis>*</emphasis></entry>
26086 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
26087 check by setting this option. The default value makes it apply to all hosts. By
26088 changing the value, you can exclude any badly-behaved hosts that you have to
26092 <indexterm role="option">
26093 <primary><option>smtp_accept_max_per_connection</option></primary>
26096 <informaltable frame="all">
26097 <tgroup cols="4" colsep="0" rowsep="0">
26098 <colspec colwidth="8*" align="left"/>
26099 <colspec colwidth="6*" align="center"/>
26100 <colspec colwidth="6*" align="center"/>
26101 <colspec colwidth="6*" align="right"/>
26104 <entry><option>smtp_accept_max_per_ connection</option></entry>
26105 <entry>Use: <emphasis>main</emphasis></entry>
26106 <entry>Type: <emphasis>integer</emphasis></entry>
26107 <entry>Default: <emphasis>1000</emphasis></entry>
26113 <indexterm role="concept">
26114 <primary>SMTP</primary>
26115 <secondary>limiting incoming message count</secondary>
26117 <indexterm role="concept">
26118 <primary>limit</primary>
26119 <secondary>messages per SMTP connection</secondary>
26121 The value of this option limits the number of MAIL commands that Exim is
26122 prepared to accept over a single SMTP connection, whether or not each command
26123 results in the transfer of a message. After the limit is reached, a 421
26124 response is given to subsequent MAIL commands. This limit is a safety
26125 precaution against a client that goes mad (incidents of this type have been
26129 <indexterm role="option">
26130 <primary><option>smtp_accept_max_per_host</option></primary>
26133 <informaltable frame="all">
26134 <tgroup cols="4" colsep="0" rowsep="0">
26135 <colspec colwidth="8*" align="left"/>
26136 <colspec colwidth="6*" align="center"/>
26137 <colspec colwidth="6*" align="center"/>
26138 <colspec colwidth="6*" align="right"/>
26141 <entry><option>smtp_accept_max_per_host</option></entry>
26142 <entry>Use: <emphasis>main</emphasis></entry>
26143 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26144 <entry>Default: <emphasis>unset</emphasis></entry>
26150 <indexterm role="concept">
26151 <primary>limit</primary>
26152 <secondary>SMTP connections from one host</secondary>
26154 <indexterm role="concept">
26155 <primary>host</primary>
26156 <secondary>limiting SMTP connections from</secondary>
26158 This option restricts the number of simultaneous IP connections from a single
26159 host (strictly, from a single IP address) to the Exim daemon. The option is
26160 expanded, to enable different limits to be applied to different hosts by
26161 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
26162 connection attempts from the same host are rejected with error code 421. This
26163 is entirely independent of <option>smtp_accept_reserve</option>. The option’s default value
26164 of zero imposes no limit. If this option is set greater than zero, it is
26165 required that <option>smtp_accept_max</option> be non-zero.
26168 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
26169 constructions that take an appreciable amount of time. The expansion and test
26170 happen in the main daemon loop, in order to reject additional connections
26171 without forking additional processes (otherwise a denial-of-service attack
26172 could cause a vast number or processes to be created). While the daemon is
26173 doing this processing, it cannot accept any other incoming connections.
26176 <indexterm role="option">
26177 <primary><option>smtp_accept_queue</option></primary>
26180 <informaltable frame="all">
26181 <tgroup cols="4" colsep="0" rowsep="0">
26182 <colspec colwidth="8*" align="left"/>
26183 <colspec colwidth="6*" align="center"/>
26184 <colspec colwidth="6*" align="center"/>
26185 <colspec colwidth="6*" align="right"/>
26188 <entry><option>smtp_accept_queue</option></entry>
26189 <entry>Use: <emphasis>main</emphasis></entry>
26190 <entry>Type: <emphasis>integer</emphasis></entry>
26191 <entry>Default: <emphasis>0</emphasis></entry>
26197 <indexterm role="concept">
26198 <primary>SMTP</primary>
26199 <secondary>incoming connection count</secondary>
26201 <indexterm role="concept">
26202 <primary>queueing incoming messages</primary>
26204 <indexterm role="concept">
26205 <primary>message</primary>
26206 <secondary>queueing by SMTP connection count</secondary>
26208 If the number of simultaneous incoming SMTP connections being handled via the
26209 listening daemon exceeds this value, messages received by SMTP are just placed
26210 on the queue; no delivery processes are started automatically. The count is
26211 fixed at the start of an SMTP connection. It cannot be updated in the
26212 subprocess that receives messages, and so the queueing or not queueing applies
26213 to all messages received in the same connection.
26216 A value of zero implies no limit, and clearly any non-zero value is useful only
26217 if it is less than the <option>smtp_accept_max</option> value (unless that is zero). See
26218 also <option>queue_only</option>, <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the
26219 various <option>-od</option><emphasis>x</emphasis> command line options.
26222 <indexterm role="option">
26223 <primary><option>smtp_accept_queue_per_connection</option></primary>
26226 <informaltable frame="all">
26227 <tgroup cols="4" colsep="0" rowsep="0">
26228 <colspec colwidth="8*" align="left"/>
26229 <colspec colwidth="6*" align="center"/>
26230 <colspec colwidth="6*" align="center"/>
26231 <colspec colwidth="6*" align="right"/>
26234 <entry><option>smtp_accept_queue_per_ connection</option></entry>
26235 <entry>Use: <emphasis>main</emphasis></entry>
26236 <entry>Type: <emphasis>integer</emphasis></entry>
26237 <entry>Default: <emphasis>10</emphasis></entry>
26243 <indexterm role="concept">
26244 <primary>queueing incoming messages</primary>
26246 <indexterm role="concept">
26247 <primary>message</primary>
26248 <secondary>queueing by message count</secondary>
26250 This option limits the number of delivery processes that Exim starts
26251 automatically when receiving messages via SMTP, whether via the daemon or by
26252 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
26253 and the number of messages received in a single SMTP session exceeds this
26254 number, subsequent messages are placed on the queue, but no delivery processes
26255 are started. This helps to limit the number of Exim processes when a server
26256 restarts after downtime and there is a lot of mail waiting for it on other
26257 systems. On large systems, the default should probably be increased, and on
26258 dial-in client systems it should probably be set to zero (that is, disabled).
26261 <indexterm role="option">
26262 <primary><option>smtp_accept_reserve</option></primary>
26265 <informaltable frame="all">
26266 <tgroup cols="4" colsep="0" rowsep="0">
26267 <colspec colwidth="8*" align="left"/>
26268 <colspec colwidth="6*" align="center"/>
26269 <colspec colwidth="6*" align="center"/>
26270 <colspec colwidth="6*" align="right"/>
26273 <entry><option>smtp_accept_reserve</option></entry>
26274 <entry>Use: <emphasis>main</emphasis></entry>
26275 <entry>Type: <emphasis>integer</emphasis></entry>
26276 <entry>Default: <emphasis>0</emphasis></entry>
26282 <indexterm role="concept">
26283 <primary>SMTP</primary>
26284 <secondary>incoming call count</secondary>
26286 <indexterm role="concept">
26287 <primary>host</primary>
26288 <secondary>reserved</secondary>
26290 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
26291 number of SMTP connections that are reserved for connections from the hosts
26292 that are specified in <option>smtp_reserve_hosts</option>. The value set in
26293 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
26294 restricted to this number of connections; the option specifies a minimum number
26295 of connection slots for them, not a maximum. It is a guarantee that this group
26296 of hosts can always get at least <option>smtp_accept_reserve</option> connections. However,
26297 the limit specified by <option>smtp_accept_max_per_host</option> is still applied to each
26301 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
26302 set to 5, once there are 45 active connections (from any hosts), new
26303 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>,
26304 provided the other criteria for acceptance are met.
26307 <indexterm role="option">
26308 <primary><option>smtp_active_hostname</option></primary>
26311 <informaltable frame="all">
26312 <tgroup cols="4" colsep="0" rowsep="0">
26313 <colspec colwidth="8*" align="left"/>
26314 <colspec colwidth="6*" align="center"/>
26315 <colspec colwidth="6*" align="center"/>
26316 <colspec colwidth="6*" align="right"/>
26319 <entry><option>smtp_active_hostname</option></entry>
26320 <entry>Use: <emphasis>main</emphasis></entry>
26321 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26322 <entry>Default: <emphasis>unset</emphasis></entry>
26328 <indexterm role="concept">
26329 <primary>host</primary>
26330 <secondary>name in SMTP responses</secondary>
26332 <indexterm role="concept">
26333 <primary>SMTP</primary>
26334 <secondary>host name in responses</secondary>
26336 <indexterm role="variable">
26337 <primary><varname>$primary_hostname</varname></primary>
26339 This option is provided for multi-homed servers that want to masquerade as
26340 several different hosts. At the start of an incoming SMTP connection, its value
26341 is expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
26342 responses. For example, it is used as domain name in the response to an
26343 incoming HELO or EHLO command.
26346 <indexterm role="variable">
26347 <primary><varname>$smtp_active_hostname</varname></primary>
26349 The active hostname is placed in the <varname>$smtp_active_hostname</varname> variable, which
26350 is saved with any messages that are received. It is therefore available for use
26351 in routers and transports when the message is later delivered.
26354 If this option is unset, or if its expansion is forced to fail, or if the
26355 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
26356 used. Other expansion failures cause a message to be written to the main and
26357 panic logs, and the SMTP command receives a temporary error. Typically, the
26358 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
26361 <literallayout class="monospaced">
26362 smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\
26363 {cox.mydomain}{box.mydomain}}
26366 Although <varname>$smtp_active_hostname</varname> is primarily concerned with incoming
26367 messages, it is also used as the default for HELO commands in callout
26368 verification if there is no remote transport from which to obtain a
26369 <option>helo_data</option> value.
26372 <indexterm role="option">
26373 <primary><option>smtp_banner</option></primary>
26376 <informaltable frame="all">
26377 <tgroup cols="4" colsep="0" rowsep="0">
26378 <colspec colwidth="8*" align="left"/>
26379 <colspec colwidth="6*" align="center"/>
26380 <colspec colwidth="6*" align="center"/>
26381 <colspec colwidth="6*" align="right"/>
26384 <entry><option>smtp_banner</option></entry>
26385 <entry>Use: <emphasis>main</emphasis></entry>
26386 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26387 <entry>Default: <emphasis>see below</emphasis></entry>
26393 <indexterm role="concept">
26394 <primary>SMTP</primary>
26395 <secondary>welcome banner</secondary>
26397 <indexterm role="concept">
26398 <primary>banner for SMTP</primary>
26400 <indexterm role="concept">
26401 <primary>welcome banner for SMTP</primary>
26403 <indexterm role="concept">
26404 <primary>customizing</primary>
26405 <secondary>SMTP banner</secondary>
26407 This string, which is expanded every time it is used, is output as the initial
26408 positive response to an SMTP connection. The default setting is:
26410 <literallayout class="monospaced">
26411 smtp_banner = $smtp_active_hostname ESMTP Exim \
26412 $version_number $tod_full
26415 Failure to expand the string causes a panic error. If you want to create a
26416 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
26417 appropriate points, but not at the end. Note that the 220 code is not included
26418 in this string. Exim adds it automatically (several times in the case of a
26419 multiline response).
26422 <indexterm role="option">
26423 <primary><option>smtp_check_spool_space</option></primary>
26426 <informaltable frame="all">
26427 <tgroup cols="4" colsep="0" rowsep="0">
26428 <colspec colwidth="8*" align="left"/>
26429 <colspec colwidth="6*" align="center"/>
26430 <colspec colwidth="6*" align="center"/>
26431 <colspec colwidth="6*" align="right"/>
26434 <entry><option>smtp_check_spool_space</option></entry>
26435 <entry>Use: <emphasis>main</emphasis></entry>
26436 <entry>Type: <emphasis>boolean</emphasis></entry>
26437 <entry>Default: <emphasis>true</emphasis></entry>
26443 <indexterm role="concept">
26444 <primary>checking disk space</primary>
26446 <indexterm role="concept">
26447 <primary>disk space, checking</primary>
26449 <indexterm role="concept">
26450 <primary>spool directory</primary>
26451 <secondary>checking space</secondary>
26453 When this option is set, if an incoming SMTP session encounters the SIZE
26454 option on a MAIL command, it checks that there is enough space in the
26455 spool directory’s partition to accept a message of that size, while still
26456 leaving free the amount specified by <option>check_spool_space</option> (even if that value
26457 is zero). If there isn’t enough space, a temporary error code is returned.
26460 <indexterm role="option">
26461 <primary><option>smtp_connect_backlog</option></primary>
26464 <informaltable frame="all">
26465 <tgroup cols="4" colsep="0" rowsep="0">
26466 <colspec colwidth="8*" align="left"/>
26467 <colspec colwidth="6*" align="center"/>
26468 <colspec colwidth="6*" align="center"/>
26469 <colspec colwidth="6*" align="right"/>
26472 <entry><option>smtp_connect_backlog</option></entry>
26473 <entry>Use: <emphasis>main</emphasis></entry>
26474 <entry>Type: <emphasis>integer</emphasis></entry>
26475 <entry>Default: <emphasis>20</emphasis></entry>
26481 <indexterm role="concept">
26482 <primary>connection backlog</primary>
26484 <indexterm role="concept">
26485 <primary>SMTP</primary>
26486 <secondary>connection backlog</secondary>
26488 <indexterm role="concept">
26489 <primary>backlog of connections</primary>
26491 This option specifies a maximum number of waiting SMTP connections. Exim passes
26492 this value to the TCP/IP system when it sets up its listener. Once this number
26493 of connections are waiting for the daemon’s attention, subsequent connection
26494 attempts are refused at the TCP/IP level. At least, that is what the manuals
26495 say; in some circumstances such connection attempts have been observed to time
26496 out instead. For large systems it is probably a good idea to increase the
26497 value (to 50, say). It also gives some protection against denial-of-service
26498 attacks by SYN flooding.
26501 <indexterm role="option">
26502 <primary><option>smtp_enforce_sync</option></primary>
26505 <informaltable frame="all">
26506 <tgroup cols="4" colsep="0" rowsep="0">
26507 <colspec colwidth="8*" align="left"/>
26508 <colspec colwidth="6*" align="center"/>
26509 <colspec colwidth="6*" align="center"/>
26510 <colspec colwidth="6*" align="right"/>
26513 <entry><option>smtp_enforce_sync</option></entry>
26514 <entry>Use: <emphasis>main</emphasis></entry>
26515 <entry>Type: <emphasis>boolean</emphasis></entry>
26516 <entry>Default: <emphasis>true</emphasis></entry>
26522 <indexterm role="concept">
26523 <primary>SMTP</primary>
26524 <secondary>synchronization checking</secondary>
26526 <indexterm role="concept">
26527 <primary>synchronization checking in SMTP</primary>
26529 The SMTP protocol specification requires the client to wait for a response from
26530 the server at certain points in the dialogue. Without PIPELINING these
26531 synchronization points are after every command; with PIPELINING they are
26532 fewer, but they still exist.
26535 Some spamming sites send out a complete set of SMTP commands without waiting
26536 for any response. Exim protects against this by rejecting a message if the
26537 client has sent further input when it should not have. The error response <quote>554
26538 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
26539 for this error cannot be perfect because of transmission delays (unexpected
26540 input may be on its way but not yet received when Exim checks). However, it
26541 does detect many instances.
26544 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
26545 If you want to disable the check selectively (for example, only for certain
26546 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
26547 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
26550 <indexterm role="option">
26551 <primary><option>smtp_etrn_command</option></primary>
26554 <informaltable frame="all">
26555 <tgroup cols="4" colsep="0" rowsep="0">
26556 <colspec colwidth="8*" align="left"/>
26557 <colspec colwidth="6*" align="center"/>
26558 <colspec colwidth="6*" align="center"/>
26559 <colspec colwidth="6*" align="right"/>
26562 <entry><option>smtp_etrn_command</option></entry>
26563 <entry>Use: <emphasis>main</emphasis></entry>
26564 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26565 <entry>Default: <emphasis>unset</emphasis></entry>
26571 <indexterm role="concept">
26572 <primary>ETRN</primary>
26573 <secondary>command to be run</secondary>
26575 <indexterm role="variable">
26576 <primary><varname>$domain</varname></primary>
26578 If this option is set, the given command is run whenever an SMTP ETRN
26579 command is received from a host that is permitted to issue such commands (see
26580 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
26581 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
26582 argument of the ETRN command, and no syntax checking is done on it. For
26585 <literallayout class="monospaced">
26586 smtp_etrn_command = /etc/etrn_command $domain \
26587 $sender_host_address
26590 A new process is created to run the command, but Exim does not wait for it to
26591 complete. Consequently, its status cannot be checked. If the command cannot be
26592 run, a line is written to the panic log, but the ETRN caller still receives
26593 a 250 success response. Exim is normally running under its own uid when
26594 receiving SMTP, so it is not possible for it to change the uid before running
26598 <indexterm role="option">
26599 <primary><option>smtp_etrn_serialize</option></primary>
26602 <informaltable frame="all">
26603 <tgroup cols="4" colsep="0" rowsep="0">
26604 <colspec colwidth="8*" align="left"/>
26605 <colspec colwidth="6*" align="center"/>
26606 <colspec colwidth="6*" align="center"/>
26607 <colspec colwidth="6*" align="right"/>
26610 <entry><option>smtp_etrn_serialize</option></entry>
26611 <entry>Use: <emphasis>main</emphasis></entry>
26612 <entry>Type: <emphasis>boolean</emphasis></entry>
26613 <entry>Default: <emphasis>true</emphasis></entry>
26619 <indexterm role="concept">
26620 <primary>ETRN</primary>
26621 <secondary>serializing</secondary>
26623 When this option is set, it prevents the simultaneous execution of more than
26624 one identical command as a result of ETRN in an SMTP connection. See
26625 section <xref linkend="SECTETRN"/> for details.
26628 <indexterm role="option">
26629 <primary><option>smtp_load_reserve</option></primary>
26632 <informaltable frame="all">
26633 <tgroup cols="4" colsep="0" rowsep="0">
26634 <colspec colwidth="8*" align="left"/>
26635 <colspec colwidth="6*" align="center"/>
26636 <colspec colwidth="6*" align="center"/>
26637 <colspec colwidth="6*" align="right"/>
26640 <entry><option>smtp_load_reserve</option></entry>
26641 <entry>Use: <emphasis>main</emphasis></entry>
26642 <entry>Type: <emphasis>fixed-point</emphasis></entry>
26643 <entry>Default: <emphasis>unset</emphasis></entry>
26649 <indexterm role="concept">
26650 <primary>load average</primary>
26652 If the system load average ever gets higher than this, incoming SMTP calls are
26653 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
26654 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
26655 the load is over the limit. The option has no effect on ancient operating
26656 systems on which Exim cannot determine the load average. See also
26657 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
26660 <indexterm role="option">
26661 <primary><option>smtp_max_synprot_errors</option></primary>
26664 <informaltable frame="all">
26665 <tgroup cols="4" colsep="0" rowsep="0">
26666 <colspec colwidth="8*" align="left"/>
26667 <colspec colwidth="6*" align="center"/>
26668 <colspec colwidth="6*" align="center"/>
26669 <colspec colwidth="6*" align="right"/>
26672 <entry><option>smtp_max_synprot_errors</option></entry>
26673 <entry>Use: <emphasis>main</emphasis></entry>
26674 <entry>Type: <emphasis>integer</emphasis></entry>
26675 <entry>Default: <emphasis>3</emphasis></entry>
26681 <indexterm role="concept">
26682 <primary>SMTP</primary>
26683 <secondary>limiting syntax and protocol errors</secondary>
26685 <indexterm role="concept">
26686 <primary>limit</primary>
26687 <secondary>SMTP syntax and protocol errors</secondary>
26689 Exim rejects SMTP commands that contain syntax or protocol errors. In
26690 particular, a syntactically invalid email address, as in this command:
26692 <literallayout class="monospaced">
26693 RCPT TO:<abc xyz@a.b.c>
26696 causes immediate rejection of the command, before any other tests are done.
26697 (The ACL cannot be run if there is no valid address to set up for it.) An
26698 example of a protocol error is receiving RCPT before MAIL. If there are
26699 too many syntax or protocol errors in one SMTP session, the connection is
26700 dropped. The limit is set by this option.
26703 <indexterm role="concept">
26704 <primary>PIPELINING</primary>
26705 <secondary>expected errors</secondary>
26707 When the PIPELINING extension to SMTP is in use, some protocol errors are
26708 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
26709 Exim assumes that PIPELINING will be used if it advertises it (see
26710 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
26711 not count towards the limit.
26714 <indexterm role="option">
26715 <primary><option>smtp_max_unknown_commands</option></primary>
26718 <informaltable frame="all">
26719 <tgroup cols="4" colsep="0" rowsep="0">
26720 <colspec colwidth="8*" align="left"/>
26721 <colspec colwidth="6*" align="center"/>
26722 <colspec colwidth="6*" align="center"/>
26723 <colspec colwidth="6*" align="right"/>
26726 <entry><option>smtp_max_unknown_commands</option></entry>
26727 <entry>Use: <emphasis>main</emphasis></entry>
26728 <entry>Type: <emphasis>integer</emphasis></entry>
26729 <entry>Default: <emphasis>3</emphasis></entry>
26735 <indexterm role="concept">
26736 <primary>SMTP</primary>
26737 <secondary>limiting unknown commands</secondary>
26739 <indexterm role="concept">
26740 <primary>limit</primary>
26741 <secondary>unknown SMTP commands</secondary>
26743 If there are too many unrecognized commands in an incoming SMTP session, an
26744 Exim server drops the connection. This is a defence against some kinds of abuse
26747 into making connections to SMTP ports; in these circumstances, a number of
26748 non-SMTP command lines are sent first.
26751 <indexterm role="option">
26752 <primary><option>smtp_ratelimit_hosts</option></primary>
26755 <informaltable frame="all">
26756 <tgroup cols="4" colsep="0" rowsep="0">
26757 <colspec colwidth="8*" align="left"/>
26758 <colspec colwidth="6*" align="center"/>
26759 <colspec colwidth="6*" align="center"/>
26760 <colspec colwidth="6*" align="right"/>
26763 <entry><option>smtp_ratelimit_hosts</option></entry>
26764 <entry>Use: <emphasis>main</emphasis></entry>
26765 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
26766 <entry>Default: <emphasis>unset</emphasis></entry>
26772 <indexterm role="concept">
26773 <primary>SMTP</primary>
26774 <secondary>rate limiting</secondary>
26776 <indexterm role="concept">
26777 <primary>limit</primary>
26778 <secondary>rate of message arrival</secondary>
26780 <indexterm role="concept">
26781 <primary>RCPT</primary>
26782 <secondary>rate limiting</secondary>
26784 Some sites find it helpful to be able to limit the rate at which certain hosts
26785 can send them messages, and the rate at which an individual message can specify
26789 Exim has two rate-limiting facilities. This section describes the older
26790 facility, which can limit rates within a single connection. The newer
26791 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
26792 <xref linkend="SECTratelimiting"/> for details of the newer facility.
26795 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
26796 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
26797 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
26798 respectively. Each option, if set, must contain a set of four comma-separated
26804 A threshold, before which there is no rate limiting.
26809 An initial time delay. Unlike other times in Exim, numbers with decimal
26810 fractional parts are allowed here.
26815 A factor by which to increase the delay each time.
26820 A maximum value for the delay. This should normally be less than 5 minutes,
26821 because after that time, the client is liable to timeout the SMTP command.
26826 For example, these settings have been used successfully at the site which
26827 first suggested this feature, for controlling mail from their customers:
26829 <literallayout class="monospaced">
26830 smtp_ratelimit_mail = 2,0.5s,1.05,4m
26831 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
26834 The first setting specifies delays that are applied to MAIL commands after
26835 two have been received over a single connection. The initial delay is 0.5
26836 seconds, increasing by a factor of 1.05 each time. The second setting applies
26837 delays to RCPT commands when more than four occur in a single message.
26840 <indexterm role="option">
26841 <primary><option>smtp_ratelimit_mail</option></primary>
26844 <informaltable frame="all">
26845 <tgroup cols="4" colsep="0" rowsep="0">
26846 <colspec colwidth="8*" align="left"/>
26847 <colspec colwidth="6*" align="center"/>
26848 <colspec colwidth="6*" align="center"/>
26849 <colspec colwidth="6*" align="right"/>
26852 <entry><option>smtp_ratelimit_mail</option></entry>
26853 <entry>Use: <emphasis>main</emphasis></entry>
26854 <entry>Type: <emphasis>string</emphasis></entry>
26855 <entry>Default: <emphasis>unset</emphasis></entry>
26861 See <option>smtp_ratelimit_hosts</option> above.
26864 <indexterm role="option">
26865 <primary><option>smtp_ratelimit_rcpt</option></primary>
26868 <informaltable frame="all">
26869 <tgroup cols="4" colsep="0" rowsep="0">
26870 <colspec colwidth="8*" align="left"/>
26871 <colspec colwidth="6*" align="center"/>
26872 <colspec colwidth="6*" align="center"/>
26873 <colspec colwidth="6*" align="right"/>
26876 <entry><option>smtp_ratelimit_rcpt</option></entry>
26877 <entry>Use: <emphasis>main</emphasis></entry>
26878 <entry>Type: <emphasis>string</emphasis></entry>
26879 <entry>Default: <emphasis>unset</emphasis></entry>
26885 See <option>smtp_ratelimit_hosts</option> above.
26888 <indexterm role="option">
26889 <primary><option>smtp_receive_timeout</option></primary>
26892 <informaltable frame="all">
26893 <tgroup cols="4" colsep="0" rowsep="0">
26894 <colspec colwidth="8*" align="left"/>
26895 <colspec colwidth="6*" align="center"/>
26896 <colspec colwidth="6*" align="center"/>
26897 <colspec colwidth="6*" align="right"/>
26900 <entry><option>smtp_receive_timeout</option></entry>
26901 <entry>Use: <emphasis>main</emphasis></entry>
26902 <entry>Type: <emphasis>time</emphasis></entry>
26903 <entry>Default: <emphasis>5m</emphasis></entry>
26909 <indexterm role="concept">
26910 <primary>timeout</primary>
26911 <secondary>for SMTP input</secondary>
26913 <indexterm role="concept">
26914 <primary>SMTP</primary>
26915 <secondary>input timeout</secondary>
26917 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
26918 input, including batch SMTP. If a line of input (either an SMTP command or a
26919 data line) is not received within this time, the SMTP connection is dropped and
26920 the message is abandoned.
26921 A line is written to the log containing one of the following messages:
26923 <literallayout class="monospaced">
26924 SMTP command timeout on connection from...
26925 SMTP data timeout on connection from...
26928 The former means that Exim was expecting to read an SMTP command; the latter
26929 means that it was in the DATA phase, reading the contents of a message.
26932 <indexterm role="option">
26933 <primary><option>-os</option></primary>
26935 The value set by this option can be overridden by the
26936 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
26937 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
26938 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
26939 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
26942 <indexterm role="option">
26943 <primary><option>smtp_reserve_hosts</option></primary>
26946 <informaltable frame="all">
26947 <tgroup cols="4" colsep="0" rowsep="0">
26948 <colspec colwidth="8*" align="left"/>
26949 <colspec colwidth="6*" align="center"/>
26950 <colspec colwidth="6*" align="center"/>
26951 <colspec colwidth="6*" align="right"/>
26954 <entry><option>smtp_reserve_hosts</option></entry>
26955 <entry>Use: <emphasis>main</emphasis></entry>
26956 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
26957 <entry>Default: <emphasis>unset</emphasis></entry>
26963 This option defines hosts for which SMTP connections are reserved; see
26964 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
26967 <indexterm role="option">
26968 <primary><option>smtp_return_error_details</option></primary>
26971 <informaltable frame="all">
26972 <tgroup cols="4" colsep="0" rowsep="0">
26973 <colspec colwidth="8*" align="left"/>
26974 <colspec colwidth="6*" align="center"/>
26975 <colspec colwidth="6*" align="center"/>
26976 <colspec colwidth="6*" align="right"/>
26979 <entry><option>smtp_return_error_details</option></entry>
26980 <entry>Use: <emphasis>main</emphasis></entry>
26981 <entry>Type: <emphasis>boolean</emphasis></entry>
26982 <entry>Default: <emphasis>false</emphasis></entry>
26988 <indexterm role="concept">
26989 <primary>SMTP</primary>
26990 <secondary>details policy failures</secondary>
26992 <indexterm role="concept">
26993 <primary>policy control</primary>
26994 <secondary>rejection, returning details</secondary>
26996 In the default state, Exim uses bland messages such as
26997 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
26998 reasons. Many sysadmins like this because it gives away little information
26999 to spammers. However, some other sysadmins who are applying strict checking
27000 policies want to give out much fuller information about failures. Setting
27001 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
27002 example, instead of <quote>Administrative prohibition</quote>, it might give:
27004 <literallayout class="monospaced">
27005 550-Rejected after DATA: '>' missing at end of address:
27006 550 failing address in "From" header is: <user@dom.ain
27009 <indexterm role="option">
27010 <primary><option>spamd_address</option></primary>
27013 <informaltable frame="all">
27014 <tgroup cols="4" colsep="0" rowsep="0">
27015 <colspec colwidth="8*" align="left"/>
27016 <colspec colwidth="6*" align="center"/>
27017 <colspec colwidth="6*" align="center"/>
27018 <colspec colwidth="6*" align="right"/>
27021 <entry><option>spamd_address</option></entry>
27022 <entry>Use: <emphasis>main</emphasis></entry>
27023 <entry>Type: <emphasis>string</emphasis></entry>
27024 <entry>Default: <emphasis>see below</emphasis></entry>
27030 This option is available when Exim is compiled with the content-scanning
27031 extension. It specifies how Exim connects to SpamAssassin’s <option>spamd</option> daemon.
27032 The default value is
27034 <literallayout class="monospaced">
27038 See section <xref linkend="SECTscanspamass"/> for more details.
27041 <indexterm role="option">
27042 <primary><option>split_spool_directory</option></primary>
27045 <informaltable frame="all">
27046 <tgroup cols="4" colsep="0" rowsep="0">
27047 <colspec colwidth="8*" align="left"/>
27048 <colspec colwidth="6*" align="center"/>
27049 <colspec colwidth="6*" align="center"/>
27050 <colspec colwidth="6*" align="right"/>
27053 <entry><option>split_spool_directory</option></entry>
27054 <entry>Use: <emphasis>main</emphasis></entry>
27055 <entry>Type: <emphasis>boolean</emphasis></entry>
27056 <entry>Default: <emphasis>false</emphasis></entry>
27062 <indexterm role="concept">
27063 <primary>multiple spool directories</primary>
27065 <indexterm role="concept">
27066 <primary>spool directory</primary>
27067 <secondary>split</secondary>
27069 <indexterm role="concept">
27070 <primary>directories, multiple</primary>
27072 If this option is set, it causes Exim to split its input directory into 62
27073 subdirectories, each with a single alphanumeric character as its name. The
27074 sixth character of the message id is used to allocate messages to
27075 subdirectories; this is the least significant base-62 digit of the time of
27076 arrival of the message.
27079 Splitting up the spool in this way may provide better performance on systems
27080 where there are long mail queues, by reducing the number of files in any one
27081 directory. The msglog directory is also split up in a similar way to the input
27082 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
27083 are still placed in the single directory <filename>msglog.OLD</filename>.
27086 It is not necessary to take any special action for existing messages when
27087 changing <option>split_spool_directory</option>. Exim notices messages that are in the
27088 <quote>wrong</quote> place, and continues to process them. If the option is turned off
27089 after a period of being on, the subdirectories will eventually empty and be
27090 automatically deleted.
27093 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
27094 changes. Instead of creating a list of all messages in the queue, and then
27095 trying to deliver each one in turn, it constructs a list of those in one
27096 sub-directory and tries to deliver them, before moving on to the next
27097 sub-directory. The sub-directories are processed in a random order. This
27098 spreads out the scanning of the input directories, and uses less memory. It is
27099 particularly beneficial when there are lots of messages on the queue. However,
27100 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
27101 entire queue has to be scanned and sorted before any deliveries can start.
27104 <indexterm role="option">
27105 <primary><option>spool_directory</option></primary>
27108 <informaltable frame="all">
27109 <tgroup cols="4" colsep="0" rowsep="0">
27110 <colspec colwidth="8*" align="left"/>
27111 <colspec colwidth="6*" align="center"/>
27112 <colspec colwidth="6*" align="center"/>
27113 <colspec colwidth="6*" align="right"/>
27116 <entry><option>spool_directory</option></entry>
27117 <entry>Use: <emphasis>main</emphasis></entry>
27118 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27119 <entry>Default: <emphasis>set at compile time</emphasis></entry>
27125 <indexterm role="concept">
27126 <primary>spool directory</primary>
27127 <secondary>path to</secondary>
27129 This defines the directory in which Exim keeps its spool, that is, the messages
27130 it is waiting to deliver. The default value is taken from the compile-time
27131 configuration setting, if there is one. If not, this option must be set. The
27132 string is expanded, so it can contain, for example, a reference to
27133 <varname>$primary_hostname</varname>.
27136 If the spool directory name is fixed on your installation, it is recommended
27137 that you set it at build time rather than from this option, particularly if the
27138 log files are being written to the spool directory (see <option>log_file_path</option>).
27139 Otherwise log files cannot be used for errors that are detected early on, such
27140 as failures in the configuration file.
27143 By using this option to override the compiled-in path, it is possible to run
27144 tests of Exim without using the standard spool.
27147 <indexterm role="option">
27148 <primary><option>sqlite_lock_timeout</option></primary>
27151 <informaltable frame="all">
27152 <tgroup cols="4" colsep="0" rowsep="0">
27153 <colspec colwidth="8*" align="left"/>
27154 <colspec colwidth="6*" align="center"/>
27155 <colspec colwidth="6*" align="center"/>
27156 <colspec colwidth="6*" align="right"/>
27159 <entry><option>sqlite_lock_timeout</option></entry>
27160 <entry>Use: <emphasis>main</emphasis></entry>
27161 <entry>Type: <emphasis>time</emphasis></entry>
27162 <entry>Default: <emphasis>5s</emphasis></entry>
27168 <indexterm role="concept">
27169 <primary>sqlite lookup type</primary>
27170 <secondary>lock timeout</secondary>
27172 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
27173 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
27176 <indexterm role="option">
27177 <primary><option>strict_acl_vars</option></primary>
27180 <informaltable frame="all">
27181 <tgroup cols="4" colsep="0" rowsep="0">
27182 <colspec colwidth="8*" align="left"/>
27183 <colspec colwidth="6*" align="center"/>
27184 <colspec colwidth="6*" align="center"/>
27185 <colspec colwidth="6*" align="right"/>
27188 <entry><option>strict_acl_vars</option></entry>
27189 <entry>Use: <emphasis>main</emphasis></entry>
27190 <entry>Type: <emphasis>boolean</emphasis></entry>
27191 <entry>Default: <emphasis>false</emphasis></entry>
27197 <indexterm role="concept">
27198 <primary>access control lists (ACLs)</primary>
27199 <secondary>variables, handling unset</secondary>
27201 This option controls what happens if a syntactically valid but undefined ACL
27202 variable is referenced. If it is false (the default), an empty string
27203 is substituted; if it is true, an error is generated. See section
27204 <xref linkend="SECTaclvariables"/> for details of ACL variables.
27207 <indexterm role="option">
27208 <primary><option>strip_excess_angle_brackets</option></primary>
27211 <informaltable frame="all">
27212 <tgroup cols="4" colsep="0" rowsep="0">
27213 <colspec colwidth="8*" align="left"/>
27214 <colspec colwidth="6*" align="center"/>
27215 <colspec colwidth="6*" align="center"/>
27216 <colspec colwidth="6*" align="right"/>
27219 <entry><option>strip_excess_angle_brackets</option></entry>
27220 <entry>Use: <emphasis>main</emphasis></entry>
27221 <entry>Type: <emphasis>boolean</emphasis></entry>
27222 <entry>Default: <emphasis>false</emphasis></entry>
27228 <indexterm role="concept">
27229 <primary>angle brackets, excess</primary>
27231 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
27232 items in addresses are stripped. For example, <emphasis><<xxx@a.b.c.d>></emphasis> is
27233 treated as <emphasis><xxx@a.b.c.d></emphasis>. If this is in the envelope and the message is
27234 passed on to another MTA, the excess angle brackets are not passed on. If this
27235 option is not set, multiple pairs of angle brackets cause a syntax error.
27238 <indexterm role="option">
27239 <primary><option>strip_trailing_dot</option></primary>
27242 <informaltable frame="all">
27243 <tgroup cols="4" colsep="0" rowsep="0">
27244 <colspec colwidth="8*" align="left"/>
27245 <colspec colwidth="6*" align="center"/>
27246 <colspec colwidth="6*" align="center"/>
27247 <colspec colwidth="6*" align="right"/>
27250 <entry><option>strip_trailing_dot</option></entry>
27251 <entry>Use: <emphasis>main</emphasis></entry>
27252 <entry>Type: <emphasis>boolean</emphasis></entry>
27253 <entry>Default: <emphasis>false</emphasis></entry>
27259 <indexterm role="concept">
27260 <primary>trailing dot on domain</primary>
27262 <indexterm role="concept">
27263 <primary>dot</primary>
27264 <secondary>trailing on domain</secondary>
27266 If this option is set, a trailing dot at the end of a domain in an address is
27267 ignored. If this is in the envelope and the message is passed on to another
27268 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
27269 domain causes a syntax error.
27270 However, addresses in header lines are checked only when an ACL requests header
27274 <indexterm role="option">
27275 <primary><option>syslog_duplication</option></primary>
27278 <informaltable frame="all">
27279 <tgroup cols="4" colsep="0" rowsep="0">
27280 <colspec colwidth="8*" align="left"/>
27281 <colspec colwidth="6*" align="center"/>
27282 <colspec colwidth="6*" align="center"/>
27283 <colspec colwidth="6*" align="right"/>
27286 <entry><option>syslog_duplication</option></entry>
27287 <entry>Use: <emphasis>main</emphasis></entry>
27288 <entry>Type: <emphasis>boolean</emphasis></entry>
27289 <entry>Default: <emphasis>true</emphasis></entry>
27295 <indexterm role="concept">
27296 <primary>syslog</primary>
27297 <secondary>duplicate log lines; suppressing</secondary>
27299 When Exim is logging to syslog, it writes the log lines for its three
27300 separate logs at different syslog priorities so that they can in principle
27301 be separated on the logging hosts. Some installations do not require this
27302 separation, and in those cases, the duplication of certain log lines is a
27303 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
27304 particular log line is written to syslog. For lines that normally go to
27305 both the main log and the reject log, the reject log version (possibly
27306 containing message header lines) is written, at LOG_NOTICE priority.
27307 Lines that normally go to both the main and the panic log are written at
27308 the LOG_ALERT priority.
27311 <indexterm role="option">
27312 <primary><option>syslog_facility</option></primary>
27315 <informaltable frame="all">
27316 <tgroup cols="4" colsep="0" rowsep="0">
27317 <colspec colwidth="8*" align="left"/>
27318 <colspec colwidth="6*" align="center"/>
27319 <colspec colwidth="6*" align="center"/>
27320 <colspec colwidth="6*" align="right"/>
27323 <entry><option>syslog_facility</option></entry>
27324 <entry>Use: <emphasis>main</emphasis></entry>
27325 <entry>Type: <emphasis>string</emphasis></entry>
27326 <entry>Default: <emphasis>unset</emphasis></entry>
27332 <indexterm role="concept">
27333 <primary>syslog</primary>
27334 <secondary>facility; setting</secondary>
27336 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
27337 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
27338 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
27339 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
27340 details of Exim’s logging.
27343 <indexterm role="option">
27344 <primary><option>syslog_processname</option></primary>
27347 <informaltable frame="all">
27348 <tgroup cols="4" colsep="0" rowsep="0">
27349 <colspec colwidth="8*" align="left"/>
27350 <colspec colwidth="6*" align="center"/>
27351 <colspec colwidth="6*" align="center"/>
27352 <colspec colwidth="6*" align="right"/>
27355 <entry><option>syslog_processname</option></entry>
27356 <entry>Use: <emphasis>main</emphasis></entry>
27357 <entry>Type: <emphasis>string</emphasis></entry>
27358 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
27364 <indexterm role="concept">
27365 <primary>syslog</primary>
27366 <secondary>process name; setting</secondary>
27368 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
27369 syslog. The value must be no longer than 32 characters. See chapter
27370 <xref linkend="CHAPlog"/> for details of Exim’s logging.
27373 <indexterm role="option">
27374 <primary><option>syslog_timestamp</option></primary>
27377 <informaltable frame="all">
27378 <tgroup cols="4" colsep="0" rowsep="0">
27379 <colspec colwidth="8*" align="left"/>
27380 <colspec colwidth="6*" align="center"/>
27381 <colspec colwidth="6*" align="center"/>
27382 <colspec colwidth="6*" align="right"/>
27385 <entry><option>syslog_timestamp</option></entry>
27386 <entry>Use: <emphasis>main</emphasis></entry>
27387 <entry>Type: <emphasis>boolean</emphasis></entry>
27388 <entry>Default: <emphasis>true</emphasis></entry>
27394 <indexterm role="concept">
27395 <primary>syslog</primary>
27396 <secondary>timestamps</secondary>
27398 If <option>syslog_timestamp</option> is set false, the timestamps on Exim’s log lines are
27399 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
27400 details of Exim’s logging.
27403 <indexterm role="option">
27404 <primary><option>system_filter</option></primary>
27407 <informaltable frame="all">
27408 <tgroup cols="4" colsep="0" rowsep="0">
27409 <colspec colwidth="8*" align="left"/>
27410 <colspec colwidth="6*" align="center"/>
27411 <colspec colwidth="6*" align="center"/>
27412 <colspec colwidth="6*" align="right"/>
27415 <entry><option>system_filter</option></entry>
27416 <entry>Use: <emphasis>main</emphasis></entry>
27417 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27418 <entry>Default: <emphasis>unset</emphasis></entry>
27424 <indexterm role="concept">
27425 <primary>filter</primary>
27426 <secondary>system filter</secondary>
27428 <indexterm role="concept">
27429 <primary>system filter</primary>
27430 <secondary>specifying</secondary>
27432 <indexterm role="concept">
27433 <primary>Sieve filter</primary>
27434 <secondary>not available for system filter</secondary>
27436 This option specifies an Exim filter file that is applied to all messages at
27437 the start of each delivery attempt, before any routing is done. System filters
27438 must be Exim filters; they cannot be Sieve filters. If the system filter
27439 generates any deliveries to files or pipes, or any new mail messages, the
27440 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
27441 which transports are to be used. Details of this facility are given in chapter
27442 <xref linkend="CHAPsystemfilter"/>.
27445 <indexterm role="option">
27446 <primary><option>system_filter_directory_transport</option></primary>
27449 <informaltable frame="all">
27450 <tgroup cols="4" colsep="0" rowsep="0">
27451 <colspec colwidth="8*" align="left"/>
27452 <colspec colwidth="6*" align="center"/>
27453 <colspec colwidth="6*" align="center"/>
27454 <colspec colwidth="6*" align="right"/>
27457 <entry><option>system_filter_directory_transport</option></entry>
27458 <entry>Use: <emphasis>main</emphasis></entry>
27459 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27460 <entry>Default: <emphasis>unset</emphasis></entry>
27466 <indexterm role="variable">
27467 <primary><varname>$address_file</varname></primary>
27469 This sets the name of the transport driver that is to be used when the
27470 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
27471 implying delivery of each message into a separate file in some directory.
27472 During the delivery, the variable <varname>$address_file</varname> contains the path name.
27475 <indexterm role="option">
27476 <primary><option>system_filter_file_transport</option></primary>
27479 <informaltable frame="all">
27480 <tgroup cols="4" colsep="0" rowsep="0">
27481 <colspec colwidth="8*" align="left"/>
27482 <colspec colwidth="6*" align="center"/>
27483 <colspec colwidth="6*" align="center"/>
27484 <colspec colwidth="6*" align="right"/>
27487 <entry><option>system_filter_file_transport</option></entry>
27488 <entry>Use: <emphasis>main</emphasis></entry>
27489 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27490 <entry>Default: <emphasis>unset</emphasis></entry>
27496 <indexterm role="concept">
27497 <primary>file</primary>
27498 <secondary>transport for system filter</secondary>
27500 This sets the name of the transport driver that is to be used when the <option>save</option>
27501 command in a system message filter specifies a path not ending in <quote>/</quote>. During
27502 the delivery, the variable <varname>$address_file</varname> contains the path name.
27505 <indexterm role="option">
27506 <primary><option>system_filter_group</option></primary>
27509 <informaltable frame="all">
27510 <tgroup cols="4" colsep="0" rowsep="0">
27511 <colspec colwidth="8*" align="left"/>
27512 <colspec colwidth="6*" align="center"/>
27513 <colspec colwidth="6*" align="center"/>
27514 <colspec colwidth="6*" align="right"/>
27517 <entry><option>system_filter_group</option></entry>
27518 <entry>Use: <emphasis>main</emphasis></entry>
27519 <entry>Type: <emphasis>string</emphasis></entry>
27520 <entry>Default: <emphasis>unset</emphasis></entry>
27526 <indexterm role="concept">
27527 <primary>gid (group id)</primary>
27528 <secondary>system filter</secondary>
27530 This option is used only when <option>system_filter_user</option> is also set. It sets the
27531 gid under which the system filter is run, overriding any gid that is associated
27532 with the user. The value may be numerical or symbolic.
27535 <indexterm role="option">
27536 <primary><option>system_filter_pipe_transport</option></primary>
27539 <informaltable frame="all">
27540 <tgroup cols="4" colsep="0" rowsep="0">
27541 <colspec colwidth="8*" align="left"/>
27542 <colspec colwidth="6*" align="center"/>
27543 <colspec colwidth="6*" align="center"/>
27544 <colspec colwidth="6*" align="right"/>
27547 <entry><option>system_filter_pipe_transport</option></entry>
27548 <entry>Use: <emphasis>main</emphasis></entry>
27549 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27550 <entry>Default: <emphasis>unset</emphasis></entry>
27556 <indexterm role="concept">
27557 <primary><command>pipe</command> transport</primary>
27558 <secondary>for system filter</secondary>
27560 <indexterm role="variable">
27561 <primary><varname>$address_pipe</varname></primary>
27563 This specifies the transport driver that is to be used when a <option>pipe</option> command
27564 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
27565 contains the pipe command.
27568 <indexterm role="option">
27569 <primary><option>system_filter_reply_transport</option></primary>
27572 <informaltable frame="all">
27573 <tgroup cols="4" colsep="0" rowsep="0">
27574 <colspec colwidth="8*" align="left"/>
27575 <colspec colwidth="6*" align="center"/>
27576 <colspec colwidth="6*" align="center"/>
27577 <colspec colwidth="6*" align="right"/>
27580 <entry><option>system_filter_reply_transport</option></entry>
27581 <entry>Use: <emphasis>main</emphasis></entry>
27582 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27583 <entry>Default: <emphasis>unset</emphasis></entry>
27589 <indexterm role="concept">
27590 <primary><command>autoreply</command> transport</primary>
27591 <secondary>for system filter</secondary>
27593 This specifies the transport driver that is to be used when a <option>mail</option> command
27594 is used in a system filter.
27597 <indexterm role="option">
27598 <primary><option>system_filter_user</option></primary>
27601 <informaltable frame="all">
27602 <tgroup cols="4" colsep="0" rowsep="0">
27603 <colspec colwidth="8*" align="left"/>
27604 <colspec colwidth="6*" align="center"/>
27605 <colspec colwidth="6*" align="center"/>
27606 <colspec colwidth="6*" align="right"/>
27609 <entry><option>system_filter_user</option></entry>
27610 <entry>Use: <emphasis>main</emphasis></entry>
27611 <entry>Type: <emphasis>string</emphasis></entry>
27612 <entry>Default: <emphasis>unset</emphasis></entry>
27618 <indexterm role="concept">
27619 <primary>uid (user id)</primary>
27620 <secondary>system filter</secondary>
27622 If this option is not set, the system filter is run in the main Exim delivery
27623 process, as root. When the option is set, the system filter runs in a separate
27624 process, as the given user. Unless the string consists entirely of digits, it
27625 is looked up in the password data. Failure to find the named user causes a
27626 configuration error. The gid is either taken from the password data, or
27627 specified by <option>system_filter_group</option>. When the uid is specified numerically,
27628 <option>system_filter_group</option> is required to be set.
27631 If the system filter generates any pipe, file, or reply deliveries, the uid
27632 under which the filter is run is used when transporting them, unless a
27633 transport option overrides. Normally you should set <option>system_filter_user</option> if
27634 your system filter generates these kinds of delivery.
27637 <indexterm role="option">
27638 <primary><option>tcp_nodelay</option></primary>
27641 <informaltable frame="all">
27642 <tgroup cols="4" colsep="0" rowsep="0">
27643 <colspec colwidth="8*" align="left"/>
27644 <colspec colwidth="6*" align="center"/>
27645 <colspec colwidth="6*" align="center"/>
27646 <colspec colwidth="6*" align="right"/>
27649 <entry><option>tcp_nodelay</option></entry>
27650 <entry>Use: <emphasis>main</emphasis></entry>
27651 <entry>Type: <emphasis>boolean</emphasis></entry>
27652 <entry>Default: <emphasis>true</emphasis></entry>
27658 <indexterm role="concept">
27659 <primary>daemon</primary>
27660 <secondary>TCP_NODELAY on sockets</secondary>
27662 <indexterm role="concept">
27663 <primary>Nagle algorithm</primary>
27665 <indexterm role="concept">
27666 <primary>TCP_NODELAY on listening sockets</primary>
27668 If this option is set false, it stops the Exim daemon setting the
27669 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
27670 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
27671 performance in interactive (character-by-character) situations. Turning it off
27672 should improve Exim’s performance a bit, so that is what happens by default.
27673 However, it appears that some broken clients cannot cope, and time out. Hence
27674 this option. It affects only those sockets that are set up for listening by the
27675 daemon. Sockets created by the smtp transport for delivering mail always set
27679 <indexterm role="option">
27680 <primary><option>timeout_frozen_after</option></primary>
27683 <informaltable frame="all">
27684 <tgroup cols="4" colsep="0" rowsep="0">
27685 <colspec colwidth="8*" align="left"/>
27686 <colspec colwidth="6*" align="center"/>
27687 <colspec colwidth="6*" align="center"/>
27688 <colspec colwidth="6*" align="right"/>
27691 <entry><option>timeout_frozen_after</option></entry>
27692 <entry>Use: <emphasis>main</emphasis></entry>
27693 <entry>Type: <emphasis>time</emphasis></entry>
27694 <entry>Default: <emphasis>0s</emphasis></entry>
27700 <indexterm role="concept">
27701 <primary>frozen messages</primary>
27702 <secondary>timing out</secondary>
27704 <indexterm role="concept">
27705 <primary>timeout</primary>
27706 <secondary>frozen messages</secondary>
27708 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
27709 message of any kind that has been on the queue for longer than the given time
27710 is automatically cancelled at the next queue run. If the frozen message is a
27711 bounce message, it is just discarded; otherwise, a bounce is sent to the
27712 sender, in a similar manner to cancellation by the <option>-Mg</option> command line option.
27713 If you want to timeout frozen bounce messages earlier than other kinds of
27714 frozen message, see <option>ignore_bounce_errors_after</option>.
27717 <emphasis role="bold">Note:</emphasis> the default value of zero means no timeouts; with this setting,
27718 frozen messages remain on the queue forever (except for any frozen bounce
27719 messages that are released by <option>ignore_bounce_errors_after</option>).
27722 <indexterm role="option">
27723 <primary><option>timezone</option></primary>
27726 <informaltable frame="all">
27727 <tgroup cols="4" colsep="0" rowsep="0">
27728 <colspec colwidth="8*" align="left"/>
27729 <colspec colwidth="6*" align="center"/>
27730 <colspec colwidth="6*" align="center"/>
27731 <colspec colwidth="6*" align="right"/>
27734 <entry><option>timezone</option></entry>
27735 <entry>Use: <emphasis>main</emphasis></entry>
27736 <entry>Type: <emphasis>string</emphasis></entry>
27737 <entry>Default: <emphasis>unset</emphasis></entry>
27743 <indexterm role="concept">
27744 <primary>timezone, setting</primary>
27746 The value of <option>timezone</option> is used to set the environment variable TZ while
27747 running Exim (if it is different on entry). This ensures that all timestamps
27748 created by Exim are in the required timezone. If you want all your timestamps
27749 to be in UTC (aka GMT) you should set
27751 <literallayout class="monospaced">
27755 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
27756 or, if that is not set, from the value of the TZ environment variable when Exim
27757 is built. If <option>timezone</option> is set to the empty string, either at build or run
27758 time, any existing TZ variable is removed from the environment when Exim
27759 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
27760 unfortunately not all, operating systems.
27763 <indexterm role="option">
27764 <primary><option>tls_advertise_hosts</option></primary>
27767 <informaltable frame="all">
27768 <tgroup cols="4" colsep="0" rowsep="0">
27769 <colspec colwidth="8*" align="left"/>
27770 <colspec colwidth="6*" align="center"/>
27771 <colspec colwidth="6*" align="center"/>
27772 <colspec colwidth="6*" align="right"/>
27775 <entry><option>tls_advertise_hosts</option></entry>
27776 <entry>Use: <emphasis>main</emphasis></entry>
27777 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
27778 <entry>Default: <emphasis>unset</emphasis></entry>
27784 <indexterm role="concept">
27785 <primary>TLS</primary>
27786 <secondary>advertising</secondary>
27788 <indexterm role="concept">
27789 <primary>encryption</primary>
27790 <secondary>on SMTP connection</secondary>
27792 <indexterm role="concept">
27793 <primary>SMTP</primary>
27794 <secondary>encrypted connection</secondary>
27796 When Exim is built with support for TLS encrypted connections, the availability
27797 of the STARTTLS command to set up an encrypted session is advertised in
27798 response to EHLO only to those client hosts that match this option. See
27799 chapter <xref linkend="CHAPTLS"/> for details of Exim’s support for TLS.
27802 <indexterm role="option">
27803 <primary><option>tls_certificate</option></primary>
27806 <informaltable frame="all">
27807 <tgroup cols="4" colsep="0" rowsep="0">
27808 <colspec colwidth="8*" align="left"/>
27809 <colspec colwidth="6*" align="center"/>
27810 <colspec colwidth="6*" align="center"/>
27811 <colspec colwidth="6*" align="right"/>
27814 <entry><option>tls_certificate</option></entry>
27815 <entry>Use: <emphasis>main</emphasis></entry>
27816 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27817 <entry>Default: <emphasis>unset</emphasis></entry>
27823 <indexterm role="concept">
27824 <primary>TLS</primary>
27825 <secondary>server certificate; location of</secondary>
27827 <indexterm role="concept">
27828 <primary>certificate</primary>
27829 <secondary>server, location of</secondary>
27831 The value of this option is expanded, and must then be the absolute path to a
27832 file which contains the server’s certificates. The server’s private key is also
27833 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
27834 <xref linkend="CHAPTLS"/> for further details.
27837 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
27838 receiving incoming messages as a server. If you want to supply certificates for
27839 use when sending messages as a client, you must set the <option>tls_certificate</option>
27840 option in the relevant <command>smtp</command> transport.
27843 <indexterm role="option">
27844 <primary><option>tls_crl</option></primary>
27847 <informaltable frame="all">
27848 <tgroup cols="4" colsep="0" rowsep="0">
27849 <colspec colwidth="8*" align="left"/>
27850 <colspec colwidth="6*" align="center"/>
27851 <colspec colwidth="6*" align="center"/>
27852 <colspec colwidth="6*" align="right"/>
27855 <entry><option>tls_crl</option></entry>
27856 <entry>Use: <emphasis>main</emphasis></entry>
27857 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27858 <entry>Default: <emphasis>unset</emphasis></entry>
27864 <indexterm role="concept">
27865 <primary>TLS</primary>
27866 <secondary>server certificate revocation list</secondary>
27868 <indexterm role="concept">
27869 <primary>certificate</primary>
27870 <secondary>revocation list for server</secondary>
27872 This option specifies a certificate revocation list. The expanded value must
27873 be the name of a file that contains a CRL in PEM format.
27876 <indexterm role="option">
27877 <primary><option>tls_dhparam</option></primary>
27880 <informaltable frame="all">
27881 <tgroup cols="4" colsep="0" rowsep="0">
27882 <colspec colwidth="8*" align="left"/>
27883 <colspec colwidth="6*" align="center"/>
27884 <colspec colwidth="6*" align="center"/>
27885 <colspec colwidth="6*" align="right"/>
27888 <entry><option>tls_dhparam</option></entry>
27889 <entry>Use: <emphasis>main</emphasis></entry>
27890 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27891 <entry>Default: <emphasis>unset</emphasis></entry>
27897 <indexterm role="concept">
27898 <primary>TLS</primary>
27899 <secondary>D-H parameters for server</secondary>
27901 The value of this option is expanded, and must then be the absolute path to
27902 a file which contains the server’s DH parameter values.
27903 This is used only for OpenSSL. When Exim is linked with GnuTLS, this option is
27904 ignored. See section <xref linkend="SECTopenvsgnu"/> for further details.
27907 <indexterm role="option">
27908 <primary><option>tls_on_connect_ports</option></primary>
27911 <informaltable frame="all">
27912 <tgroup cols="4" colsep="0" rowsep="0">
27913 <colspec colwidth="8*" align="left"/>
27914 <colspec colwidth="6*" align="center"/>
27915 <colspec colwidth="6*" align="center"/>
27916 <colspec colwidth="6*" align="right"/>
27919 <entry><option>tls_on_connect_ports</option></entry>
27920 <entry>Use: <emphasis>main</emphasis></entry>
27921 <entry>Type: <emphasis>string list</emphasis></entry>
27922 <entry>Default: <emphasis>unset</emphasis></entry>
27928 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
27929 operate the obsolete SSMTP (SMTPS) protocol, where a TLS session is immediately
27930 set up without waiting for the client to issue a STARTTLS command. For
27931 further details, see section <xref linkend="SECTsupobssmt"/>.
27934 <indexterm role="option">
27935 <primary><option>tls_privatekey</option></primary>
27938 <informaltable frame="all">
27939 <tgroup cols="4" colsep="0" rowsep="0">
27940 <colspec colwidth="8*" align="left"/>
27941 <colspec colwidth="6*" align="center"/>
27942 <colspec colwidth="6*" align="center"/>
27943 <colspec colwidth="6*" align="right"/>
27946 <entry><option>tls_privatekey</option></entry>
27947 <entry>Use: <emphasis>main</emphasis></entry>
27948 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27949 <entry>Default: <emphasis>unset</emphasis></entry>
27955 <indexterm role="concept">
27956 <primary>TLS</primary>
27957 <secondary>server private key; location of</secondary>
27959 The value of this option is expanded, and must then be the absolute path to a
27960 file which contains the server’s private key. If this option is unset, or if
27961 the expansion is forced to fail, or the result is an empty string, the private
27962 key is assumed to be in the same file as the server’s certificates. See chapter
27963 <xref linkend="CHAPTLS"/> for further details.
27966 <indexterm role="option">
27967 <primary><option>tls_remember_esmtp</option></primary>
27970 <informaltable frame="all">
27971 <tgroup cols="4" colsep="0" rowsep="0">
27972 <colspec colwidth="8*" align="left"/>
27973 <colspec colwidth="6*" align="center"/>
27974 <colspec colwidth="6*" align="center"/>
27975 <colspec colwidth="6*" align="right"/>
27978 <entry><option>tls_remember_esmtp</option></entry>
27979 <entry>Use: <emphasis>main</emphasis></entry>
27980 <entry>Type: <emphasis>boolean</emphasis></entry>
27981 <entry>Default: <emphasis>false</emphasis></entry>
27987 <indexterm role="concept">
27988 <primary>TLS</primary>
27989 <secondary>esmtp state; remembering</secondary>
27991 <indexterm role="concept">
27992 <primary>TLS</primary>
27993 <secondary>broken clients</secondary>
27995 If this option is set true, Exim violates the RFCs by remembering that it is in
27996 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
27997 support for broken clients that fail to send a new EHLO after starting a
28001 <indexterm role="option">
28002 <primary><option>tls_require_ciphers</option></primary>
28005 <informaltable frame="all">
28006 <tgroup cols="4" colsep="0" rowsep="0">
28007 <colspec colwidth="8*" align="left"/>
28008 <colspec colwidth="6*" align="center"/>
28009 <colspec colwidth="6*" align="center"/>
28010 <colspec colwidth="6*" align="right"/>
28013 <entry><option>tls_require_ciphers</option></entry>
28014 <entry>Use: <emphasis>main</emphasis></entry>
28015 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28016 <entry>Default: <emphasis>unset</emphasis></entry>
28022 <indexterm role="concept">
28023 <primary>TLS</primary>
28024 <secondary>requiring specific ciphers</secondary>
28026 <indexterm role="concept">
28027 <primary>cipher</primary>
28028 <secondary>requiring specific</secondary>
28030 This option controls which ciphers can be used for incoming TLS connections.
28031 The <command>smtp</command> transport has an option of the same name for controlling outgoing
28032 connections. This option is expanded for each connection, so can be varied for
28033 different clients if required. The value of this option must be a list of
28034 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
28035 in somewhat different ways. If GnuTLS is being used, the client controls the
28036 preference order of the available ciphers. Details are given in sections
28037 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
28040 <indexterm role="option">
28041 <primary><option>tls_try_verify_hosts</option></primary>
28044 <informaltable frame="all">
28045 <tgroup cols="4" colsep="0" rowsep="0">
28046 <colspec colwidth="8*" align="left"/>
28047 <colspec colwidth="6*" align="center"/>
28048 <colspec colwidth="6*" align="center"/>
28049 <colspec colwidth="6*" align="right"/>
28052 <entry><option>tls_try_verify_hosts</option></entry>
28053 <entry>Use: <emphasis>main</emphasis></entry>
28054 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
28055 <entry>Default: <emphasis>unset</emphasis></entry>
28061 <indexterm role="concept">
28062 <primary>TLS</primary>
28063 <secondary>client certificate verification</secondary>
28065 <indexterm role="concept">
28066 <primary>certificate</primary>
28067 <secondary>verification of client</secondary>
28069 See <option>tls_verify_hosts</option> below.
28072 <indexterm role="option">
28073 <primary><option>tls_verify_certificates</option></primary>
28076 <informaltable frame="all">
28077 <tgroup cols="4" colsep="0" rowsep="0">
28078 <colspec colwidth="8*" align="left"/>
28079 <colspec colwidth="6*" align="center"/>
28080 <colspec colwidth="6*" align="center"/>
28081 <colspec colwidth="6*" align="right"/>
28084 <entry><option>tls_verify_certificates</option></entry>
28085 <entry>Use: <emphasis>main</emphasis></entry>
28086 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28087 <entry>Default: <emphasis>unset</emphasis></entry>
28093 <indexterm role="concept">
28094 <primary>TLS</primary>
28095 <secondary>client certificate verification</secondary>
28097 <indexterm role="concept">
28098 <primary>certificate</primary>
28099 <secondary>verification of client</secondary>
28101 The value of this option is expanded, and must then be the absolute path to
28102 a file containing permitted certificates for clients that
28103 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>. Alternatively, if you
28104 are using OpenSSL, you can set <option>tls_verify_certificates</option> to the name of a
28105 directory containing certificate files. This does not work with GnuTLS; the
28106 option must be set to the name of a single file if you are using GnuTLS.
28109 <indexterm role="option">
28110 <primary><option>tls_verify_hosts</option></primary>
28113 <informaltable frame="all">
28114 <tgroup cols="4" colsep="0" rowsep="0">
28115 <colspec colwidth="8*" align="left"/>
28116 <colspec colwidth="6*" align="center"/>
28117 <colspec colwidth="6*" align="center"/>
28118 <colspec colwidth="6*" align="right"/>
28121 <entry><option>tls_verify_hosts</option></entry>
28122 <entry>Use: <emphasis>main</emphasis></entry>
28123 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
28124 <entry>Default: <emphasis>unset</emphasis></entry>
28130 <indexterm role="concept">
28131 <primary>TLS</primary>
28132 <secondary>client certificate verification</secondary>
28134 <indexterm role="concept">
28135 <primary>certificate</primary>
28136 <secondary>verification of client</secondary>
28138 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
28139 certificates from clients. The expected certificates are defined by
28140 <option>tls_verify_certificates</option>, which must be set. A configuration error occurs if
28141 either <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> is set and
28142 <option>tls_verify_certificates</option> is not set.
28145 Any client that matches <option>tls_verify_hosts</option> is constrained by
28146 <option>tls_verify_certificates</option>. When the client initiates a TLS session, it must
28147 present one of the listed certificates. If it does not, the connection is
28148 aborted. <emphasis role="bold">Warning</emphasis>: Including a host in <option>tls_verify_hosts</option> does not require
28149 the host to use TLS. It can still send SMTP commands through unencrypted
28150 connections. Forcing a client to use TLS has to be done separately using an
28151 ACL to reject inappropriate commands when the connection is not encrypted.
28154 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
28155 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
28156 certificate and checks it against <option>tls_verify_certificates</option>, but does not
28157 abort the connection if there is no certificate or if it does not match. This
28158 state can be detected in an ACL, which makes it possible to implement policies
28159 such as <quote>accept for relay only if a verified certificate has been received,
28160 but accept for local delivery if encrypted, even without a verified
28161 certificate</quote>.
28164 Client hosts that match neither of these lists are not asked to present
28168 <indexterm role="option">
28169 <primary><option>trusted_groups</option></primary>
28172 <informaltable frame="all">
28173 <tgroup cols="4" colsep="0" rowsep="0">
28174 <colspec colwidth="8*" align="left"/>
28175 <colspec colwidth="6*" align="center"/>
28176 <colspec colwidth="6*" align="center"/>
28177 <colspec colwidth="6*" align="right"/>
28180 <entry><option>trusted_groups</option></entry>
28181 <entry>Use: <emphasis>main</emphasis></entry>
28182 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
28183 <entry>Default: <emphasis>unset</emphasis></entry>
28189 <indexterm role="concept">
28190 <primary>trusted groups</primary>
28192 <indexterm role="concept">
28193 <primary>groups</primary>
28194 <secondary>trusted</secondary>
28196 This option is expanded just once, at the start of Exim’s processing. If this
28197 option is set, any process that is running in one of the listed groups, or
28198 which has one of them as a supplementary group, is trusted. The groups can be
28199 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
28200 details of what trusted callers are permitted to do. If neither
28201 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
28205 <indexterm role="option">
28206 <primary><option>trusted_users</option></primary>
28209 <informaltable frame="all">
28210 <tgroup cols="4" colsep="0" rowsep="0">
28211 <colspec colwidth="8*" align="left"/>
28212 <colspec colwidth="6*" align="center"/>
28213 <colspec colwidth="6*" align="center"/>
28214 <colspec colwidth="6*" align="right"/>
28217 <entry><option>trusted_users</option></entry>
28218 <entry>Use: <emphasis>main</emphasis></entry>
28219 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
28220 <entry>Default: <emphasis>unset</emphasis></entry>
28226 <indexterm role="concept">
28227 <primary>trusted users</primary>
28229 <indexterm role="concept">
28230 <primary>user</primary>
28231 <secondary>trusted</secondary>
28233 This option is expanded just once, at the start of Exim’s processing. If this
28234 option is set, any process that is running as one of the listed users is
28235 trusted. The users can be specified numerically or by name. See section
28236 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
28237 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
28238 Exim user are trusted.
28241 <indexterm role="option">
28242 <primary><option>unknown_login</option></primary>
28245 <informaltable frame="all">
28246 <tgroup cols="4" colsep="0" rowsep="0">
28247 <colspec colwidth="8*" align="left"/>
28248 <colspec colwidth="6*" align="center"/>
28249 <colspec colwidth="6*" align="center"/>
28250 <colspec colwidth="6*" align="right"/>
28253 <entry><option>unknown_login</option></entry>
28254 <entry>Use: <emphasis>main</emphasis></entry>
28255 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28256 <entry>Default: <emphasis>unset</emphasis></entry>
28262 <indexterm role="concept">
28263 <primary>uid (user id)</primary>
28264 <secondary>unknown caller</secondary>
28266 <indexterm role="variable">
28267 <primary><varname>$caller_uid</varname></primary>
28269 This is a specialized feature for use in unusual configurations. By default, if
28270 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
28271 gives up. The <option>unknown_login</option> option can be used to set a login name to be
28272 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
28273 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
28274 is used for the user’s real name (gecos field), unless this has been set by the
28275 <option>-F</option> option.
28278 <indexterm role="option">
28279 <primary><option>unknown_username</option></primary>
28282 <informaltable frame="all">
28283 <tgroup cols="4" colsep="0" rowsep="0">
28284 <colspec colwidth="8*" align="left"/>
28285 <colspec colwidth="6*" align="center"/>
28286 <colspec colwidth="6*" align="center"/>
28287 <colspec colwidth="6*" align="right"/>
28290 <entry><option>unknown_username</option></entry>
28291 <entry>Use: <emphasis>main</emphasis></entry>
28292 <entry>Type: <emphasis>string</emphasis></entry>
28293 <entry>Default: <emphasis>unset</emphasis></entry>
28299 See <option>unknown_login</option>.
28302 <indexterm role="option">
28303 <primary><option>untrusted_set_sender</option></primary>
28306 <informaltable frame="all">
28307 <tgroup cols="4" colsep="0" rowsep="0">
28308 <colspec colwidth="8*" align="left"/>
28309 <colspec colwidth="6*" align="center"/>
28310 <colspec colwidth="6*" align="center"/>
28311 <colspec colwidth="6*" align="right"/>
28314 <entry><option>untrusted_set_sender</option></entry>
28315 <entry>Use: <emphasis>main</emphasis></entry>
28316 <entry>Type: <emphasis>address list</emphasis>†<emphasis></emphasis></entry>
28317 <entry>Default: <emphasis>unset</emphasis></entry>
28323 <indexterm role="concept">
28324 <primary>trusted users</primary>
28326 <indexterm role="concept">
28327 <primary>sender</primary>
28328 <secondary>setting by untrusted user</secondary>
28330 <indexterm role="concept">
28331 <primary>untrusted user setting sender</primary>
28333 <indexterm role="concept">
28334 <primary>user</primary>
28335 <secondary>untrusted setting sender</secondary>
28337 <indexterm role="concept">
28338 <primary>envelope sender</primary>
28340 When an untrusted user submits a message to Exim using the standard input, Exim
28341 normally creates an envelope sender address from the user’s login and the
28342 default qualification domain. Data from the <option>-f</option> option (for setting envelope
28343 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
28344 is used) is ignored.
28347 However, untrusted users are permitted to set an empty envelope sender address,
28348 to declare that a message should never generate any bounces. For example:
28350 <literallayout class="monospaced">
28351 exim -f '<>' user@domain.example
28354 <indexterm role="variable">
28355 <primary><varname>$sender_ident</varname></primary>
28357 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
28358 other envelope sender addresses in a controlled way. When it is set, untrusted
28359 users are allowed to set envelope sender addresses that match any of the
28360 patterns in the list. Like all address lists, the string is expanded. The
28361 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
28362 users to setting senders that start with their login ids
28363 followed by a hyphen
28364 by a setting like this:
28366 <literallayout class="monospaced">
28367 untrusted_set_sender = ^$sender_ident-
28370 If you want to allow untrusted users to set envelope sender addresses without
28371 restriction, you can use
28373 <literallayout class="monospaced">
28374 untrusted_set_sender = *
28377 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
28378 only to the setting of the envelope sender. It does not permit untrusted users
28379 to use the other options which trusted user can use to override message
28380 parameters. Furthermore, it does not stop Exim from removing an existing
28381 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
28382 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
28383 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
28384 described in section <xref linkend="SECTthesenhea"/>.
28387 The log line for a message’s arrival shows the envelope sender following
28388 <quote><=</quote>. For local messages, the user’s login always follows, after <quote>U=</quote>. In
28389 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
28390 envelope sender address, the user’s login is shown in parentheses after the
28394 <indexterm role="option">
28395 <primary><option>uucp_from_pattern</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>uucp_from_pattern</option></entry>
28407 <entry>Use: <emphasis>main</emphasis></entry>
28408 <entry>Type: <emphasis>string</emphasis></entry>
28409 <entry>Default: <emphasis>see below</emphasis></entry>
28415 <indexterm role="concept">
28416 <primary><quote>From</quote> line</primary>
28418 <indexterm role="concept">
28419 <primary>UUCP</primary>
28420 <secondary><quote>From</quote> line</secondary>
28422 Some applications that pass messages to an MTA via a command line interface use
28423 an initial line starting with <quote>From </quote> to pass the envelope sender. In
28424 particular, this is used by UUCP software. Exim recognizes such a line by means
28425 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
28426 matches, the sender address is constructed by expanding the contents of
28427 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
28428 default pattern recognizes lines in the following two forms:
28430 <literallayout class="monospaced">
28431 From ph10 Fri Jan 5 12:35 GMT 1996
28432 From ph10 Fri, 7 Jan 97 14:00:00 GMT
28435 The pattern can be seen by running
28437 <literallayout class="monospaced">
28438 exim -bP uucp_from_pattern
28441 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
28442 year in the second case. The first word after <quote>From </quote> is matched in the
28443 regular expression by a parenthesized subpattern. The default value for
28444 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
28445 (<quote>ph10</quote> in the example above) as the message’s sender. See also
28446 <option>ignore_fromline_hosts</option>.
28449 <indexterm role="option">
28450 <primary><option>uucp_from_sender</option></primary>
28453 <informaltable frame="all">
28454 <tgroup cols="4" colsep="0" rowsep="0">
28455 <colspec colwidth="8*" align="left"/>
28456 <colspec colwidth="6*" align="center"/>
28457 <colspec colwidth="6*" align="center"/>
28458 <colspec colwidth="6*" align="right"/>
28461 <entry><option>uucp_from_sender</option></entry>
28462 <entry>Use: <emphasis>main</emphasis></entry>
28463 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28464 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
28470 See <option>uucp_from_pattern</option> above.
28473 <indexterm role="option">
28474 <primary><option>warn_message_file</option></primary>
28477 <informaltable frame="all">
28478 <tgroup cols="4" colsep="0" rowsep="0">
28479 <colspec colwidth="8*" align="left"/>
28480 <colspec colwidth="6*" align="center"/>
28481 <colspec colwidth="6*" align="center"/>
28482 <colspec colwidth="6*" align="right"/>
28485 <entry><option>warn_message_file</option></entry>
28486 <entry>Use: <emphasis>main</emphasis></entry>
28487 <entry>Type: <emphasis>string</emphasis></entry>
28488 <entry>Default: <emphasis>unset</emphasis></entry>
28494 <indexterm role="concept">
28495 <primary>warning of delay</primary>
28496 <secondary>customizing the message</secondary>
28498 <indexterm role="concept">
28499 <primary>customizing</primary>
28500 <secondary>warning message</secondary>
28502 This option defines a template file containing paragraphs of text to be used
28503 for constructing the warning message which is sent by Exim when a message has
28504 been on the queue for a specified amount of time, as specified by
28505 <option>delay_warning</option>. Details of the file’s contents are given in chapter
28506 <xref linkend="CHAPemsgcust"/>. See also <option>bounce_message_file</option>.
28509 <indexterm role="option">
28510 <primary><option>write_rejectlog</option></primary>
28513 <informaltable frame="all">
28514 <tgroup cols="4" colsep="0" rowsep="0">
28515 <colspec colwidth="8*" align="left"/>
28516 <colspec colwidth="6*" align="center"/>
28517 <colspec colwidth="6*" align="center"/>
28518 <colspec colwidth="6*" align="right"/>
28521 <entry><option>write_rejectlog</option></entry>
28522 <entry>Use: <emphasis>main</emphasis></entry>
28523 <entry>Type: <emphasis>boolean</emphasis></entry>
28524 <entry>Default: <emphasis>true</emphasis></entry>
28530 <indexterm role="concept">
28531 <primary>reject log</primary>
28532 <secondary>disabling</secondary>
28534 If this option is set false, Exim no longer writes anything to the reject log.
28535 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
28536 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
28537 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
28542 <chapter id="CHAProutergeneric">
28543 <title>Generic options for routers</title>
28545 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
28546 <primary>options</primary>
28547 <secondary>generic; for routers</secondary>
28549 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
28550 <primary>generic options</primary>
28551 <secondary>router</secondary>
28553 This chapter describes the generic options that apply to all routers.
28554 Those that are preconditions are marked with ‡ in the <quote>use</quote> field.
28557 For a general description of how a router operates, see sections
28558 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
28559 which the preconditions are tested. The order of expansion of the options that
28560 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
28561 <option>headers_remove</option>, <option>transport</option>.
28564 <indexterm role="option">
28565 <primary><option>address_data</option></primary>
28568 <informaltable frame="all">
28569 <tgroup cols="4" colsep="0" rowsep="0">
28570 <colspec colwidth="8*" align="left"/>
28571 <colspec colwidth="6*" align="center"/>
28572 <colspec colwidth="6*" align="center"/>
28573 <colspec colwidth="6*" align="right"/>
28576 <entry><option>address_data</option></entry>
28577 <entry>Use: <emphasis>routers</emphasis></entry>
28578 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28579 <entry>Default: <emphasis>unset</emphasis></entry>
28585 <indexterm role="concept">
28586 <primary>router</primary>
28587 <secondary>data attached to address</secondary>
28589 The string is expanded just before the router is run, that is, after all the
28590 precondition tests have succeeded. If the expansion is forced to fail, the
28591 router declines, the value of <option>address_data</option> remains unchanged, and the
28592 <option>more</option> option controls what happens next. Other expansion failures cause
28593 delivery of the address to be deferred.
28596 <indexterm role="variable">
28597 <primary><varname>$address_data</varname></primary>
28599 When the expansion succeeds, the value is retained with the address, and can be
28600 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
28601 routers, and the eventual transport.
28604 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
28605 that runs a user’s filter file, the contents of <varname>$address_data</varname> are accessible
28606 in the filter. This is not normally a problem, because such data is usually
28607 either not confidential or it <quote>belongs</quote> to the current user, but if you do
28608 put confidential data into <varname>$address_data</varname> you need to remember this point.
28611 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
28612 with the address, though it can be changed by another <option>address_data</option> setting
28613 on a subsequent router. If a router generates child addresses, the value of
28614 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
28615 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
28618 The idea of <option>address_data</option> is that you can use it to look up a lot of data
28619 for the address once, and then pick out parts of the data later. For example,
28620 you could use a single LDAP lookup to return a string of the form
28622 <literallayout class="monospaced">
28623 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
28626 In the transport you could pick out the mailbox by a setting such as
28628 <literallayout class="monospaced">
28629 file = ${extract{mailbox}{$address_data}}
28632 This makes the configuration file less messy, and also reduces the number of
28633 lookups (though Exim does cache lookups).
28636 <indexterm role="variable">
28637 <primary><varname>$sender_address_data</varname></primary>
28639 <indexterm role="variable">
28640 <primary><varname>$address_data</varname></primary>
28642 The <option>address_data</option> facility is also useful as a means of passing information
28643 from one router to another, and from a router to a transport. In addition, if
28644 <varname>$address_data</varname> is set by a router when verifying a recipient address from an
28645 ACL, it remains available for use in the rest of the ACL statement. After
28646 verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
28649 <indexterm role="option">
28650 <primary><option>address_test</option></primary>
28653 <informaltable frame="all">
28654 <tgroup cols="4" colsep="0" rowsep="0">
28655 <colspec colwidth="8*" align="left"/>
28656 <colspec colwidth="6*" align="center"/>
28657 <colspec colwidth="6*" align="center"/>
28658 <colspec colwidth="6*" align="right"/>
28661 <entry><option>address_test</option></entry>
28662 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
28663 <entry>Type: <emphasis>boolean</emphasis></entry>
28664 <entry>Default: <emphasis>true</emphasis></entry>
28670 <indexterm role="option">
28671 <primary><option>-bt</option></primary>
28673 <indexterm role="concept">
28674 <primary>router</primary>
28675 <secondary>skipping when address testing</secondary>
28677 If this option is set false, the router is skipped when routing is being tested
28678 by means of the <option>-bt</option> command line option. This can be a convenience when
28679 your first router sends messages to an external scanner, because it saves you
28680 having to set the <quote>already scanned</quote> indicator when testing real address
28684 <indexterm role="option">
28685 <primary><option>cannot_route_message</option></primary>
28688 <informaltable frame="all">
28689 <tgroup cols="4" colsep="0" rowsep="0">
28690 <colspec colwidth="8*" align="left"/>
28691 <colspec colwidth="6*" align="center"/>
28692 <colspec colwidth="6*" align="center"/>
28693 <colspec colwidth="6*" align="right"/>
28696 <entry><option>cannot_route_message</option></entry>
28697 <entry>Use: <emphasis>routers</emphasis></entry>
28698 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28699 <entry>Default: <emphasis>unset</emphasis></entry>
28705 <indexterm role="concept">
28706 <primary>router</primary>
28707 <secondary>customizing <quote>cannot route</quote> message</secondary>
28709 <indexterm role="concept">
28710 <primary>customizing</primary>
28711 <secondary><quote>cannot route</quote> message</secondary>
28713 This option specifies a text message that is used when an address cannot be
28714 routed because Exim has run out of routers. The default message is
28715 <quote>Unrouteable address</quote>. This option is useful only on routers that have
28716 <option>more</option> set false, or on the very last router in a configuration, because the
28717 value that is used is taken from the last router that is considered. This
28718 includes a router that is skipped because its preconditions are not met, as
28719 well as a router that declines. For example, using the default configuration,
28722 <literallayout class="monospaced">
28723 cannot_route_message = Remote domain not found in DNS
28726 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
28729 <literallayout class="monospaced">
28730 cannot_route_message = Unknown local user
28733 on the final router that checks for local users. If string expansion fails for
28734 this option, the default message is used. Unless the expansion failure was
28735 explicitly forced, a message about the failure is written to the main and panic
28736 logs, in addition to the normal message about the routing failure.
28739 <indexterm role="option">
28740 <primary><option>caseful_local_part</option></primary>
28743 <informaltable frame="all">
28744 <tgroup cols="4" colsep="0" rowsep="0">
28745 <colspec colwidth="8*" align="left"/>
28746 <colspec colwidth="6*" align="center"/>
28747 <colspec colwidth="6*" align="center"/>
28748 <colspec colwidth="6*" align="right"/>
28751 <entry><option>caseful_local_part</option></entry>
28752 <entry>Use: <emphasis>routers</emphasis></entry>
28753 <entry>Type: <emphasis>boolean</emphasis></entry>
28754 <entry>Default: <emphasis>false</emphasis></entry>
28760 <indexterm role="concept">
28761 <primary>case of local parts</primary>
28763 <indexterm role="concept">
28764 <primary>router</primary>
28765 <secondary>case of local parts</secondary>
28767 By default, routers handle the local parts of addresses in a case-insensitive
28768 manner, though the actual case is preserved for transmission with the message.
28769 If you want the case of letters to be significant in a router, you must set
28770 this option true. For individual router options that contain address or local
28771 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
28772 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
28776 <indexterm role="variable">
28777 <primary><varname>$local_part</varname></primary>
28779 <indexterm role="variable">
28780 <primary><varname>$original_local_part</varname></primary>
28782 <indexterm role="variable">
28783 <primary><varname>$parent_local_part</varname></primary>
28785 The value of the <varname>$local_part</varname> variable is forced to lower case while a
28786 router is running unless <option>caseful_local_part</option> is set. When a router assigns
28787 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
28788 is the same as it was in the router. Similarly, when a router generates child
28789 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
28790 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
28793 This option applies to the processing of an address by a router. When a
28794 recipient address is being processed in an ACL, there is a separate <option>control</option>
28795 modifier that can be used to specify case-sensitive processing within the ACL
28796 (see section <xref linkend="SECTcontrols"/>).
28799 <indexterm role="option">
28800 <primary><option>check_local_user</option></primary>
28803 <informaltable frame="all">
28804 <tgroup cols="4" colsep="0" rowsep="0">
28805 <colspec colwidth="8*" align="left"/>
28806 <colspec colwidth="6*" align="center"/>
28807 <colspec colwidth="6*" align="center"/>
28808 <colspec colwidth="6*" align="right"/>
28811 <entry><option>check_local_user</option></entry>
28812 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
28813 <entry>Type: <emphasis>boolean</emphasis></entry>
28814 <entry>Default: <emphasis>false</emphasis></entry>
28820 <indexterm role="concept">
28821 <primary>local user, checking in router</primary>
28823 <indexterm role="concept">
28824 <primary>router</primary>
28825 <secondary>checking for local user</secondary>
28827 <indexterm role="concept">
28828 <primary><filename>/etc/passwd</filename></primary>
28830 <indexterm role="variable">
28831 <primary><varname>$home</varname></primary>
28833 When this option is true, Exim checks that the local part of the recipient
28834 address (with affixes removed if relevant) is the name of an account on the
28835 local system. The check is done by calling the <function>getpwnam()</function> function rather
28836 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
28837 holding password data (such as NIS) are supported. If the local part is a local
28838 user, <varname>$home</varname> is set from the password data, and can be tested in other
28839 preconditions that are evaluated after this one (the order of evaluation is
28840 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
28841 overridden by <option>router_home_directory</option>. If the local part is not a local user,
28842 the router is skipped.
28845 If you want to check that the local part is either the name of a local user
28846 or matches something else, you cannot combine <option>check_local_user</option> with a
28847 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
28848 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
28849 setting to achieve this. For example:
28851 <literallayout class="monospaced">
28852 local_parts = passwd;$local_part : lsearch;/etc/other/users
28855 Note, however, that the side effects of <option>check_local_user</option> (such as setting
28856 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
28857 <option>local_parts</option> (or any other) precondition.
28860 <indexterm role="option">
28861 <primary><option>condition</option></primary>
28864 <informaltable frame="all">
28865 <tgroup cols="4" colsep="0" rowsep="0">
28866 <colspec colwidth="8*" align="left"/>
28867 <colspec colwidth="6*" align="center"/>
28868 <colspec colwidth="6*" align="center"/>
28869 <colspec colwidth="6*" align="right"/>
28872 <entry><option>condition</option></entry>
28873 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
28874 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28875 <entry>Default: <emphasis>unset</emphasis></entry>
28881 <indexterm role="concept">
28882 <primary>router</primary>
28883 <secondary>customized precondition</secondary>
28885 This option specifies a general precondition test that has to succeed for the
28886 router to be called. The <option>condition</option> option is the last precondition to be
28887 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
28888 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
28889 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
28890 router is skipped, and the address is offered to the next one.
28893 If the result is any other value, the router is run (as this is the last
28894 precondition to be evaluated, all the other preconditions must be true).
28897 The <option>condition</option> option provides a means of applying custom conditions to the
28898 running of routers. Note that in the case of a simple conditional expansion,
28899 the default expansion values are exactly what is wanted. For example:
28901 <literallayout class="monospaced">
28902 condition = ${if >{$message_age}{600}}
28905 Because of the default behaviour of the string expansion, this is equivalent to
28907 <literallayout class="monospaced">
28908 condition = ${if >{$message_age}{600}{true}{}}
28911 If the expansion fails (other than forced failure) delivery is deferred. Some
28912 of the other precondition options are common special cases that could in fact
28913 be specified using <option>condition</option>.
28916 <indexterm role="option">
28917 <primary><option>debug_print</option></primary>
28920 <informaltable frame="all">
28921 <tgroup cols="4" colsep="0" rowsep="0">
28922 <colspec colwidth="8*" align="left"/>
28923 <colspec colwidth="6*" align="center"/>
28924 <colspec colwidth="6*" align="center"/>
28925 <colspec colwidth="6*" align="right"/>
28928 <entry><option>debug_print</option></entry>
28929 <entry>Use: <emphasis>routers</emphasis></entry>
28930 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28931 <entry>Default: <emphasis>unset</emphasis></entry>
28937 <indexterm role="concept">
28938 <primary>testing</primary>
28939 <secondary>variables in drivers</secondary>
28941 If this option is set and debugging is enabled (see the <option>-d</option> command line
28942 option), the string is expanded and included in the debugging output.
28943 If expansion of the string fails, the error message is written to the debugging
28944 output, and Exim carries on processing.
28945 This option is provided to help with checking out the values of variables and
28946 so on when debugging router configurations. For example, if a <option>condition</option>
28947 option appears not to be working, <option>debug_print</option> can be used to output the
28948 variables it references. The output happens after checks for <option>domains</option>,
28949 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
28950 are tested. A newline is added to the text if it does not end with one.
28953 <indexterm role="option">
28954 <primary><option>disable_logging</option></primary>
28957 <informaltable frame="all">
28958 <tgroup cols="4" colsep="0" rowsep="0">
28959 <colspec colwidth="8*" align="left"/>
28960 <colspec colwidth="6*" align="center"/>
28961 <colspec colwidth="6*" align="center"/>
28962 <colspec colwidth="6*" align="right"/>
28965 <entry><option>disable_logging</option></entry>
28966 <entry>Use: <emphasis>routers</emphasis></entry>
28967 <entry>Type: <emphasis>boolean</emphasis></entry>
28968 <entry>Default: <emphasis>false</emphasis></entry>
28974 If this option is set true, nothing is logged for any routing errors
28975 or for any deliveries caused by this router. You should not set this option
28976 unless you really, really know what you are doing. See also the generic
28977 transport option of the same name.
28980 <indexterm role="option">
28981 <primary><option>domains</option></primary>
28984 <informaltable frame="all">
28985 <tgroup cols="4" colsep="0" rowsep="0">
28986 <colspec colwidth="8*" align="left"/>
28987 <colspec colwidth="6*" align="center"/>
28988 <colspec colwidth="6*" align="center"/>
28989 <colspec colwidth="6*" align="right"/>
28992 <entry><option>domains</option></entry>
28993 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
28994 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
28995 <entry>Default: <emphasis>unset</emphasis></entry>
29001 <indexterm role="concept">
29002 <primary>router</primary>
29003 <secondary>restricting to specific domains</secondary>
29005 <indexterm role="variable">
29006 <primary><varname>$domain_data</varname></primary>
29008 If this option is set, the router is skipped unless the current domain matches
29009 the list. If the match is achieved by means of a file lookup, the data that the
29010 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
29011 expansions of the driver’s private options. See section <xref linkend="SECTrouprecon"/> for
29012 a list of the order in which preconditions are evaluated.
29015 <indexterm role="option">
29016 <primary><option>driver</option></primary>
29019 <informaltable frame="all">
29020 <tgroup cols="4" colsep="0" rowsep="0">
29021 <colspec colwidth="8*" align="left"/>
29022 <colspec colwidth="6*" align="center"/>
29023 <colspec colwidth="6*" align="center"/>
29024 <colspec colwidth="6*" align="right"/>
29027 <entry><option>driver</option></entry>
29028 <entry>Use: <emphasis>routers</emphasis></entry>
29029 <entry>Type: <emphasis>string</emphasis></entry>
29030 <entry>Default: <emphasis>unset</emphasis></entry>
29036 This option must always be set. It specifies which of the available routers is
29040 <indexterm role="option">
29041 <primary><option>errors_to</option></primary>
29044 <informaltable frame="all">
29045 <tgroup cols="4" colsep="0" rowsep="0">
29046 <colspec colwidth="8*" align="left"/>
29047 <colspec colwidth="6*" align="center"/>
29048 <colspec colwidth="6*" align="center"/>
29049 <colspec colwidth="6*" align="right"/>
29052 <entry><option>errors_to</option></entry>
29053 <entry>Use: <emphasis>routers</emphasis></entry>
29054 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29055 <entry>Default: <emphasis>unset</emphasis></entry>
29061 <indexterm role="concept">
29062 <primary>envelope sender</primary>
29064 <indexterm role="concept">
29065 <primary>router</primary>
29066 <secondary>changing address for errors</secondary>
29068 If a router successfully handles an address, it may assign the address to a
29069 transport for delivery or it may generate child addresses. In both cases, if
29070 there is a delivery problem during later processing, the resulting bounce
29071 message is sent to the address that results from expanding this string,
29072 provided that the address verifies successfully. The <option>errors_to</option> option is
29073 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
29076 The <option>errors_to</option> setting associated with an address can be overridden if it
29077 subsequently passes through other routers that have their own <option>errors_to</option>
29078 settings, or if the message is delivered by a transport with a <option>return_path</option>
29082 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
29083 the expansion fails to verify, the errors address associated with the incoming
29084 address is used. At top level, this is the envelope sender. A non-forced
29085 expansion failure causes delivery to be deferred.
29088 If an address for which <option>errors_to</option> has been set ends up being delivered over
29089 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
29090 any bounces that are generated by other MTAs on the delivery route are also
29091 sent there. You can set <option>errors_to</option> to the empty string by either of these
29094 <literallayout class="monospaced">
29099 An expansion item that yields an empty string has the same effect. If you do
29100 this, a locally detected delivery error for addresses processed by this router
29101 no longer gives rise to a bounce message; the error is discarded. If the
29102 address is delivered to a remote host, the return path is set to <literal><></literal>, unless
29103 overridden by the <option>return_path</option> option on the transport.
29106 <indexterm role="variable">
29107 <primary><varname>$address_data</varname></primary>
29109 If for some reason you want to discard local errors, but use a non-empty
29110 MAIL command for remote delivery, you can preserve the original return
29111 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
29112 setting <option>return_path</option>.
29115 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
29116 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
29117 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
29120 <indexterm role="option">
29121 <primary><option>expn</option></primary>
29124 <informaltable frame="all">
29125 <tgroup cols="4" colsep="0" rowsep="0">
29126 <colspec colwidth="8*" align="left"/>
29127 <colspec colwidth="6*" align="center"/>
29128 <colspec colwidth="6*" align="center"/>
29129 <colspec colwidth="6*" align="right"/>
29132 <entry><option>expn</option></entry>
29133 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29134 <entry>Type: <emphasis>boolean</emphasis></entry>
29135 <entry>Default: <emphasis>true</emphasis></entry>
29141 <indexterm role="concept">
29142 <primary>address</primary>
29143 <secondary>testing</secondary>
29145 <indexterm role="concept">
29146 <primary>testing</primary>
29147 <secondary>addresses</secondary>
29149 <indexterm role="concept">
29150 <primary>EXPN</primary>
29151 <secondary>router skipping</secondary>
29153 <indexterm role="concept">
29154 <primary>router</primary>
29155 <secondary>skipping for EXPN</secondary>
29157 If this option is turned off, the router is skipped when testing an address
29158 as a result of processing an SMTP EXPN command. You might, for example,
29159 want to turn it off on a router for users’ <filename>.forward</filename> files, while leaving it
29160 on for the system alias file.
29161 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
29165 The use of the SMTP EXPN command is controlled by an ACL (see chapter
29166 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
29167 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
29170 <indexterm role="option">
29171 <primary><option>fail_verify</option></primary>
29174 <informaltable frame="all">
29175 <tgroup cols="4" colsep="0" rowsep="0">
29176 <colspec colwidth="8*" align="left"/>
29177 <colspec colwidth="6*" align="center"/>
29178 <colspec colwidth="6*" align="center"/>
29179 <colspec colwidth="6*" align="right"/>
29182 <entry><option>fail_verify</option></entry>
29183 <entry>Use: <emphasis>routers</emphasis></entry>
29184 <entry>Type: <emphasis>boolean</emphasis></entry>
29185 <entry>Default: <emphasis>false</emphasis></entry>
29191 <indexterm role="concept">
29192 <primary>router</primary>
29193 <secondary>forcing verification failure</secondary>
29195 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
29196 <option>fail_verify_recipient</option> to the same value.
29199 <indexterm role="option">
29200 <primary><option>fail_verify_recipient</option></primary>
29203 <informaltable frame="all">
29204 <tgroup cols="4" colsep="0" rowsep="0">
29205 <colspec colwidth="8*" align="left"/>
29206 <colspec colwidth="6*" align="center"/>
29207 <colspec colwidth="6*" align="center"/>
29208 <colspec colwidth="6*" align="right"/>
29211 <entry><option>fail_verify_recipient</option></entry>
29212 <entry>Use: <emphasis>routers</emphasis></entry>
29213 <entry>Type: <emphasis>boolean</emphasis></entry>
29214 <entry>Default: <emphasis>false</emphasis></entry>
29220 If this option is true and an address is accepted by this router when
29221 verifying a recipient, verification fails.
29224 <indexterm role="option">
29225 <primary><option>fail_verify_sender</option></primary>
29228 <informaltable frame="all">
29229 <tgroup cols="4" colsep="0" rowsep="0">
29230 <colspec colwidth="8*" align="left"/>
29231 <colspec colwidth="6*" align="center"/>
29232 <colspec colwidth="6*" align="center"/>
29233 <colspec colwidth="6*" align="right"/>
29236 <entry><option>fail_verify_sender</option></entry>
29237 <entry>Use: <emphasis>routers</emphasis></entry>
29238 <entry>Type: <emphasis>boolean</emphasis></entry>
29239 <entry>Default: <emphasis>false</emphasis></entry>
29245 If this option is true and an address is accepted by this router when
29246 verifying a sender, verification fails.
29249 <indexterm role="option">
29250 <primary><option>fallback_hosts</option></primary>
29253 <informaltable frame="all">
29254 <tgroup cols="4" colsep="0" rowsep="0">
29255 <colspec colwidth="8*" align="left"/>
29256 <colspec colwidth="6*" align="center"/>
29257 <colspec colwidth="6*" align="center"/>
29258 <colspec colwidth="6*" align="right"/>
29261 <entry><option>fallback_hosts</option></entry>
29262 <entry>Use: <emphasis>routers</emphasis></entry>
29263 <entry>Type: <emphasis>string list</emphasis></entry>
29264 <entry>Default: <emphasis>unset</emphasis></entry>
29270 <indexterm role="concept">
29271 <primary>router</primary>
29272 <secondary>fallback hosts</secondary>
29274 <indexterm role="concept">
29275 <primary>fallback</primary>
29276 <secondary>hosts specified on router</secondary>
29278 String expansion is not applied to this option. The argument must be a
29279 colon-separated list of host names or IP addresses. The list separator can be
29280 changed (see section <xref linkend="SECTlistconstruct"/>), and a port can be specified with
29281 each name or address. In fact, the format of each item is exactly the same as
29282 defined for the list of hosts in a <command>manualroute</command> router (see section
29283 <xref linkend="SECTformatonehostitem"/>).
29286 If a router queues an address for a remote transport, this host list is
29287 associated with the address, and used instead of the transport’s fallback host
29288 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
29289 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
29290 transport for further details.
29293 <indexterm role="option">
29294 <primary><option>group</option></primary>
29297 <informaltable frame="all">
29298 <tgroup cols="4" colsep="0" rowsep="0">
29299 <colspec colwidth="8*" align="left"/>
29300 <colspec colwidth="6*" align="center"/>
29301 <colspec colwidth="6*" align="center"/>
29302 <colspec colwidth="6*" align="right"/>
29305 <entry><option>group</option></entry>
29306 <entry>Use: <emphasis>routers</emphasis></entry>
29307 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29308 <entry>Default: <emphasis>see below</emphasis></entry>
29314 <indexterm role="concept">
29315 <primary>gid (group id)</primary>
29316 <secondary>local delivery</secondary>
29318 <indexterm role="concept">
29319 <primary>local transports</primary>
29320 <secondary>uid and gid</secondary>
29322 <indexterm role="concept">
29323 <primary>transport</primary>
29324 <secondary>local</secondary>
29326 <indexterm role="concept">
29327 <primary>router</primary>
29328 <secondary>setting group</secondary>
29330 When a router queues an address for a transport, and the transport does not
29331 specify a group, the group given here is used when running the delivery
29333 The group may be specified numerically or by name. If expansion fails, the
29334 error is logged and delivery is deferred.
29335 The default is unset, unless <option>check_local_user</option> is set, when the default
29336 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
29337 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
29340 <indexterm role="option">
29341 <primary><option>headers_add</option></primary>
29344 <informaltable frame="all">
29345 <tgroup cols="4" colsep="0" rowsep="0">
29346 <colspec colwidth="8*" align="left"/>
29347 <colspec colwidth="6*" align="center"/>
29348 <colspec colwidth="6*" align="center"/>
29349 <colspec colwidth="6*" align="right"/>
29352 <entry><option>headers_add</option></entry>
29353 <entry>Use: <emphasis>routers</emphasis></entry>
29354 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29355 <entry>Default: <emphasis>unset</emphasis></entry>
29361 <indexterm role="concept">
29362 <primary>header lines</primary>
29363 <secondary>adding</secondary>
29365 <indexterm role="concept">
29366 <primary>router</primary>
29367 <secondary>adding header lines</secondary>
29369 This option specifies a string of text that is expanded at routing time, and
29370 associated with any addresses that are accepted by the router. However, this
29371 option has no effect when an address is just being verified. The way in which
29372 the text is used to add header lines at transport time is described in section
29373 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
29374 message is in the process of being transported. This means that references to
29375 header lines in string expansions in the transport’s configuration do not
29376 <quote>see</quote> the added header lines.
29379 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
29380 <option>headers_remove</option> and <option>transport</option>. If the expanded string is empty, or if
29381 the expansion is forced to fail, the option has no effect. Other expansion
29382 failures are treated as configuration errors.
29385 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
29386 router that has the <option>one_time</option> option set.
29389 <indexterm role="concept">
29390 <primary>duplicate addresses</primary>
29392 <indexterm role="option">
29393 <primary><option>unseen</option></primary>
29395 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
29396 additions are deleted when the address is passed on to subsequent routers.
29397 For a <option>redirect</option> router, if a generated address is the same as the incoming
29398 address, this can lead to duplicate addresses with different header
29399 modifications. Exim does not do duplicate deliveries (except, in certain
29400 circumstances, to pipes -- see section <xref linkend="SECTdupaddr"/>), but it is undefined
29401 which of the duplicates is discarded, so this ambiguous situation should be
29402 avoided. The <option>repeat_use</option> option of the <option>redirect</option> router may be of help.
29405 <indexterm role="option">
29406 <primary><option>headers_remove</option></primary>
29409 <informaltable frame="all">
29410 <tgroup cols="4" colsep="0" rowsep="0">
29411 <colspec colwidth="8*" align="left"/>
29412 <colspec colwidth="6*" align="center"/>
29413 <colspec colwidth="6*" align="center"/>
29414 <colspec colwidth="6*" align="right"/>
29417 <entry><option>headers_remove</option></entry>
29418 <entry>Use: <emphasis>routers</emphasis></entry>
29419 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29420 <entry>Default: <emphasis>unset</emphasis></entry>
29426 <indexterm role="concept">
29427 <primary>header lines</primary>
29428 <secondary>removing</secondary>
29430 <indexterm role="concept">
29431 <primary>router</primary>
29432 <secondary>removing header lines</secondary>
29434 This option specifies a string of text that is expanded at routing time, and
29435 associated with any addresses that are accepted by the router. However, this
29436 option has no effect when an address is just being verified. The way in which
29437 the text is used to remove header lines at transport time is described in
29438 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
29439 the message is in the process of being transported. This means that references
29440 to header lines in string expansions in the transport’s configuration still
29441 <quote>see</quote> the original header lines.
29444 The <option>headers_remove</option> option is expanded after <option>errors_to</option> and
29445 <option>headers_add</option>, but before <option>transport</option>. If the expansion is forced to fail,
29446 the option has no effect. Other expansion failures are treated as configuration
29450 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
29451 router that has the <option>one_time</option> option set.
29454 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
29455 removal requests are deleted when the address is passed on to subsequent
29456 routers, and this can lead to problems with duplicates -- see the similar
29457 warning for <option>headers_add</option> above.
29460 <indexterm role="option">
29461 <primary><option>ignore_target_hosts</option></primary>
29464 <informaltable frame="all">
29465 <tgroup cols="4" colsep="0" rowsep="0">
29466 <colspec colwidth="8*" align="left"/>
29467 <colspec colwidth="6*" align="center"/>
29468 <colspec colwidth="6*" align="center"/>
29469 <colspec colwidth="6*" align="right"/>
29472 <entry><option>ignore_target_hosts</option></entry>
29473 <entry>Use: <emphasis>routers</emphasis></entry>
29474 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
29475 <entry>Default: <emphasis>unset</emphasis></entry>
29481 <indexterm role="concept">
29482 <primary>IP address</primary>
29483 <secondary>discarding</secondary>
29485 <indexterm role="concept">
29486 <primary>router</primary>
29487 <secondary>discarding IP addresses</secondary>
29489 Although this option is a host list, it should normally contain IP address
29490 entries rather than names. If any host that is looked up by the router has an
29491 IP address that matches an item in this list, Exim behaves as if that IP
29492 address did not exist. This option allows you to cope with rogue DNS entries
29495 <literallayout class="monospaced">
29496 remote.domain.example. A 127.0.0.1
29501 <literallayout class="monospaced">
29502 ignore_target_hosts = 127.0.0.1
29505 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
29506 discarded in this way, the router declines. In a conventional configuration, an
29507 attempt to mail to such a domain would normally provoke the <quote>unrouteable
29508 domain</quote> error, and an attempt to verify an address in the domain would fail.
29509 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
29510 router declines if presented with one of the listed addresses.
29513 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
29514 means of the first or the second of the following settings, respectively:
29516 <literallayout class="monospaced">
29517 ignore_target_hosts = 0.0.0.0/0
29518 ignore_target_hosts = <; 0::0/0
29521 The pattern in the first line matches all IPv4 addresses, whereas the pattern
29522 in the second line matches all IPv6 addresses.
29525 This option may also be useful for ignoring link-local and site-local IPv6
29526 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
29527 is expanded before use as a list, it is possible to make it dependent on the
29528 domain that is being routed.
29531 <indexterm role="variable">
29532 <primary><varname>$host_address</varname></primary>
29534 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
29538 <indexterm role="option">
29539 <primary><option>initgroups</option></primary>
29542 <informaltable frame="all">
29543 <tgroup cols="4" colsep="0" rowsep="0">
29544 <colspec colwidth="8*" align="left"/>
29545 <colspec colwidth="6*" align="center"/>
29546 <colspec colwidth="6*" align="center"/>
29547 <colspec colwidth="6*" align="right"/>
29550 <entry><option>initgroups</option></entry>
29551 <entry>Use: <emphasis>routers</emphasis></entry>
29552 <entry>Type: <emphasis>boolean</emphasis></entry>
29553 <entry>Default: <emphasis>false</emphasis></entry>
29559 <indexterm role="concept">
29560 <primary>additional groups</primary>
29562 <indexterm role="concept">
29563 <primary>groups</primary>
29564 <secondary>additional</secondary>
29566 <indexterm role="concept">
29567 <primary>local transports</primary>
29568 <secondary>uid and gid</secondary>
29570 <indexterm role="concept">
29571 <primary>transport</primary>
29572 <secondary>local</secondary>
29574 If the router queues an address for a transport, and this option is true, and
29575 the uid supplied by the router is not overridden by the transport, the
29576 <function>initgroups()</function> function is called when running the transport to ensure that
29577 any additional groups associated with the uid are set up. See also <option>group</option>
29578 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
29581 <indexterm role="option">
29582 <primary><option>local_part_prefix</option></primary>
29585 <informaltable frame="all">
29586 <tgroup cols="4" colsep="0" rowsep="0">
29587 <colspec colwidth="8*" align="left"/>
29588 <colspec colwidth="6*" align="center"/>
29589 <colspec colwidth="6*" align="center"/>
29590 <colspec colwidth="6*" align="right"/>
29593 <entry><option>local_part_prefix</option></entry>
29594 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29595 <entry>Type: <emphasis>string list</emphasis></entry>
29596 <entry>Default: <emphasis>unset</emphasis></entry>
29602 <indexterm role="concept">
29603 <primary>router</primary>
29604 <secondary>prefix for local part</secondary>
29606 <indexterm role="concept">
29607 <primary>prefix</primary>
29608 <secondary>for local part, used in router</secondary>
29610 If this option is set, the router is skipped unless the local part starts with
29611 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
29612 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
29616 The list is scanned from left to right, and the first prefix that matches is
29617 used. A limited form of wildcard is available; if the prefix begins with an
29618 asterisk, it matches the longest possible sequence of arbitrary characters at
29619 the start of the local part. An asterisk should therefore always be followed by
29620 some character that does not occur in normal local parts.
29621 <indexterm role="concept">
29622 <primary>multiple mailboxes</primary>
29624 <indexterm role="concept">
29625 <primary>mailbox</primary>
29626 <secondary>multiple</secondary>
29628 Wildcarding can be used to set up multiple user mailboxes, as described in
29629 section <xref linkend="SECTmulbox"/>.
29632 <indexterm role="variable">
29633 <primary><varname>$local_part</varname></primary>
29635 <indexterm role="variable">
29636 <primary><varname>$local_part_prefix</varname></primary>
29638 During the testing of the <option>local_parts</option> option, and while the router is
29639 running, the prefix is removed from the local part, and is available in the
29640 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
29641 the router accepts the address, this remains true during subsequent delivery by
29642 a transport. In particular, the local part that is transmitted in the RCPT
29643 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
29644 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
29645 the relevant transport.
29648 When an address is being verified, <option>local_part_prefix</option> affects only the
29649 behaviour of the router. If the callout feature of verification is in use, this
29650 means that the full address, including the prefix, will be used during the
29654 The prefix facility is commonly used to handle local parts of the form
29655 <option>owner-something</option>. Another common use is to support local parts of the form
29656 <option>real-username</option> to bypass a user’s <filename>.forward</filename> file – helpful when trying
29657 to tell a user their forwarding is broken – by placing a router like this one
29658 immediately before the router that handles <filename>.forward</filename> files:
29660 <literallayout class="monospaced">
29663 local_part_prefix = real-
29665 transport = local_delivery
29668 For security, it would probably be a good idea to restrict the use of this
29669 router to locally-generated messages, using a condition such as this:
29671 <literallayout class="monospaced">
29672 condition = ${if match {$sender_host_address}\
29673 {\N^(|127\.0\.0\.1)$\N}}
29676 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
29677 both conditions must be met if not optional. Care must be taken if wildcards
29678 are used in both a prefix and a suffix on the same router. Different
29679 separator characters must be used to avoid ambiguity.
29682 <indexterm role="option">
29683 <primary><option>local_part_prefix_optional</option></primary>
29686 <informaltable frame="all">
29687 <tgroup cols="4" colsep="0" rowsep="0">
29688 <colspec colwidth="8*" align="left"/>
29689 <colspec colwidth="6*" align="center"/>
29690 <colspec colwidth="6*" align="center"/>
29691 <colspec colwidth="6*" align="right"/>
29694 <entry><option>local_part_prefix_optional</option></entry>
29695 <entry>Use: <emphasis>routers</emphasis></entry>
29696 <entry>Type: <emphasis>boolean</emphasis></entry>
29697 <entry>Default: <emphasis>false</emphasis></entry>
29703 See <option>local_part_prefix</option> above.
29706 <indexterm role="option">
29707 <primary><option>local_part_suffix</option></primary>
29710 <informaltable frame="all">
29711 <tgroup cols="4" colsep="0" rowsep="0">
29712 <colspec colwidth="8*" align="left"/>
29713 <colspec colwidth="6*" align="center"/>
29714 <colspec colwidth="6*" align="center"/>
29715 <colspec colwidth="6*" align="right"/>
29718 <entry><option>local_part_suffix</option></entry>
29719 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29720 <entry>Type: <emphasis>string list</emphasis></entry>
29721 <entry>Default: <emphasis>unset</emphasis></entry>
29727 <indexterm role="concept">
29728 <primary>router</primary>
29729 <secondary>suffix for local part</secondary>
29731 <indexterm role="concept">
29732 <primary>suffix for local part</primary>
29733 <secondary>used in router</secondary>
29735 This option operates in the same way as <option>local_part_prefix</option>, except that the
29736 local part must end (rather than start) with the given string, the
29737 <option>local_part_suffix_optional</option> option determines whether the suffix is
29738 mandatory, and the wildcard * character, if present, must be the last
29739 character of the suffix. This option facility is commonly used to handle local
29740 parts of the form <option>something-request</option> and multiple user mailboxes of the form
29741 <option>username-foo</option>.
29744 <indexterm role="option">
29745 <primary><option>local_part_suffix_optional</option></primary>
29748 <informaltable frame="all">
29749 <tgroup cols="4" colsep="0" rowsep="0">
29750 <colspec colwidth="8*" align="left"/>
29751 <colspec colwidth="6*" align="center"/>
29752 <colspec colwidth="6*" align="center"/>
29753 <colspec colwidth="6*" align="right"/>
29756 <entry><option>local_part_suffix_optional</option></entry>
29757 <entry>Use: <emphasis>routers</emphasis></entry>
29758 <entry>Type: <emphasis>boolean</emphasis></entry>
29759 <entry>Default: <emphasis>false</emphasis></entry>
29765 See <option>local_part_suffix</option> above.
29768 <indexterm role="option">
29769 <primary><option>local_parts</option></primary>
29772 <informaltable frame="all">
29773 <tgroup cols="4" colsep="0" rowsep="0">
29774 <colspec colwidth="8*" align="left"/>
29775 <colspec colwidth="6*" align="center"/>
29776 <colspec colwidth="6*" align="center"/>
29777 <colspec colwidth="6*" align="right"/>
29780 <entry><option>local_parts</option></entry>
29781 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29782 <entry>Type: <emphasis>local part list</emphasis>†<emphasis></emphasis></entry>
29783 <entry>Default: <emphasis>unset</emphasis></entry>
29789 <indexterm role="concept">
29790 <primary>router</primary>
29791 <secondary>restricting to specific local parts</secondary>
29793 <indexterm role="concept">
29794 <primary>local part</primary>
29795 <secondary>checking in router</secondary>
29797 The router is run only if the local part of the address matches the list.
29798 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
29800 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
29801 string is expanded, it is possible to make it depend on the domain, for
29804 <literallayout class="monospaced">
29805 local_parts = dbm;/usr/local/specials/$domain
29808 <indexterm role="variable">
29809 <primary><varname>$local_part_data</varname></primary>
29811 If the match is achieved by a lookup, the data that the lookup returned
29812 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
29813 expansions of the router’s private options. You might use this option, for
29814 example, if you have a large number of local virtual domains, and you want to
29815 send all postmaster mail to the same place without having to set up an alias in
29816 each virtual domain:
29818 <literallayout class="monospaced">
29821 local_parts = postmaster
29822 data = postmaster@real.domain.example
29825 <indexterm role="option">
29826 <primary><option>log_as_local</option></primary>
29829 <informaltable frame="all">
29830 <tgroup cols="4" colsep="0" rowsep="0">
29831 <colspec colwidth="8*" align="left"/>
29832 <colspec colwidth="6*" align="center"/>
29833 <colspec colwidth="6*" align="center"/>
29834 <colspec colwidth="6*" align="right"/>
29837 <entry><option>log_as_local</option></entry>
29838 <entry>Use: <emphasis>routers</emphasis></entry>
29839 <entry>Type: <emphasis>boolean</emphasis></entry>
29840 <entry>Default: <emphasis>see below</emphasis></entry>
29846 <indexterm role="concept">
29847 <primary>log</primary>
29848 <secondary>delivery line</secondary>
29850 <indexterm role="concept">
29851 <primary>delivery</primary>
29852 <secondary>log line format</secondary>
29854 Exim has two logging styles for delivery, the idea being to make local
29855 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
29856 recipient address is given just as the local part, without a domain. The use of
29857 this style is controlled by this option. It defaults to true for the <command>accept</command>
29858 router, and false for all the others. This option applies only when a
29859 router assigns an address to a transport. It has no effect on routers that
29860 redirect addresses.
29863 <indexterm role="option">
29864 <primary><option>more</option></primary>
29867 <informaltable frame="all">
29868 <tgroup cols="4" colsep="0" rowsep="0">
29869 <colspec colwidth="8*" align="left"/>
29870 <colspec colwidth="6*" align="center"/>
29871 <colspec colwidth="6*" align="center"/>
29872 <colspec colwidth="6*" align="right"/>
29875 <entry><option>more</option></entry>
29876 <entry>Use: <emphasis>routers</emphasis></entry>
29877 <entry>Type: <emphasis>boolean</emphasis>†<emphasis></emphasis></entry>
29878 <entry>Default: <emphasis>true</emphasis></entry>
29884 The result of string expansion for this option must be a valid boolean value,
29885 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
29886 result causes an error, and delivery is deferred. If the expansion is forced to
29887 fail, the default value for the option (true) is used. Other failures cause
29888 delivery to be deferred.
29891 If this option is set false, and the router declines to handle the address, no
29892 further routers are tried, routing fails, and the address is bounced.
29893 <indexterm role="option">
29894 <primary><option>self</option></primary>
29896 However, if the router explicitly passes an address to the following router by
29897 means of the setting
29899 <literallayout class="monospaced">
29903 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
29904 does not affect the behaviour if one of the precondition tests fails. In that
29905 case, the address is always passed to the next router.
29908 Note that <option>address_data</option> is not considered to be a precondition. If its
29909 expansion is forced to fail, the router declines, and the value of <option>more</option>
29910 controls what happens next.
29913 <indexterm role="option">
29914 <primary><option>pass_on_timeout</option></primary>
29917 <informaltable frame="all">
29918 <tgroup cols="4" colsep="0" rowsep="0">
29919 <colspec colwidth="8*" align="left"/>
29920 <colspec colwidth="6*" align="center"/>
29921 <colspec colwidth="6*" align="center"/>
29922 <colspec colwidth="6*" align="right"/>
29925 <entry><option>pass_on_timeout</option></entry>
29926 <entry>Use: <emphasis>routers</emphasis></entry>
29927 <entry>Type: <emphasis>boolean</emphasis></entry>
29928 <entry>Default: <emphasis>false</emphasis></entry>
29934 <indexterm role="concept">
29935 <primary>timeout</primary>
29936 <secondary>of router</secondary>
29938 <indexterm role="concept">
29939 <primary>router</primary>
29940 <secondary>timeout</secondary>
29942 If a router times out during a host lookup, it normally causes deferral of the
29943 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
29944 router, overriding <option>no_more</option>. This may be helpful for systems that are
29945 intermittently connected to the Internet, or those that want to pass to a smart
29946 host any messages that cannot immediately be delivered.
29949 There are occasional other temporary errors that can occur while doing DNS
29950 lookups. They are treated in the same way as a timeout, and this option
29951 applies to all of them.
29954 <indexterm role="option">
29955 <primary><option>pass_router</option></primary>
29958 <informaltable frame="all">
29959 <tgroup cols="4" colsep="0" rowsep="0">
29960 <colspec colwidth="8*" align="left"/>
29961 <colspec colwidth="6*" align="center"/>
29962 <colspec colwidth="6*" align="center"/>
29963 <colspec colwidth="6*" align="right"/>
29966 <entry><option>pass_router</option></entry>
29967 <entry>Use: <emphasis>routers</emphasis></entry>
29968 <entry>Type: <emphasis>string</emphasis></entry>
29969 <entry>Default: <emphasis>unset</emphasis></entry>
29975 <indexterm role="concept">
29976 <primary>router</primary>
29977 <secondary>go to after <quote>pass</quote></secondary>
29979 Routers that recognize the generic <option>self</option> option (<command>dnslookup</command>,
29980 <command>ipliteral</command>, and <command>manualroute</command>) are able to return <quote>pass</quote>, forcing
29981 routing to continue, and overriding a false setting of <option>more</option>. When one of
29982 these routers returns <quote>pass</quote>, the address is normally handed on to the next
29983 router in sequence. This can be changed by setting <option>pass_router</option> to the name
29984 of another router. However (unlike <option>redirect_router</option>) the named router must
29985 be below the current router, to avoid loops. Note that this option applies only
29986 to the special case of <quote>pass</quote>. It does not apply when a router returns
29987 <quote>decline</quote> because it cannot handle an address.
29990 <indexterm role="option">
29991 <primary><option>redirect_router</option></primary>
29994 <informaltable frame="all">
29995 <tgroup cols="4" colsep="0" rowsep="0">
29996 <colspec colwidth="8*" align="left"/>
29997 <colspec colwidth="6*" align="center"/>
29998 <colspec colwidth="6*" align="center"/>
29999 <colspec colwidth="6*" align="right"/>
30002 <entry><option>redirect_router</option></entry>
30003 <entry>Use: <emphasis>routers</emphasis></entry>
30004 <entry>Type: <emphasis>string</emphasis></entry>
30005 <entry>Default: <emphasis>unset</emphasis></entry>
30011 <indexterm role="concept">
30012 <primary>router</primary>
30013 <secondary>start at after redirection</secondary>
30015 Sometimes an administrator knows that it is pointless to reprocess addresses
30016 generated from alias or forward files with the same router again. For
30017 example, if an alias file translates real names into login ids there is no
30018 point searching the alias file a second time, especially if it is a large file.
30021 The <option>redirect_router</option> option can be set to the name of any router instance.
30022 It causes the routing of any generated addresses to start at the named router
30023 instead of at the first router. This option has no effect if the router in
30024 which it is set does not generate new addresses.
30027 <indexterm role="option">
30028 <primary><option>require_files</option></primary>
30031 <informaltable frame="all">
30032 <tgroup cols="4" colsep="0" rowsep="0">
30033 <colspec colwidth="8*" align="left"/>
30034 <colspec colwidth="6*" align="center"/>
30035 <colspec colwidth="6*" align="center"/>
30036 <colspec colwidth="6*" align="right"/>
30039 <entry><option>require_files</option></entry>
30040 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
30041 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
30042 <entry>Default: <emphasis>unset</emphasis></entry>
30048 <indexterm role="concept">
30049 <primary>file</primary>
30050 <secondary>requiring for router</secondary>
30052 <indexterm role="concept">
30053 <primary>router</primary>
30054 <secondary>requiring file existence</secondary>
30056 This option provides a general mechanism for predicating the running of a
30057 router on the existence or non-existence of certain files or directories.
30058 Before running a router, as one of its precondition tests, Exim works its way
30059 through the <option>require_files</option> list, expanding each item separately.
30062 Because the list is split before expansion, any colons in expansion items must
30063 be doubled, or the facility for using a different list separator must be used.
30064 If any expansion is forced to fail, the item is ignored. Other expansion
30065 failures cause routing of the address to be deferred.
30068 If any expanded string is empty, it is ignored. Otherwise, except as described
30069 below, each string must be a fully qualified file path, optionally preceded by
30070 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
30071 existence of the files or directories. The router is skipped if any paths not
30072 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
30075 <indexterm role="concept">
30076 <primary>NFS</primary>
30078 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
30079 the message is deferred. This can happen when NFS-mounted filesystems are
30083 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
30084 options, so you cannot use it to check for the existence of a file in which to
30085 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
30086 full list of the order in which preconditions are evaluated.) However, as
30087 these options are all expanded, you can use the <option>exists</option> expansion condition
30088 to make such tests. The <option>require_files</option> option is intended for checking files
30089 that the router may be going to use internally, or which are needed by a
30090 transport (for example <filename>.procmailrc</filename>).
30093 During delivery, the <function>stat()</function> function is run as root, but there is a
30094 facility for some checking of the accessibility of a file by another user.
30095 This is not a proper permissions check, but just a <quote>rough</quote> check that
30096 operates as follows:
30099 If an item in a <option>require_files</option> list does not contain any forward slash
30100 characters, it is taken to be the user (and optional group, separated by a
30101 comma) to be checked for subsequent files in the list. If no group is specified
30102 but the user is specified symbolically, the gid associated with the uid is
30105 <literallayout class="monospaced">
30106 require_files = mail:/some/file
30107 require_files = $local_part:$home/.procmailrc
30110 If a user or group name in a <option>require_files</option> list does not exist, the
30111 <option>require_files</option> condition fails.
30114 Exim performs the check by scanning along the components of the file path, and
30115 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
30116 directories, and <quote>r</quote> access on the final file. Note that this means that file
30117 access control lists, if the operating system has them, are ignored.
30120 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
30121 incoming SMTP message, Exim is not running as root, but under its own uid. This
30122 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
30123 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
30124 user is not permitted to read one of the directories on the file’s path.
30127 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
30128 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
30129 without root access. In this case, if a check for access by a particular user
30130 is requested, Exim creates a subprocess that runs as that user, and tries the
30131 check again in that process.
30134 The default action for handling an unresolved EACCES is to consider it to
30135 be caused by a configuration error, and routing is deferred because the
30136 existence or non-existence of the file cannot be determined. However, in some
30137 circumstances it may be desirable to treat this condition as if the file did
30138 not exist. If the file name (or the exclamation mark that precedes the file
30139 name for non-existence) is preceded by a plus sign, the EACCES error is treated
30140 as if the file did not exist. For example:
30142 <literallayout class="monospaced">
30143 require_files = +/some/file
30146 If the router is not an essential part of verification (for example, it
30147 handles users’ <filename>.forward</filename> files), another solution is to set the <option>verify</option>
30148 option false so that the router is skipped when verifying.
30151 <indexterm role="option">
30152 <primary><option>retry_use_local_part</option></primary>
30155 <informaltable frame="all">
30156 <tgroup cols="4" colsep="0" rowsep="0">
30157 <colspec colwidth="8*" align="left"/>
30158 <colspec colwidth="6*" align="center"/>
30159 <colspec colwidth="6*" align="center"/>
30160 <colspec colwidth="6*" align="right"/>
30163 <entry><option>retry_use_local_part</option></entry>
30164 <entry>Use: <emphasis>routers</emphasis></entry>
30165 <entry>Type: <emphasis>boolean</emphasis></entry>
30166 <entry>Default: <emphasis>see below</emphasis></entry>
30172 <indexterm role="concept">
30173 <primary>hints database</primary>
30174 <secondary>retry keys</secondary>
30176 <indexterm role="concept">
30177 <primary>local part</primary>
30178 <secondary>in retry keys</secondary>
30180 When a delivery suffers a temporary routing failure, a retry record is created
30181 in Exim’s hints database. For addresses whose routing depends only on the
30182 domain, the key for the retry record should not involve the local part, but for
30183 other addresses, both the domain and the local part should be included.
30184 Usually, remote routing is of the former kind, and local routing is of the
30188 This option controls whether the local part is used to form the key for retry
30189 hints for addresses that suffer temporary errors while being handled by this
30190 router. The default value is true for any router that has <option>check_local_user</option>
30191 set, and false otherwise. Note that this option does not apply to hints keys
30192 for transport delays; they are controlled by a generic transport option of the
30196 The setting of <option>retry_use_local_part</option> applies only to the router on which it
30197 appears. If the router generates child addresses, they are routed
30198 independently; this setting does not become attached to them.
30201 <indexterm role="option">
30202 <primary><option>router_home_directory</option></primary>
30205 <informaltable frame="all">
30206 <tgroup cols="4" colsep="0" rowsep="0">
30207 <colspec colwidth="8*" align="left"/>
30208 <colspec colwidth="6*" align="center"/>
30209 <colspec colwidth="6*" align="center"/>
30210 <colspec colwidth="6*" align="right"/>
30213 <entry><option>router_home_directory</option></entry>
30214 <entry>Use: <emphasis>routers</emphasis></entry>
30215 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
30216 <entry>Default: <emphasis>unset</emphasis></entry>
30222 <indexterm role="concept">
30223 <primary>router</primary>
30224 <secondary>home directory for</secondary>
30226 <indexterm role="concept">
30227 <primary>home directory</primary>
30228 <secondary>for router</secondary>
30230 <indexterm role="variable">
30231 <primary><varname>$home</varname></primary>
30233 This option sets a home directory for use while the router is running. (Compare
30234 <option>transport_home_directory</option>, which sets a home directory for later
30235 transporting.) In particular, if used on a <command>redirect</command> router, this option
30236 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
30237 forced expansion failure causes the option to be ignored – other failures
30238 cause the router to defer.
30241 Expansion of <option>router_home_directory</option> happens immediately after the
30242 <option>check_local_user</option> test (if configured), before any further expansions take
30244 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30246 While the router is running, <option>router_home_directory</option> overrides the value of
30247 <varname>$home</varname> that came from <option>check_local_user</option>.
30250 When a router accepts an address and assigns it to a local transport (including
30251 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
30252 delivery), the home directory setting for the transport is taken from the first
30253 of these values that is set:
30258 The <option>home_directory</option> option on the transport;
30263 The <option>transport_home_directory</option> option on the router;
30268 The password data if <option>check_local_user</option> is set on the router;
30273 The <option>router_home_directory</option> option on the router.
30278 In other words, <option>router_home_directory</option> overrides the password data for the
30279 router, but not for the transport.
30282 <indexterm role="option">
30283 <primary><option>self</option></primary>
30286 <informaltable frame="all">
30287 <tgroup cols="4" colsep="0" rowsep="0">
30288 <colspec colwidth="8*" align="left"/>
30289 <colspec colwidth="6*" align="center"/>
30290 <colspec colwidth="6*" align="center"/>
30291 <colspec colwidth="6*" align="right"/>
30294 <entry><option>self</option></entry>
30295 <entry>Use: <emphasis>routers</emphasis></entry>
30296 <entry>Type: <emphasis>string</emphasis></entry>
30297 <entry>Default: <emphasis>freeze</emphasis></entry>
30303 <indexterm role="concept">
30304 <primary>MX record</primary>
30305 <secondary>pointing to local host</secondary>
30307 <indexterm role="concept">
30308 <primary>local host</primary>
30309 <secondary>MX pointing to</secondary>
30311 This option applies to those routers that use a recipient address to find a
30312 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
30313 and <command>manualroute</command> routers.
30314 Certain configurations of the <command>queryprogram</command> router can also specify a list
30316 Usually such routers are configured to send the message to a remote host via an
30317 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
30318 host on the list turns out to be the local host.
30319 The way in which Exim checks for the local host is described in section
30320 <xref linkend="SECTreclocipadd"/>.
30323 Normally this situation indicates either an error in Exim’s configuration (for
30324 example, the router should be configured not to process this domain), or an
30325 error in the DNS (for example, the MX should not point to this host). For this
30326 reason, the default action is to log the incident, defer the address, and
30327 freeze the message. The following alternatives are provided for use in special
30332 <term><option>defer</option></term>
30335 Delivery of the message is tried again later, but the message is not frozen.
30337 </listitem></varlistentry>
30339 <term><option>reroute</option>: <<emphasis>domain</emphasis>></term>
30342 The domain is changed to the given domain, and the address is passed back to
30343 be reprocessed by the routers. No rewriting of headers takes place. This
30344 behaviour is essentially a redirection.
30346 </listitem></varlistentry>
30348 <term><option>reroute: rewrite:</option> <<emphasis>domain</emphasis>></term>
30351 The domain is changed to the given domain, and the address is passed back to be
30352 reprocessed by the routers. Any headers that contain the original domain are
30355 </listitem></varlistentry>
30357 <term><option>pass</option></term>
30360 <indexterm role="option">
30361 <primary><option>more</option></primary>
30363 <indexterm role="variable">
30364 <primary><varname>$self_hostname</varname></primary>
30366 The router passes the address to the next router, or to the router named in the
30367 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
30368 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
30369 name of the local host that the router encountered. This can be used to
30370 distinguish between different cases for hosts with multiple names. The
30373 <literallayout class="monospaced">
30378 ensures that only those addresses that routed to the local host are passed on.
30379 Without <option>no_more</option>, addresses that were declined for other reasons would also
30380 be passed to the next router.
30382 </listitem></varlistentry>
30384 <term><option>fail</option></term>
30387 Delivery fails and an error report is generated.
30389 </listitem></varlistentry>
30391 <term><option>send</option></term>
30394 <indexterm role="concept">
30395 <primary>local host</primary>
30396 <secondary>sending to</secondary>
30398 The anomaly is ignored and the address is queued for the transport. This
30399 setting should be used with extreme caution. For an <command>smtp</command> transport, it
30400 makes sense only in cases where the program that is listening on the SMTP port
30401 is not this version of Exim. That is, it must be some other MTA, or Exim with a
30402 different configuration file that handles the domain in another way.
30404 </listitem></varlistentry>
30407 <indexterm role="option">
30408 <primary><option>senders</option></primary>
30411 <informaltable frame="all">
30412 <tgroup cols="4" colsep="0" rowsep="0">
30413 <colspec colwidth="8*" align="left"/>
30414 <colspec colwidth="6*" align="center"/>
30415 <colspec colwidth="6*" align="center"/>
30416 <colspec colwidth="6*" align="right"/>
30419 <entry><option>senders</option></entry>
30420 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
30421 <entry>Type: <emphasis>address list</emphasis>†<emphasis></emphasis></entry>
30422 <entry>Default: <emphasis>unset</emphasis></entry>
30428 <indexterm role="concept">
30429 <primary>router</primary>
30430 <secondary>checking senders</secondary>
30432 If this option is set, the router is skipped unless the message’s sender
30433 address matches something on the list.
30434 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30438 There are issues concerning verification when the running of routers is
30439 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
30440 setting, it sets the sender to the null string. When using the <option>-bt</option> option
30441 to check a configuration file, it is necessary also to use the <option>-f</option> option to
30442 set an appropriate sender. For incoming mail, the sender is unset when
30443 verifying the sender, but is available when verifying any recipients. If the
30444 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
30448 <indexterm role="option">
30449 <primary><option>translate_ip_address</option></primary>
30452 <informaltable frame="all">
30453 <tgroup cols="4" colsep="0" rowsep="0">
30454 <colspec colwidth="8*" align="left"/>
30455 <colspec colwidth="6*" align="center"/>
30456 <colspec colwidth="6*" align="center"/>
30457 <colspec colwidth="6*" align="right"/>
30460 <entry><option>translate_ip_address</option></entry>
30461 <entry>Use: <emphasis>routers</emphasis></entry>
30462 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
30463 <entry>Default: <emphasis>unset</emphasis></entry>
30469 <indexterm role="concept">
30470 <primary>IP address</primary>
30471 <secondary>translating</secondary>
30473 <indexterm role="concept">
30474 <primary>packet radio</primary>
30476 <indexterm role="concept">
30477 <primary>router</primary>
30478 <secondary>IP address translation</secondary>
30480 There exist some rare networking situations (for example, packet radio) where
30481 it is helpful to be able to translate IP addresses generated by normal routing
30482 mechanisms into other IP addresses, thus performing a kind of manual IP
30483 routing. This should be done only if the normal IP routing of the TCP/IP stack
30484 is inadequate or broken. Because this is an extremely uncommon requirement, the
30485 code to support this option is not included in the Exim binary unless
30486 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
30489 <indexterm role="variable">
30490 <primary><varname>$host_address</varname></primary>
30492 The <option>translate_ip_address</option> string is expanded for every IP address generated
30493 by the router, with the generated address set in <varname>$host_address</varname>. If the
30494 expansion is forced to fail, no action is taken.
30495 For any other expansion error, delivery of the message is deferred.
30496 If the result of the expansion is an IP address, that replaces the original
30497 address; otherwise the result is assumed to be a host name – this is looked
30498 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
30499 produce one or more replacement IP addresses. For example, to subvert all IP
30500 addresses in some specific networks, this could be added to a router:
30502 <literallayout class="monospaced">
30503 translate_ip_address = \
30504 ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
30508 The file would contain lines like
30510 <literallayout class="monospaced">
30511 10.2.3.128/26 some.host
30512 10.8.4.34/26 10.44.8.15
30515 You should not make use of this facility unless you really understand what you
30519 <indexterm role="option">
30520 <primary><option>transport</option></primary>
30523 <informaltable frame="all">
30524 <tgroup cols="4" colsep="0" rowsep="0">
30525 <colspec colwidth="8*" align="left"/>
30526 <colspec colwidth="6*" align="center"/>
30527 <colspec colwidth="6*" align="center"/>
30528 <colspec colwidth="6*" align="right"/>
30531 <entry><option>transport</option></entry>
30532 <entry>Use: <emphasis>routers</emphasis></entry>
30533 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
30534 <entry>Default: <emphasis>unset</emphasis></entry>
30540 This option specifies the transport to be used when a router accepts an address
30541 and sets it up for delivery. A transport is never needed if a router is used
30542 only for verification. The value of the option is expanded at routing time,
30543 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
30544 and result must be the name of one of the configured transports. If it is not,
30545 delivery is deferred.
30548 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
30549 have some private options that set up transports for pipe and file deliveries
30550 (see chapter <xref linkend="CHAPredirect"/>).
30553 <indexterm role="option">
30554 <primary><option>transport_current_directory</option></primary>
30557 <informaltable frame="all">
30558 <tgroup cols="4" colsep="0" rowsep="0">
30559 <colspec colwidth="8*" align="left"/>
30560 <colspec colwidth="6*" align="center"/>
30561 <colspec colwidth="6*" align="center"/>
30562 <colspec colwidth="6*" align="right"/>
30565 <entry><option>transport_current_directory</option></entry>
30566 <entry>Use: <emphasis>routers</emphasis></entry>
30567 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
30568 <entry>Default: <emphasis>unset</emphasis></entry>
30574 <indexterm role="concept">
30575 <primary>current directory for local transport</primary>
30577 This option associates a current directory with any address that is routed
30578 to a local transport. This can happen either because a transport is
30579 explicitly configured for the router, or because it generates a delivery to a
30580 file or a pipe. During the delivery process (that is, at transport time), this
30581 option string is expanded and is set as the current directory, unless
30582 overridden by a setting on the transport.
30583 If the expansion fails for any reason, including forced failure, an error is
30584 logged, and delivery is deferred.
30585 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
30589 <indexterm role="option">
30590 <primary><option>transport_home_directory</option></primary>
30593 <informaltable frame="all">
30594 <tgroup cols="4" colsep="0" rowsep="0">
30595 <colspec colwidth="8*" align="left"/>
30596 <colspec colwidth="6*" align="center"/>
30597 <colspec colwidth="6*" align="center"/>
30598 <colspec colwidth="6*" align="right"/>
30601 <entry><option>transport_home_directory</option></entry>
30602 <entry>Use: <emphasis>routers</emphasis></entry>
30603 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
30604 <entry>Default: <emphasis>see below</emphasis></entry>
30610 <indexterm role="concept">
30611 <primary>home directory</primary>
30612 <secondary>for local transport</secondary>
30614 This option associates a home directory with any address that is routed to a
30615 local transport. This can happen either because a transport is explicitly
30616 configured for the router, or because it generates a delivery to a file or a
30617 pipe. During the delivery process (that is, at transport time), the option
30618 string is expanded and is set as the home directory, unless overridden by a
30619 setting of <option>home_directory</option> on the transport.
30620 If the expansion fails for any reason, including forced failure, an error is
30621 logged, and delivery is deferred.
30624 If the transport does not specify a home directory, and
30625 <option>transport_home_directory</option> is not set for the router, the home directory for
30626 the transport is taken from the password data if <option>check_local_user</option> is set for
30627 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
30628 is set; if not, no home directory is set for the transport.
30631 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
30635 <indexterm role="option">
30636 <primary><option>unseen</option></primary>
30639 <informaltable frame="all">
30640 <tgroup cols="4" colsep="0" rowsep="0">
30641 <colspec colwidth="8*" align="left"/>
30642 <colspec colwidth="6*" align="center"/>
30643 <colspec colwidth="6*" align="center"/>
30644 <colspec colwidth="6*" align="right"/>
30647 <entry><option>unseen</option></entry>
30648 <entry>Use: <emphasis>routers</emphasis></entry>
30649 <entry>Type: <emphasis>boolean</emphasis>†<emphasis></emphasis></entry>
30650 <entry>Default: <emphasis>false</emphasis></entry>
30656 <indexterm role="concept">
30657 <primary>router</primary>
30658 <secondary>carrying on after success</secondary>
30660 The result of string expansion for this option must be a valid boolean value,
30661 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
30662 result causes an error, and delivery is deferred. If the expansion is forced to
30663 fail, the default value for the option (false) is used. Other failures cause
30664 delivery to be deferred.
30667 When this option is set true, routing does not cease if the router accepts the
30668 address. Instead, a copy of the incoming address is passed to the next router,
30669 overriding a false setting of <option>more</option>. There is little point in setting
30670 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
30671 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
30672 sometimes true and sometimes false).
30675 <indexterm role="concept">
30676 <primary>copy of message (<option>unseen</option> option)</primary>
30678 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
30679 qualifier in filter files. It can be used to cause copies of messages to be
30680 delivered to some other destination, while also carrying out a normal delivery.
30681 In effect, the current address is made into a <quote>parent</quote> that has two children
30682 – one that is delivered as specified by this router, and a clone that goes on
30683 to be routed further. For this reason, <option>unseen</option> may not be combined with the
30684 <option>one_time</option> option in a <command>redirect</command> router.
30687 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
30688 this router or by previous routers affect the <quote>unseen</quote> copy of the message
30689 only. The clone that continues to be processed by further routers starts with
30690 no added headers and none specified for removal. For a <option>redirect</option> router, if
30691 a generated address is the same as the incoming address, this can lead to
30692 duplicate addresses with different header modifications. Exim does not do
30693 duplicate deliveries (except, in certain circumstances, to pipes -- see section
30694 <xref linkend="SECTdupaddr"/>), but it is undefined which of the duplicates is discarded,
30695 so this ambiguous situation should be avoided. The <option>repeat_use</option> option of the
30696 <option>redirect</option> router may be of help.
30699 Unlike the handling of header modifications, any data that was set by the
30700 <option>address_data</option> option in the current or previous routers <emphasis>is</emphasis> passed on to
30701 subsequent routers.
30704 <indexterm role="option">
30705 <primary><option>user</option></primary>
30708 <informaltable frame="all">
30709 <tgroup cols="4" colsep="0" rowsep="0">
30710 <colspec colwidth="8*" align="left"/>
30711 <colspec colwidth="6*" align="center"/>
30712 <colspec colwidth="6*" align="center"/>
30713 <colspec colwidth="6*" align="right"/>
30716 <entry><option>user</option></entry>
30717 <entry>Use: <emphasis>routers</emphasis></entry>
30718 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
30719 <entry>Default: <emphasis>see below</emphasis></entry>
30725 <indexterm role="concept">
30726 <primary>uid (user id)</primary>
30727 <secondary>local delivery</secondary>
30729 <indexterm role="concept">
30730 <primary>local transports</primary>
30731 <secondary>uid and gid</secondary>
30733 <indexterm role="concept">
30734 <primary>transport</primary>
30735 <secondary>local</secondary>
30737 <indexterm role="concept">
30738 <primary>router</primary>
30739 <secondary>user for filter processing</secondary>
30741 <indexterm role="concept">
30742 <primary>filter</primary>
30743 <secondary>user for processing</secondary>
30745 When a router queues an address for a transport, and the transport does not
30746 specify a user, the user given here is used when running the delivery process.
30747 The user may be specified numerically or by name. If expansion fails, the
30748 error is logged and delivery is deferred.
30749 This user is also used by the <command>redirect</command> router when running a filter file.
30750 The default is unset, except when <option>check_local_user</option> is set. In this case,
30751 the default is taken from the password information. If the user is specified as
30752 a name, and <option>group</option> is not set, the group associated with the user is used.
30753 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
30754 <xref linkend="CHAPenvironment"/>.
30757 <indexterm role="option">
30758 <primary><option>verify</option></primary>
30761 <informaltable frame="all">
30762 <tgroup cols="4" colsep="0" rowsep="0">
30763 <colspec colwidth="8*" align="left"/>
30764 <colspec colwidth="6*" align="center"/>
30765 <colspec colwidth="6*" align="center"/>
30766 <colspec colwidth="6*" align="right"/>
30769 <entry><option>verify</option></entry>
30770 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
30771 <entry>Type: <emphasis>boolean</emphasis></entry>
30772 <entry>Default: <emphasis>true</emphasis></entry>
30778 Setting this option has the effect of setting <option>verify_sender</option> and
30779 <option>verify_recipient</option> to the same value.
30782 <indexterm role="option">
30783 <primary><option>verify_only</option></primary>
30786 <informaltable frame="all">
30787 <tgroup cols="4" colsep="0" rowsep="0">
30788 <colspec colwidth="8*" align="left"/>
30789 <colspec colwidth="6*" align="center"/>
30790 <colspec colwidth="6*" align="center"/>
30791 <colspec colwidth="6*" align="right"/>
30794 <entry><option>verify_only</option></entry>
30795 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
30796 <entry>Type: <emphasis>boolean</emphasis></entry>
30797 <entry>Default: <emphasis>false</emphasis></entry>
30803 <indexterm role="concept">
30804 <primary>EXPN</primary>
30805 <secondary>with <option>verify_only</option></secondary>
30807 <indexterm role="option">
30808 <primary><option>-bv</option></primary>
30810 <indexterm role="concept">
30811 <primary>router</primary>
30812 <secondary>used only when verifying</secondary>
30814 If this option is set, the router is used only when verifying an address or
30815 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
30816 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
30817 restricted to verifying only senders or recipients by means of
30818 <option>verify_sender</option> and <option>verify_recipient</option>.
30821 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
30822 SMTP message, Exim is not running as root, but under its own uid. If the router
30823 accesses any files, you need to make sure that they are accessible to the Exim
30827 <indexterm role="option">
30828 <primary><option>verify_recipient</option></primary>
30831 <informaltable frame="all">
30832 <tgroup cols="4" colsep="0" rowsep="0">
30833 <colspec colwidth="8*" align="left"/>
30834 <colspec colwidth="6*" align="center"/>
30835 <colspec colwidth="6*" align="center"/>
30836 <colspec colwidth="6*" align="right"/>
30839 <entry><option>verify_recipient</option></entry>
30840 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
30841 <entry>Type: <emphasis>boolean</emphasis></entry>
30842 <entry>Default: <emphasis>true</emphasis></entry>
30848 If this option is false, the router is skipped when verifying recipient
30850 or testing recipient verification using <option>-bv</option>.
30851 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30855 <indexterm role="option">
30856 <primary><option>verify_sender</option></primary>
30859 <informaltable frame="all">
30860 <tgroup cols="4" colsep="0" rowsep="0">
30861 <colspec colwidth="8*" align="left"/>
30862 <colspec colwidth="6*" align="center"/>
30863 <colspec colwidth="6*" align="center"/>
30864 <colspec colwidth="6*" align="right"/>
30867 <entry><option>verify_sender</option></entry>
30868 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
30869 <entry>Type: <emphasis>boolean</emphasis></entry>
30870 <entry>Default: <emphasis>true</emphasis></entry>
30876 If this option is false, the router is skipped when verifying sender addresses
30877 or testing sender verification using <option>-bvs</option>.
30878 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30880 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
30881 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
30885 <chapter id="CHID4">
30886 <title>The accept router</title>
30888 <indexterm role="concept">
30889 <primary><command>accept</command> router</primary>
30891 <indexterm role="concept">
30892 <primary>routers</primary>
30893 <secondary><command>accept</command></secondary>
30895 The <command>accept</command> router has no private options of its own. Unless it is being
30896 used purely for verification (see <option>verify_only</option>) a transport is required to
30897 be defined by the generic <option>transport</option> option. If the preconditions that are
30898 specified by generic options are met, the router accepts the address and queues
30899 it for the given transport. The most common use of this router is for setting
30900 up deliveries to local mailboxes. For example:
30902 <literallayout class="monospaced">
30905 domains = mydomain.example
30907 transport = local_delivery
30910 The <option>domains</option> condition in this example checks the domain of the address, and
30911 <option>check_local_user</option> checks that the local part is the login of a local user.
30912 When both preconditions are met, the <command>accept</command> router runs, and queues the
30913 address for the <command>local_delivery</command> transport.
30917 <chapter id="CHAPdnslookup">
30918 <title>The dnslookup router</title>
30920 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
30921 <primary><command>dnslookup</command> router</primary>
30923 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
30924 <primary>routers</primary>
30925 <secondary><command>dnslookup</command></secondary>
30927 The <command>dnslookup</command> router looks up the hosts that handle mail for the
30928 recipient’s domain in the DNS. A transport must always be set for this router,
30929 unless <option>verify_only</option> is set.
30932 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
30933 SRV records. If none are found, or if SRV support is not configured,
30934 MX records are looked up. If no MX records exist, address records are sought.
30935 However, <option>mx_domains</option> can be set to disable the direct use of address
30939 MX records of equal priority are sorted by Exim into a random order. Exim then
30940 looks for address records for the host names obtained from MX or SRV records.
30941 When a host has more than one IP address, they are sorted into a random order,
30942 except that IPv6 addresses are always sorted before IPv4 addresses. If all the
30943 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
30944 generic option, the router declines.
30947 Unless they have the highest priority (lowest MX value), MX records that point
30948 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
30949 are discarded, together with any other MX records of equal or lower priority.
30952 <indexterm role="concept">
30953 <primary>MX record</primary>
30954 <secondary>pointing to local host</secondary>
30956 <indexterm role="concept">
30957 <primary>local host</primary>
30958 <secondary>MX pointing to</secondary>
30960 <indexterm role="option">
30961 <primary><option>self</option></primary>
30962 <secondary>in <command>dnslookup</command> router</secondary>
30964 If the host pointed to by the highest priority MX record, or looked up as an
30965 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
30966 happens is controlled by the generic <option>self</option> option.
30968 <section id="SECTprowitdnsloo">
30969 <title>Problems with DNS lookups</title>
30971 There have been problems with DNS servers when SRV records are looked up.
30972 Some mis-behaving servers return a DNS error or timeout when a non-existent
30973 SRV record is sought. Similar problems have in the past been reported for
30974 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
30975 problem, but it is heavy-handed because it is a global option.
30978 For this reason, there are two options, <option>srv_fail_domains</option> and
30979 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
30980 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
30981 an attempt to look up an SRV or MX record causes one of these results, and the
30982 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
30983 such record</quote>. In the case of an SRV lookup, this means that the router
30984 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
30985 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
30986 case routing fails.
30989 <section id="SECID118">
30990 <title>Private options for dnslookup</title>
30992 <indexterm role="concept">
30993 <primary>options</primary>
30994 <secondary><command>dnslookup</command> router</secondary>
30996 The private options for the <command>dnslookup</command> router are as follows:
30999 <indexterm role="option">
31000 <primary><option>check_secondary_mx</option></primary>
31003 <informaltable frame="all">
31004 <tgroup cols="4" colsep="0" rowsep="0">
31005 <colspec colwidth="8*" align="left"/>
31006 <colspec colwidth="6*" align="center"/>
31007 <colspec colwidth="6*" align="center"/>
31008 <colspec colwidth="6*" align="right"/>
31011 <entry><option>check_secondary_mx</option></entry>
31012 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31013 <entry>Type: <emphasis>boolean</emphasis></entry>
31014 <entry>Default: <emphasis>false</emphasis></entry>
31020 <indexterm role="concept">
31021 <primary>MX record</primary>
31022 <secondary>checking for secondary</secondary>
31024 If this option is set, the router declines unless the local host is found in
31025 (and removed from) the list of hosts obtained by MX lookup. This can be used to
31026 process domains for which the local host is a secondary mail exchanger
31027 differently to other domains. The way in which Exim decides whether a host is
31028 the local host is described in section <xref linkend="SECTreclocipadd"/>.
31031 <indexterm role="option">
31032 <primary><option>check_srv</option></primary>
31035 <informaltable frame="all">
31036 <tgroup cols="4" colsep="0" rowsep="0">
31037 <colspec colwidth="8*" align="left"/>
31038 <colspec colwidth="6*" align="center"/>
31039 <colspec colwidth="6*" align="center"/>
31040 <colspec colwidth="6*" align="right"/>
31043 <entry><option>check_srv</option></entry>
31044 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31045 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
31046 <entry>Default: <emphasis>unset</emphasis></entry>
31052 <indexterm role="concept">
31053 <primary>SRV record</primary>
31054 <secondary>enabling use of</secondary>
31056 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
31057 addition to MX and address records. The support is disabled by default. To
31058 enable SRV support, set the <option>check_srv</option> option to the name of the service
31059 required. For example,
31061 <literallayout class="monospaced">
31065 looks for SRV records that refer to the normal smtp service. The option is
31066 expanded, so the service name can vary from message to message or address
31067 to address. This might be helpful if SRV records are being used for a
31068 submission service. If the expansion is forced to fail, the <option>check_srv</option>
31069 option is ignored, and the router proceeds to look for MX records in the
31073 When the expansion succeeds, the router searches first for SRV records for
31074 the given service (it assumes TCP protocol). A single SRV record with a
31075 host name that consists of just a single dot indicates <quote>no such service for
31076 this domain</quote>; if this is encountered, the router declines. If other kinds of
31077 SRV record are found, they are used to construct a host list for delivery
31078 according to the rules of RFC 2782. MX records are not sought in this case.
31081 When no SRV records are found, MX records (and address records) are sought in
31082 the traditional way. In other words, SRV records take precedence over MX
31083 records, just as MX records take precedence over address records. Note that
31084 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
31085 defined it. It is apparently believed that MX records are sufficient for email
31086 and that SRV records should not be used for this purpose. However, SRV records
31087 have an additional <quote>weight</quote> feature which some people might find useful when
31088 trying to split an SMTP load between hosts of different power.
31091 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim’s behaviour
31092 when there is a DNS lookup error.
31095 <indexterm role="option">
31096 <primary><option>mx_domains</option></primary>
31099 <informaltable frame="all">
31100 <tgroup cols="4" colsep="0" rowsep="0">
31101 <colspec colwidth="8*" align="left"/>
31102 <colspec colwidth="6*" align="center"/>
31103 <colspec colwidth="6*" align="center"/>
31104 <colspec colwidth="6*" align="right"/>
31107 <entry><option>mx_domains</option></entry>
31108 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31109 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
31110 <entry>Default: <emphasis>unset</emphasis></entry>
31116 <indexterm role="concept">
31117 <primary>MX record</primary>
31118 <secondary>required to exist</secondary>
31120 <indexterm role="concept">
31121 <primary>SRV record</primary>
31122 <secondary>required to exist</secondary>
31124 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
31125 record in order to be recognized. (The name of this option could be improved.)
31126 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
31127 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
31130 <literallayout class="monospaced">
31131 mx_domains = ! *.discworld.fict.example : *.fict.example
31134 This specifies that messages addressed to a domain that matches the list but
31135 has no MX record should be bounced immediately instead of being routed using
31136 the address record.
31139 <indexterm role="option">
31140 <primary><option>mx_fail_domains</option></primary>
31143 <informaltable frame="all">
31144 <tgroup cols="4" colsep="0" rowsep="0">
31145 <colspec colwidth="8*" align="left"/>
31146 <colspec colwidth="6*" align="center"/>
31147 <colspec colwidth="6*" align="center"/>
31148 <colspec colwidth="6*" align="right"/>
31151 <entry><option>mx_fail_domains</option></entry>
31152 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31153 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
31154 <entry>Default: <emphasis>unset</emphasis></entry>
31160 If the DNS lookup for MX records for one of the domains in this list causes a
31161 DNS lookup error, Exim behaves as if no MX records were found. See section
31162 <xref linkend="SECTprowitdnsloo"/> for more discussion.
31165 <indexterm role="option">
31166 <primary><option>qualify_single</option></primary>
31169 <informaltable frame="all">
31170 <tgroup cols="4" colsep="0" rowsep="0">
31171 <colspec colwidth="8*" align="left"/>
31172 <colspec colwidth="6*" align="center"/>
31173 <colspec colwidth="6*" align="center"/>
31174 <colspec colwidth="6*" align="right"/>
31177 <entry><option>qualify_single</option></entry>
31178 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31179 <entry>Type: <emphasis>boolean</emphasis></entry>
31180 <entry>Default: <emphasis>true</emphasis></entry>
31186 <indexterm role="concept">
31187 <primary>DNS</primary>
31188 <secondary>resolver options</secondary>
31190 <indexterm role="concept">
31191 <primary>DNS</primary>
31192 <secondary>qualifying single-component names</secondary>
31194 When this option is true, the resolver option RES_DEFNAMES is set for DNS
31195 lookups. Typically, but not standardly, this causes the resolver to qualify
31196 single-component names with the default domain. For example, on a machine
31197 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
31198 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
31199 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
31200 <emphasis>resolv.conf</emphasis>.
31203 <indexterm role="option">
31204 <primary><option>rewrite_headers</option></primary>
31207 <informaltable frame="all">
31208 <tgroup cols="4" colsep="0" rowsep="0">
31209 <colspec colwidth="8*" align="left"/>
31210 <colspec colwidth="6*" align="center"/>
31211 <colspec colwidth="6*" align="center"/>
31212 <colspec colwidth="6*" align="right"/>
31215 <entry><option>rewrite_headers</option></entry>
31216 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31217 <entry>Type: <emphasis>boolean</emphasis></entry>
31218 <entry>Default: <emphasis>true</emphasis></entry>
31224 <indexterm role="concept">
31225 <primary>rewriting</primary>
31226 <secondary>header lines</secondary>
31228 <indexterm role="concept">
31229 <primary>header lines</primary>
31230 <secondary>rewriting</secondary>
31232 If the domain name in the address that is being processed is not fully
31233 qualified, it may be expanded to its full form by a DNS lookup. For example, if
31234 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
31235 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
31236 occur as a result of setting the <option>widen_domains</option> option. If
31237 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
31238 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
31239 header lines of the message are rewritten with the full domain name.
31242 This option should be turned off only when it is known that no message is
31243 ever going to be sent outside an environment where the abbreviation makes
31247 When an MX record is looked up in the DNS and matches a wildcard record, name
31248 servers normally return a record containing the name that has been looked up,
31249 making it impossible to detect whether a wildcard was present or not. However,
31250 some name servers have recently been seen to return the wildcard entry. If the
31251 name returned by a DNS lookup begins with an asterisk, it is not used for
31255 <indexterm role="option">
31256 <primary><option>same_domain_copy_routing</option></primary>
31259 <informaltable frame="all">
31260 <tgroup cols="4" colsep="0" rowsep="0">
31261 <colspec colwidth="8*" align="left"/>
31262 <colspec colwidth="6*" align="center"/>
31263 <colspec colwidth="6*" align="center"/>
31264 <colspec colwidth="6*" align="right"/>
31267 <entry><option>same_domain_copy_routing</option></entry>
31268 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31269 <entry>Type: <emphasis>boolean</emphasis></entry>
31270 <entry>Default: <emphasis>false</emphasis></entry>
31276 <indexterm role="concept">
31277 <primary>address</primary>
31278 <secondary>copying routing</secondary>
31280 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
31281 to the same list of hosts. However, this cannot be presumed, because the router
31282 options and preconditions may refer to the local part of the address. By
31283 default, therefore, Exim routes each address in a message independently. DNS
31284 servers run caches, so repeated DNS lookups are not normally expensive, and in
31285 any case, personal messages rarely have more than a few recipients.
31288 If you are running mailing lists with large numbers of subscribers at the same
31289 domain, and you are using a <command>dnslookup</command> router which is independent of the
31290 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
31291 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
31292 routes an address to a remote transport, any other unrouted addresses in the
31293 message that have the same domain are automatically given the same routing
31294 without processing them independently,
31295 provided the following conditions are met:
31300 No router that processed the address specified <option>headers_add</option> or
31301 <option>headers_remove</option>.
31306 The router did not change the address in any way, for example, by <quote>widening</quote>
31312 <indexterm role="option">
31313 <primary><option>search_parents</option></primary>
31316 <informaltable frame="all">
31317 <tgroup cols="4" colsep="0" rowsep="0">
31318 <colspec colwidth="8*" align="left"/>
31319 <colspec colwidth="6*" align="center"/>
31320 <colspec colwidth="6*" align="center"/>
31321 <colspec colwidth="6*" align="right"/>
31324 <entry><option>search_parents</option></entry>
31325 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31326 <entry>Type: <emphasis>boolean</emphasis></entry>
31327 <entry>Default: <emphasis>false</emphasis></entry>
31333 <indexterm role="concept">
31334 <primary>DNS</primary>
31335 <secondary>resolver options</secondary>
31337 When this option is true, the resolver option RES_DNSRCH is set for DNS
31338 lookups. This is different from the <option>qualify_single</option> option in that it
31339 applies to domains containing dots. Typically, but not standardly, it causes
31340 the resolver to search for the name in the current domain and in parent
31341 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
31342 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
31343 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
31344 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
31347 Setting this option true can cause problems in domains that have a wildcard MX
31348 record, because any domain that does not have its own MX record matches the
31352 <indexterm role="option">
31353 <primary><option>srv_fail_domains</option></primary>
31356 <informaltable frame="all">
31357 <tgroup cols="4" colsep="0" rowsep="0">
31358 <colspec colwidth="8*" align="left"/>
31359 <colspec colwidth="6*" align="center"/>
31360 <colspec colwidth="6*" align="center"/>
31361 <colspec colwidth="6*" align="right"/>
31364 <entry><option>srv_fail_domains</option></entry>
31365 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31366 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
31367 <entry>Default: <emphasis>unset</emphasis></entry>
31373 If the DNS lookup for SRV records for one of the domains in this list causes a
31374 DNS lookup error, Exim behaves as if no SRV records were found. See section
31375 <xref linkend="SECTprowitdnsloo"/> for more discussion.
31378 <indexterm role="option">
31379 <primary><option>widen_domains</option></primary>
31382 <informaltable frame="all">
31383 <tgroup cols="4" colsep="0" rowsep="0">
31384 <colspec colwidth="8*" align="left"/>
31385 <colspec colwidth="6*" align="center"/>
31386 <colspec colwidth="6*" align="center"/>
31387 <colspec colwidth="6*" align="right"/>
31390 <entry><option>widen_domains</option></entry>
31391 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31392 <entry>Type: <emphasis>string list</emphasis></entry>
31393 <entry>Default: <emphasis>unset</emphasis></entry>
31399 <indexterm role="concept">
31400 <primary>domain</primary>
31401 <secondary>partial; widening</secondary>
31403 If a DNS lookup fails and this option is set, each of its strings in turn is
31404 added onto the end of the domain, and the lookup is tried again. For example,
31407 <literallayout class="monospaced">
31408 widen_domains = fict.example:ref.example
31411 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
31412 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
31413 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
31414 and <option>search_parents</option> options can cause some widening to be undertaken inside
31415 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
31416 when verifying, unless <option>rewrite_headers</option> is false (not the default).
31419 <section id="SECID119">
31420 <title>Effect of qualify_single and search_parents</title>
31422 When a domain from an envelope recipient is changed by the resolver as a result
31423 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
31424 corresponding address in the message’s header lines unless <option>rewrite_headers</option>
31425 is set false. Exim then re-routes the address, using the full domain.
31428 These two options affect only the DNS lookup that takes place inside the router
31429 for the domain of the address that is being routed. They do not affect lookups
31430 such as that implied by
31432 <literallayout class="monospaced">
31436 that may happen while processing a router precondition before the router is
31437 entered. No widening ever takes place for these lookups.
31438 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
31439 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
31444 <chapter id="CHID5">
31445 <title>The ipliteral router</title>
31447 <indexterm role="concept">
31448 <primary><command>ipliteral</command> router</primary>
31450 <indexterm role="concept">
31451 <primary>domain literal</primary>
31452 <secondary>routing</secondary>
31454 <indexterm role="concept">
31455 <primary>routers</primary>
31456 <secondary><command>ipliteral</command></secondary>
31458 This router has no private options. Unless it is being used purely for
31459 verification (see <option>verify_only</option>) a transport is required to be defined by the
31460 generic <option>transport</option> option. The router accepts the address if its domain part
31461 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
31462 router handles the address
31464 <literallayout class="monospaced">
31468 by setting up delivery to the host with that IP address. IPv4 domain literals
31469 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
31470 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
31472 <literallayout class="monospaced">
31473 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
31476 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
31477 grounds that sooner or later somebody will try it.
31480 <indexterm role="option">
31481 <primary><option>self</option></primary>
31482 <secondary>in <command>ipliteral</command> router</secondary>
31484 If the IP address matches something in <option>ignore_target_hosts</option>, the router
31485 declines. If an IP literal turns out to refer to the local host, the generic
31486 <option>self</option> option determines what happens.
31489 The RFCs require support for domain literals; however, their use is
31490 controversial in today’s Internet. If you want to use this router, you must
31491 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
31492 Exim will not recognize the domain literal syntax in addresses.
31496 <chapter id="CHID6">
31497 <title>The iplookup router</title>
31499 <indexterm role="concept">
31500 <primary><command>iplookup</command> router</primary>
31502 <indexterm role="concept">
31503 <primary>routers</primary>
31504 <secondary><command>iplookup</command></secondary>
31506 The <command>iplookup</command> router was written to fulfil a specific requirement in
31507 Cambridge University (which in fact no longer exists). For this reason, it is
31508 not included in the binary of Exim by default. If you want to include it, you
31511 <literallayout class="monospaced">
31512 ROUTER_IPLOOKUP=yes
31515 in your <filename>Local/Makefile</filename> configuration file.
31518 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
31519 connection to one or more specific hosts. The host can then return the same or
31520 a different address – in effect rewriting the recipient address in the
31521 message’s envelope. The new address is then passed on to subsequent routers. If
31522 this process fails, the address can be passed on to other routers, or delivery
31523 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
31524 must not be specified for it.
31527 <indexterm role="concept">
31528 <primary>options</primary>
31529 <secondary><command>iplookup</command> router</secondary>
31531 <indexterm role="option">
31532 <primary><option>hosts</option></primary>
31535 <informaltable frame="all">
31536 <tgroup cols="4" colsep="0" rowsep="0">
31537 <colspec colwidth="8*" align="left"/>
31538 <colspec colwidth="6*" align="center"/>
31539 <colspec colwidth="6*" align="center"/>
31540 <colspec colwidth="6*" align="right"/>
31543 <entry><option>hosts</option></entry>
31544 <entry>Use: <emphasis>iplookup</emphasis></entry>
31545 <entry>Type: <emphasis>string</emphasis></entry>
31546 <entry>Default: <emphasis>unset</emphasis></entry>
31552 This option must be supplied. Its value is a colon-separated list of host
31553 names. The hosts are looked up using <function>gethostbyname()</function>
31554 (or <function>getipnodebyname()</function> when available)
31555 and are tried in order until one responds to the query. If none respond, what
31556 happens is controlled by <option>optional</option>.
31559 <indexterm role="option">
31560 <primary><option>optional</option></primary>
31563 <informaltable frame="all">
31564 <tgroup cols="4" colsep="0" rowsep="0">
31565 <colspec colwidth="8*" align="left"/>
31566 <colspec colwidth="6*" align="center"/>
31567 <colspec colwidth="6*" align="center"/>
31568 <colspec colwidth="6*" align="right"/>
31571 <entry><option>optional</option></entry>
31572 <entry>Use: <emphasis>iplookup</emphasis></entry>
31573 <entry>Type: <emphasis>boolean</emphasis></entry>
31574 <entry>Default: <emphasis>false</emphasis></entry>
31580 If <option>optional</option> is true, if no response is obtained from any host, the address
31581 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
31582 delivery to the address is deferred.
31585 <indexterm role="option">
31586 <primary><option>port</option></primary>
31589 <informaltable frame="all">
31590 <tgroup cols="4" colsep="0" rowsep="0">
31591 <colspec colwidth="8*" align="left"/>
31592 <colspec colwidth="6*" align="center"/>
31593 <colspec colwidth="6*" align="center"/>
31594 <colspec colwidth="6*" align="right"/>
31597 <entry><option>port</option></entry>
31598 <entry>Use: <emphasis>iplookup</emphasis></entry>
31599 <entry>Type: <emphasis>integer</emphasis></entry>
31600 <entry>Default: <emphasis>0</emphasis></entry>
31606 <indexterm role="concept">
31607 <primary>port</primary>
31608 <secondary><command>iplookup</command> router</secondary>
31610 This option must be supplied. It specifies the port number for the TCP or UDP
31614 <indexterm role="option">
31615 <primary><option>protocol</option></primary>
31618 <informaltable frame="all">
31619 <tgroup cols="4" colsep="0" rowsep="0">
31620 <colspec colwidth="8*" align="left"/>
31621 <colspec colwidth="6*" align="center"/>
31622 <colspec colwidth="6*" align="center"/>
31623 <colspec colwidth="6*" align="right"/>
31626 <entry><option>protocol</option></entry>
31627 <entry>Use: <emphasis>iplookup</emphasis></entry>
31628 <entry>Type: <emphasis>string</emphasis></entry>
31629 <entry>Default: <emphasis>udp</emphasis></entry>
31635 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
31636 protocols is to be used.
31639 <indexterm role="option">
31640 <primary><option>query</option></primary>
31643 <informaltable frame="all">
31644 <tgroup cols="4" colsep="0" rowsep="0">
31645 <colspec colwidth="8*" align="left"/>
31646 <colspec colwidth="6*" align="center"/>
31647 <colspec colwidth="6*" align="center"/>
31648 <colspec colwidth="6*" align="right"/>
31651 <entry><option>query</option></entry>
31652 <entry>Use: <emphasis>iplookup</emphasis></entry>
31653 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
31654 <entry>Default: <emphasis>see below</emphasis></entry>
31660 This defines the content of the query that is sent to the remote hosts. The
31663 <literallayout class="monospaced">
31664 $local_part@$domain $local_part@$domain
31667 The repetition serves as a way of checking that a response is to the correct
31668 query in the default case (see <option>response_pattern</option> below).
31671 <indexterm role="option">
31672 <primary><option>reroute</option></primary>
31675 <informaltable frame="all">
31676 <tgroup cols="4" colsep="0" rowsep="0">
31677 <colspec colwidth="8*" align="left"/>
31678 <colspec colwidth="6*" align="center"/>
31679 <colspec colwidth="6*" align="center"/>
31680 <colspec colwidth="6*" align="right"/>
31683 <entry><option>reroute</option></entry>
31684 <entry>Use: <emphasis>iplookup</emphasis></entry>
31685 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
31686 <entry>Default: <emphasis>unset</emphasis></entry>
31692 If this option is not set, the rerouted address is precisely the byte string
31693 returned by the remote host, up to the first white space, if any. If set, the
31694 string is expanded to form the rerouted address. It can include parts matched
31695 in the response by <option>response_pattern</option> by means of numeric variables such as
31696 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
31697 whether or not a pattern is in use. In all cases, the rerouted address must end
31698 up in the form <emphasis>local_part@domain</emphasis>.
31701 <indexterm role="option">
31702 <primary><option>response_pattern</option></primary>
31705 <informaltable frame="all">
31706 <tgroup cols="4" colsep="0" rowsep="0">
31707 <colspec colwidth="8*" align="left"/>
31708 <colspec colwidth="6*" align="center"/>
31709 <colspec colwidth="6*" align="center"/>
31710 <colspec colwidth="6*" align="right"/>
31713 <entry><option>response_pattern</option></entry>
31714 <entry>Use: <emphasis>iplookup</emphasis></entry>
31715 <entry>Type: <emphasis>string</emphasis></entry>
31716 <entry>Default: <emphasis>unset</emphasis></entry>
31722 This option can be set to a regular expression that is applied to the string
31723 returned from the remote host. If the pattern does not match the response, the
31724 router declines. If <option>response_pattern</option> is not set, no checking of the
31725 response is done, unless the query was defaulted, in which case there is a
31726 check that the text returned after the first white space is the original
31727 address. This checks that the answer that has been received is in response to
31728 the correct question. For example, if the response is just a new domain, the
31729 following could be used:
31731 <literallayout class="monospaced">
31732 response_pattern = ^([^@]+)$
31733 reroute = $local_part@$1
31736 <indexterm role="option">
31737 <primary><option>timeout</option></primary>
31740 <informaltable frame="all">
31741 <tgroup cols="4" colsep="0" rowsep="0">
31742 <colspec colwidth="8*" align="left"/>
31743 <colspec colwidth="6*" align="center"/>
31744 <colspec colwidth="6*" align="center"/>
31745 <colspec colwidth="6*" align="right"/>
31748 <entry><option>timeout</option></entry>
31749 <entry>Use: <emphasis>iplookup</emphasis></entry>
31750 <entry>Type: <emphasis>time</emphasis></entry>
31751 <entry>Default: <emphasis>5s</emphasis></entry>
31757 This specifies the amount of time to wait for a response from the remote
31758 machine. The same timeout is used for the <function>connect()</function> function for a TCP
31759 call. It does not apply to UDP.
31763 <chapter id="CHID7">
31764 <title>The manualroute router</title>
31766 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
31767 <primary><command>manualroute</command> router</primary>
31769 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
31770 <primary>routers</primary>
31771 <secondary><command>manualroute</command></secondary>
31773 <indexterm role="concept">
31774 <primary>domain</primary>
31775 <secondary>manually routing</secondary>
31777 The <command>manualroute</command> router is so-called because it provides a way of manually
31778 routing an address according to its domain. It is mainly used when you want to
31779 route addresses to remote hosts according to your own rules, bypassing the
31780 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
31781 route to local transports, a facility that may be useful if you want to save
31782 messages for dial-in hosts in local files.
31785 The <command>manualroute</command> router compares a list of domain patterns with the domain
31786 it is trying to route. If there is no match, the router declines. Each pattern
31787 has associated with it a list of hosts and some other optional data, which may
31788 include a transport. The combination of a pattern and its data is called a
31789 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
31790 generic <option>transport</option> option must specify a transport, unless the router is
31791 being used purely for verification (see <option>verify_only</option>).
31794 <indexterm role="variable">
31795 <primary><varname>$host</varname></primary>
31797 In the case of verification, matching the domain pattern is sufficient for the
31798 router to accept the address. When actually routing an address for delivery,
31799 an address that matches a domain pattern is queued for the associated
31800 transport. If the transport is not a local one, a host list must be associated
31801 with the pattern; IP addresses are looked up for the hosts, and these are
31802 passed to the transport along with the mail address. For local transports, a
31803 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
31807 The list of routing rules can be provided as an inline string in
31808 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
31809 or database by setting <option>route_data</option>. Only one of these settings may appear in
31810 any one instance of <command>manualroute</command>. The format of routing rules is described
31811 below, following the list of private options.
31813 <section id="SECTprioptman">
31814 <title>Private options for manualroute</title>
31816 <indexterm role="concept">
31817 <primary>options</primary>
31818 <secondary><command>manualroute</command> router</secondary>
31820 The private options for the <command>manualroute</command> router are as follows:
31823 <indexterm role="option">
31824 <primary><option>host_all_ignored</option></primary>
31827 <informaltable frame="all">
31828 <tgroup cols="4" colsep="0" rowsep="0">
31829 <colspec colwidth="8*" align="left"/>
31830 <colspec colwidth="6*" align="center"/>
31831 <colspec colwidth="6*" align="center"/>
31832 <colspec colwidth="6*" align="right"/>
31835 <entry><option>host_all_ignored</option></entry>
31836 <entry>Use: <emphasis>manualroute</emphasis></entry>
31837 <entry>Type: <emphasis>string</emphasis></entry>
31838 <entry>Default: <emphasis>defer</emphasis></entry>
31844 See <option>host_find_failed</option>.
31847 <indexterm role="option">
31848 <primary><option>host_find_failed</option></primary>
31851 <informaltable frame="all">
31852 <tgroup cols="4" colsep="0" rowsep="0">
31853 <colspec colwidth="8*" align="left"/>
31854 <colspec colwidth="6*" align="center"/>
31855 <colspec colwidth="6*" align="center"/>
31856 <colspec colwidth="6*" align="right"/>
31859 <entry><option>host_find_failed</option></entry>
31860 <entry>Use: <emphasis>manualroute</emphasis></entry>
31861 <entry>Type: <emphasis>string</emphasis></entry>
31862 <entry>Default: <emphasis>freeze</emphasis></entry>
31868 This option controls what happens when <command>manualroute</command> tries to find an IP
31869 address for a host, and the host does not exist. The option can be set to one
31870 of the following values:
31872 <literallayout class="monospaced">
31881 The default (<quote>freeze</quote>) assumes that this state is a serious configuration
31882 error. The difference between <quote>pass</quote> and <quote>decline</quote> is that the former
31883 forces the address to be passed to the next router (or the router defined by
31884 <option>pass_router</option>),
31885 <indexterm role="option">
31886 <primary><option>more</option></primary>
31888 overriding <option>no_more</option>, whereas the latter passes the address to the next
31889 router only if <option>more</option> is true.
31892 The value <quote>ignore</quote> causes Exim to completely ignore a host whose IP address
31893 cannot be found. If all the hosts in the list are ignored, the behaviour is
31894 controlled by the <option>host_all_ignored</option> option. This takes the same values
31895 as <option>host_find_failed</option>, except that it cannot be set to <quote>ignore</quote>.
31898 The <option>host_find_failed</option> option applies only to a definite <quote>does not exist</quote>
31899 state; if a host lookup gets a temporary error, delivery is deferred unless the
31900 generic <option>pass_on_timeout</option> option is set.
31903 <indexterm role="option">
31904 <primary><option>hosts_randomize</option></primary>
31907 <informaltable frame="all">
31908 <tgroup cols="4" colsep="0" rowsep="0">
31909 <colspec colwidth="8*" align="left"/>
31910 <colspec colwidth="6*" align="center"/>
31911 <colspec colwidth="6*" align="center"/>
31912 <colspec colwidth="6*" align="right"/>
31915 <entry><option>hosts_randomize</option></entry>
31916 <entry>Use: <emphasis>manualroute</emphasis></entry>
31917 <entry>Type: <emphasis>boolean</emphasis></entry>
31918 <entry>Default: <emphasis>false</emphasis></entry>
31924 <indexterm role="concept">
31925 <primary>randomized host list</primary>
31927 <indexterm role="concept">
31928 <primary>host</primary>
31929 <secondary>list of; randomized</secondary>
31931 If this option is set, the order of the items in a host list in a routing rule
31932 is randomized each time the list is used, unless an option in the routing rule
31933 overrides (see below). Randomizing the order of a host list can be used to do
31934 crude load sharing. However, if more than one mail address is routed by the
31935 same router to the same host list, the host lists are considered to be the same
31936 (even though they may be randomized into different orders) for the purpose of
31937 deciding whether to batch the deliveries into a single SMTP transaction.
31940 When <option>hosts_randomize</option> is true, a host list may be split
31941 into groups whose order is separately randomized. This makes it possible to
31942 set up MX-like behaviour. The boundaries between groups are indicated by an
31943 item that is just <literal>+</literal> in the host list. For example:
31945 <literallayout class="monospaced">
31946 route_list = * host1:host2:host3:+:host4:host5
31949 The order of the first three hosts and the order of the last two hosts is
31950 randomized for each use, but the first three always end up before the last two.
31951 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
31952 randomized host list is passed to an <command>smtp</command> transport that also has
31953 <option>hosts_randomize set</option>, the list is not re-randomized.
31956 <indexterm role="option">
31957 <primary><option>route_data</option></primary>
31960 <informaltable frame="all">
31961 <tgroup cols="4" colsep="0" rowsep="0">
31962 <colspec colwidth="8*" align="left"/>
31963 <colspec colwidth="6*" align="center"/>
31964 <colspec colwidth="6*" align="center"/>
31965 <colspec colwidth="6*" align="right"/>
31968 <entry><option>route_data</option></entry>
31969 <entry>Use: <emphasis>manualroute</emphasis></entry>
31970 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
31971 <entry>Default: <emphasis>unset</emphasis></entry>
31977 If this option is set, it must expand to yield the data part of a routing rule.
31978 Typically, the expansion string includes a lookup based on the domain. For
31981 <literallayout class="monospaced">
31982 route_data = ${lookup{$domain}dbm{/etc/routes}}
31985 If the expansion is forced to fail, or the result is an empty string, the
31986 router declines. Other kinds of expansion failure cause delivery to be
31990 <indexterm role="option">
31991 <primary><option>route_list</option></primary>
31994 <informaltable frame="all">
31995 <tgroup cols="4" colsep="0" rowsep="0">
31996 <colspec colwidth="8*" align="left"/>
31997 <colspec colwidth="6*" align="center"/>
31998 <colspec colwidth="6*" align="center"/>
31999 <colspec colwidth="6*" align="right"/>
32002 <entry><option>route_list</option></entry>
32003 <entry>Use: <emphasis>manualroute</emphasis></entry>
32004 <entry>Type: <emphasis>string list</emphasis></entry>
32005 <entry>Default: <emphasis>unset</emphasis></entry>
32011 This string is a list of routing rules, in the form defined below. Note that,
32012 unlike most string lists, the items are separated by semicolons. This is so
32013 that they may contain colon-separated host lists.
32016 <indexterm role="option">
32017 <primary><option>same_domain_copy_routing</option></primary>
32020 <informaltable frame="all">
32021 <tgroup cols="4" colsep="0" rowsep="0">
32022 <colspec colwidth="8*" align="left"/>
32023 <colspec colwidth="6*" align="center"/>
32024 <colspec colwidth="6*" align="center"/>
32025 <colspec colwidth="6*" align="right"/>
32028 <entry><option>same_domain_copy_routing</option></entry>
32029 <entry>Use: <emphasis>manualroute</emphasis></entry>
32030 <entry>Type: <emphasis>boolean</emphasis></entry>
32031 <entry>Default: <emphasis>false</emphasis></entry>
32037 <indexterm role="concept">
32038 <primary>address</primary>
32039 <secondary>copying routing</secondary>
32041 Addresses with the same domain are normally routed by the <command>manualroute</command>
32042 router to the same list of hosts. However, this cannot be presumed, because the
32043 router options and preconditions may refer to the local part of the address. By
32044 default, therefore, Exim routes each address in a message independently. DNS
32045 servers run caches, so repeated DNS lookups are not normally expensive, and in
32046 any case, personal messages rarely have more than a few recipients.
32049 If you are running mailing lists with large numbers of subscribers at the same
32050 domain, and you are using a <command>manualroute</command> router which is independent of the
32051 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
32052 lookups for identical domains in one message. In this case, when
32053 <command>manualroute</command> routes an address to a remote transport, any other unrouted
32054 addresses in the message that have the same domain are automatically given the
32055 same routing without processing them independently. However, this is only done
32056 if <option>headers_add</option> and <option>headers_remove</option> are unset.
32059 <section id="SECID120">
32060 <title>Routing rules in route_list</title>
32062 The value of <option>route_list</option> is a string consisting of a sequence of routing
32063 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
32064 entered as two semicolons. Alternatively, the list separator can be changed as
32065 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
32066 Empty rules are ignored. The format of each rule is
32069 <<emphasis>domain pattern</emphasis>> <<emphasis>list of hosts</emphasis>> <<emphasis>options</emphasis>>
32072 The following example contains two rules, each with a simple domain pattern and
32075 <literallayout class="monospaced">
32077 dict.ref.example mail-1.ref.example:mail-2.ref.example ; \
32078 thes.ref.example mail-3.ref.example:mail-4.ref.example
32081 The three parts of a rule are separated by white space. The pattern and the
32082 list of hosts can be enclosed in quotes if necessary, and if they are, the
32083 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
32084 single domain pattern, which is the only mandatory item in the rule. The
32085 pattern is in the same format as one item in a domain list (see section
32086 <xref linkend="SECTdomainlist"/>),
32087 except that it may not be the name of an interpolated file.
32088 That is, it may be wildcarded, or a regular expression, or a file or database
32089 lookup (with semicolons doubled, because of the use of semicolon as a separator
32090 in a <option>route_list</option>).
32093 The rules in <option>route_list</option> are searched in order until one of the patterns
32094 matches the domain that is being routed. The list of hosts and then options are
32095 then used as described below. If there is no match, the router declines. When
32096 <option>route_list</option> is set, <option>route_data</option> must not be set.
32099 <section id="SECID121">
32100 <title>Routing rules in route_data</title>
32102 The use of <option>route_list</option> is convenient when there are only a small number of
32103 routing rules. For larger numbers, it is easier to use a file or database to
32104 hold the routing information, and use the <option>route_data</option> option instead.
32105 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
32106 Most commonly, <option>route_data</option> is set as a string that contains an
32107 expansion lookup. For example, suppose we place two routing rules in a file
32110 <literallayout class="monospaced">
32111 dict.ref.example: mail-1.ref.example:mail-2.ref.example
32112 thes.ref.example: mail-3.ref.example:mail-4.ref.example
32115 This data can be accessed by setting
32117 <literallayout class="monospaced">
32118 route_data = ${lookup{$domain}lsearch{/the/file/name}}
32121 Failure of the lookup results in an empty string, causing the router to
32122 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
32123 requirement is that the result of expanding the string is a list of hosts,
32124 possibly followed by options, separated by white space. The list of hosts must
32125 be enclosed in quotes if it contains white space.
32128 <section id="SECID122">
32129 <title>Format of the list of hosts</title>
32131 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
32132 always separately expanded before use. If the expansion fails, the router
32133 declines. The result of the expansion must be a colon-separated list of names
32134 and/or IP addresses, optionally also including ports. The format of each item
32135 in the list is described in the next section. The list separator can be changed
32136 as described in section <xref linkend="SECTlistconstruct"/>.
32139 If the list of hosts was obtained from a <option>route_list</option> item, the following
32140 variables are set during its expansion:
32145 <indexterm role="concept">
32146 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
32147 <secondary>in <command>manualroute</command> router</secondary>
32149 If the domain was matched against a regular expression, the numeric variables
32150 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
32152 <literallayout class="monospaced">
32153 route_list = ^domain(\d+) host-$1.text.example
32158 <varname>$0</varname> is always set to the entire domain.
32163 <varname>$1</varname> is also set when partial matching is done in a file lookup.
32168 <indexterm role="variable">
32169 <primary><varname>$value</varname></primary>
32171 If the pattern that matched the domain was a lookup item, the data that was
32172 looked up is available in the expansion variable <varname>$value</varname>. For example:
32174 <literallayout class="monospaced">
32175 route_list = lsearch;;/some/file.routes $value
32180 Note the doubling of the semicolon in the pattern that is necessary because
32181 semicolon is the default route list separator.
32184 <section id="SECTformatonehostitem">
32185 <title>Format of one host item</title>
32187 Each item in the list of hosts is either a host name or an IP address,
32188 optionally with an attached port number. When no port is given, an IP address
32189 is not enclosed in brackets. When a port is specified, it overrides the port
32190 specification on the transport. The port is separated from the name or address
32191 by a colon. This leads to some complications:
32196 Because colon is the default separator for the list of hosts, either
32197 the colon that specifies a port must be doubled, or the list separator must
32198 be changed. The following two examples have the same effect:
32200 <literallayout class="monospaced">
32201 route_list = * "host1.tld::1225 : host2.tld::1226"
32202 route_list = * "<+ host1.tld:1225 + host2.tld:1226"
32207 When IPv6 addresses are involved, it gets worse, because they contain
32208 colons of their own. To make this case easier, it is permitted to
32209 enclose an IP address (either v4 or v6) in square brackets if a port
32210 number follows. For example:
32212 <literallayout class="monospaced">
32213 route_list = * "</ [10.1.1.1]:1225 / [::1]:1226"
32218 <section id="SECThostshowused">
32219 <title>How the list of hosts is used</title>
32221 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
32222 the hosts is tried, in the order specified, when carrying out the SMTP
32223 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
32224 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
32228 Hosts may be listed by name or by IP address. An unadorned name in the list of
32229 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
32230 interpreted as an indirection to a sublist of hosts obtained by looking up MX
32231 records in the DNS. For example:
32233 <literallayout class="monospaced">
32234 route_list = * x.y.z:p.q.r/MX:e.f.g
32237 If this feature is used with a port specifier, the port must come last. For
32240 <literallayout class="monospaced">
32241 route_list = * dom1.tld/mx::1225
32244 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
32245 randomized before any lookups are done. Exim then scans the list; for any name
32246 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
32247 be an interface on the local host and the item is not the first in the list,
32248 Exim discards it and any subsequent items. If it is the first item, what
32249 happens is controlled by the
32250 <indexterm role="option">
32251 <primary><option>self</option></primary>
32252 <secondary>in <command>manualroute</command> router</secondary>
32254 <option>self</option> option of the router.
32257 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
32258 hosts obtained by looking up MX records for the name. This is always a DNS
32259 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
32260 below) are not relevant here. The order of these hosts is determined by the
32261 preference values in the MX records, according to the usual rules. Because
32262 randomizing happens before the MX lookup, it does not affect the order that is
32263 defined by MX preferences.
32266 If the local host is present in the sublist obtained from MX records, but is
32267 not the most preferred host in that list, it and any equally or less
32268 preferred hosts are removed before the sublist is inserted into the main list.
32271 If the local host is the most preferred host in the MX list, what happens
32272 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
32273 is not the first item (that is, there are previous hosts in the main list),
32274 Exim discards this name and any subsequent items in the main list.
32277 If the MX item is first in the list of hosts, and the local host is the
32278 most preferred host, what happens is controlled by the <option>self</option> option of the
32282 DNS failures when lookup up the MX records are treated in the same way as DNS
32283 failures when looking up IP addresses: <option>pass_on_timeout</option> and
32284 <option>host_find_failed</option> are used when relevant.
32287 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
32288 whether obtained from an MX lookup or not.
32291 <section id="SECThowoptused">
32292 <title>How the options are used</title>
32294 The options are a sequence of words; in practice no more than three are ever
32295 present. One of the words can be the name of a transport; this overrides the
32296 <option>transport</option> option on the router for this particular routing rule only. The
32297 other words (if present) control randomization of the list of hosts on a
32298 per-rule basis, and how the IP addresses of the hosts are to be found when
32299 routing to a remote transport. These options are as follows:
32304 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
32305 setting of <option>hosts_randomize</option> for this routing rule only.
32310 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
32311 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
32316 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
32317 find IP addresses. This function may ultimately cause a DNS lookup, but it may
32318 also look in <filename>/etc/hosts</filename> or other sources of information.
32323 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
32324 no address records are found. If there is a temporary DNS error (such as a
32325 timeout), delivery is deferred.
32332 <literallayout class="monospaced">
32333 route_list = domain1 host1:host2:host3 randomize bydns;\
32334 domain2 host4:host5
32337 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
32338 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
32339 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
32340 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
32344 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
32345 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
32346 instead of TRY_AGAIN. That is why the default action is to try a DNS
32347 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
32351 If no IP address for a host can be found, what happens is controlled by the
32352 <option>host_find_failed</option> option.
32355 <indexterm role="variable">
32356 <primary><varname>$host</varname></primary>
32358 When an address is routed to a local transport, IP addresses are not looked up.
32359 The host list is passed to the transport in the <varname>$host</varname> variable.
32362 <section id="SECID123">
32363 <title>Manualroute examples</title>
32365 In some of the examples that follow, the presence of the <option>remote_smtp</option>
32366 transport, as defined in the default configuration file, is assumed:
32371 <indexterm role="concept">
32372 <primary>smart host</primary>
32373 <secondary>example router</secondary>
32375 The <command>manualroute</command> router can be used to forward all external mail to a
32376 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
32377 named domain list that contains your local domains, for example:
32379 <literallayout class="monospaced">
32380 domainlist local_domains = my.domain.example
32383 You can arrange for all other domains to be routed to a smart host by making
32384 your first router something like this:
32386 <literallayout class="monospaced">
32388 driver = manualroute
32389 domains = !+local_domains
32390 transport = remote_smtp
32391 route_list = * smarthost.ref.example
32394 This causes all non-local addresses to be sent to the single host
32395 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
32396 they are tried in order
32397 (but you can use <option>hosts_randomize</option> to vary the order each time).
32398 Another way of configuring the same thing is this:
32400 <literallayout class="monospaced">
32402 driver = manualroute
32403 transport = remote_smtp
32404 route_list = !+local_domains smarthost.ref.example
32407 There is no difference in behaviour between these two routers as they stand.
32408 However, they behave differently if <option>no_more</option> is added to them. In the first
32409 example, the router is skipped if the domain does not match the <option>domains</option>
32410 precondition; the following router is always tried. If the router runs, it
32411 always matches the domain and so can never decline. Therefore, <option>no_more</option>
32412 would have no effect. In the second case, the router is never skipped; it
32413 always runs. However, if it doesn’t match the domain, it declines. In this case
32414 <option>no_more</option> would prevent subsequent routers from running.
32419 <indexterm role="concept">
32420 <primary>mail hub example</primary>
32422 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
32423 records in the DNS and delivers it via its own private routing mechanism. Often
32424 the final destinations are behind a firewall, with the mail hub being the one
32425 machine that can connect to machines both inside and outside the firewall. The
32426 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
32427 to the correct hosts. For a small number of domains, the routing can be inline,
32428 using the <option>route_list</option> option, but for a larger number a file or database
32429 lookup is easier to manage.
32432 If the domain names are in fact the names of the machines to which the mail is
32433 to be sent by the mail hub, the configuration can be quite simple. For
32436 <literallayout class="monospaced">
32438 driver = manualroute
32439 transport = remote_smtp
32440 route_list = *.rhodes.tvs.example $domain
32443 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
32444 whose names are the same as the mail domains. A similar approach can be taken
32445 if the host name can be obtained from the domain name by a string manipulation
32446 that the expansion facilities can handle. Otherwise, a lookup based on the
32447 domain can be used to find the host:
32449 <literallayout class="monospaced">
32451 driver = manualroute
32452 transport = remote_smtp
32453 route_data = ${lookup {$domain} cdb {/internal/host/routes}}
32456 The result of the lookup must be the name or IP address of the host (or
32457 hosts) to which the address is to be routed. If the lookup fails, the route
32458 data is empty, causing the router to decline. The address then passes to the
32464 <indexterm role="concept">
32465 <primary>batched SMTP output example</primary>
32467 <indexterm role="concept">
32468 <primary>SMTP</primary>
32469 <secondary>batched outgoing; example</secondary>
32471 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
32472 SMTP format for onward transportation by some other means. This is one way of
32473 storing mail for a dial-up host when it is not connected. The route list entry
32474 can be as simple as a single domain name in a configuration like this:
32476 <literallayout class="monospaced">
32478 driver = manualroute
32479 transport = batchsmtp_appendfile
32480 route_list = saved.domain.example
32483 though often a pattern is used to pick up more than one domain. If there are
32484 several domains or groups of domains with different transport requirements,
32485 different transports can be listed in the routing information:
32487 <literallayout class="monospaced">
32489 driver = manualroute
32491 *.saved.domain1.example $domain batch_appendfile; \
32492 *.saved.domain2.example \
32493 ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
32497 <indexterm role="variable">
32498 <primary><varname>$domain</varname></primary>
32500 <indexterm role="variable">
32501 <primary><varname>$host</varname></primary>
32503 The first of these just passes the domain in the <varname>$host</varname> variable, which
32504 doesn’t achieve much (since it is also in <varname>$domain</varname>), but the second does a
32505 file lookup to find a value to pass, causing the router to decline to handle
32506 the address if the lookup fails.
32511 <indexterm role="concept">
32512 <primary>UUCP</primary>
32513 <secondary>example of router for</secondary>
32515 Routing mail directly to UUCP software is a specific case of the use of
32516 <command>manualroute</command> in a gateway to another mail environment. This is an example of
32517 one way it can be done:
32519 <literallayout class="monospaced">
32524 command = /usr/local/bin/uux -r - \
32525 ${substr_-5:$host}!rmail ${local_part}
32526 return_fail_output = true
32531 driver = manualroute
32533 ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
32536 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
32538 <literallayout class="monospaced">
32539 darksite.ethereal.example: darksite.UUCP
32542 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
32543 makes clear the distinction between the domain name
32544 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
32549 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
32550 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
32555 <chapter id="CHAPdriverlast">
32556 <title>The queryprogram router</title>
32558 <indexterm role="concept" id="IIDquerou1" class="startofrange">
32559 <primary><command>queryprogram</command> router</primary>
32561 <indexterm role="concept" id="IIDquerou2" class="startofrange">
32562 <primary>routers</primary>
32563 <secondary><command>queryprogram</command></secondary>
32565 <indexterm role="concept">
32566 <primary>routing</primary>
32567 <secondary>by external program</secondary>
32569 The <command>queryprogram</command> router routes an address by running an external command
32570 and acting on its output. This is an expensive way to route, and is intended
32571 mainly for use in lightly-loaded systems, or for performing experiments.
32572 However, if it is possible to use the precondition options (<option>domains</option>,
32573 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
32574 be used in special cases, even on a busy host. There are the following private
32576 <indexterm role="concept">
32577 <primary>options</primary>
32578 <secondary><command>queryprogram</command> router</secondary>
32582 <indexterm role="option">
32583 <primary><option>command</option></primary>
32586 <informaltable frame="all">
32587 <tgroup cols="4" colsep="0" rowsep="0">
32588 <colspec colwidth="8*" align="left"/>
32589 <colspec colwidth="6*" align="center"/>
32590 <colspec colwidth="6*" align="center"/>
32591 <colspec colwidth="6*" align="right"/>
32594 <entry><option>command</option></entry>
32595 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32596 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
32597 <entry>Default: <emphasis>unset</emphasis></entry>
32603 This option must be set. It specifies the command that is to be run. The
32604 command is split up into a command name and arguments, and then each is
32605 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
32606 <xref linkend="CHAPpipetransport"/>).
32609 <indexterm role="option">
32610 <primary><option>command_group</option></primary>
32613 <informaltable frame="all">
32614 <tgroup cols="4" colsep="0" rowsep="0">
32615 <colspec colwidth="8*" align="left"/>
32616 <colspec colwidth="6*" align="center"/>
32617 <colspec colwidth="6*" align="center"/>
32618 <colspec colwidth="6*" align="right"/>
32621 <entry><option>command_group</option></entry>
32622 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32623 <entry>Type: <emphasis>string</emphasis></entry>
32624 <entry>Default: <emphasis>unset</emphasis></entry>
32630 <indexterm role="concept">
32631 <primary>gid (group id)</primary>
32632 <secondary>in <command>queryprogram</command> router</secondary>
32634 This option specifies a gid to be set when running the command while routing an
32635 address for deliver. It must be set if <option>command_user</option> specifies a numerical
32636 uid. If it begins with a digit, it is interpreted as the numerical value of the
32637 gid. Otherwise it is looked up using <function>getgrnam()</function>.
32640 <indexterm role="option">
32641 <primary><option>command_user</option></primary>
32644 <informaltable frame="all">
32645 <tgroup cols="4" colsep="0" rowsep="0">
32646 <colspec colwidth="8*" align="left"/>
32647 <colspec colwidth="6*" align="center"/>
32648 <colspec colwidth="6*" align="center"/>
32649 <colspec colwidth="6*" align="right"/>
32652 <entry><option>command_user</option></entry>
32653 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32654 <entry>Type: <emphasis>string</emphasis></entry>
32655 <entry>Default: <emphasis>unset</emphasis></entry>
32661 <indexterm role="concept">
32662 <primary>uid (user id)</primary>
32663 <secondary>for <command>queryprogram</command></secondary>
32665 This option must be set. It specifies the uid which is set when running the
32666 command while routing an address for delivery. If the value begins with a digit,
32667 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
32668 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
32669 not set, a value for the gid also.
32672 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
32673 root, which it does during a normal delivery in a conventional configuration.
32674 However, when an address is being verified during message reception, Exim is
32675 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
32676 is called from a non-root process, Exim cannot change uid or gid before running
32677 the command. In this circumstance the command runs under the current uid and
32681 <indexterm role="option">
32682 <primary><option>current_directory</option></primary>
32685 <informaltable frame="all">
32686 <tgroup cols="4" colsep="0" rowsep="0">
32687 <colspec colwidth="8*" align="left"/>
32688 <colspec colwidth="6*" align="center"/>
32689 <colspec colwidth="6*" align="center"/>
32690 <colspec colwidth="6*" align="right"/>
32693 <entry><option>current_directory</option></entry>
32694 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32695 <entry>Type: <emphasis>string</emphasis></entry>
32696 <entry>Default: <emphasis>/</emphasis></entry>
32702 This option specifies an absolute path which is made the current directory
32703 before running the command.
32706 <indexterm role="option">
32707 <primary><option>timeout</option></primary>
32710 <informaltable frame="all">
32711 <tgroup cols="4" colsep="0" rowsep="0">
32712 <colspec colwidth="8*" align="left"/>
32713 <colspec colwidth="6*" align="center"/>
32714 <colspec colwidth="6*" align="center"/>
32715 <colspec colwidth="6*" align="right"/>
32718 <entry><option>timeout</option></entry>
32719 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32720 <entry>Type: <emphasis>time</emphasis></entry>
32721 <entry>Default: <emphasis>1h</emphasis></entry>
32727 If the command does not complete within the timeout period, its process group
32728 is killed and the message is frozen. A value of zero time specifies no
32732 The standard output of the command is connected to a pipe, which is read when
32733 the command terminates. It should consist of a single line of output,
32734 containing up to five fields, separated by white space. The maximum length of
32735 the line is 1023 characters. Longer lines are silently truncated. The first
32736 field is one of the following words (case-insensitive):
32741 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
32747 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
32748 <option>no_more</option> is set.
32753 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
32754 subsequent text on the line is an error message. If the router is run as part
32755 of address verification during an incoming SMTP message, the message is
32756 included in the SMTP response.
32761 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
32762 subsequent text on the line is an error message which is logged. It is not
32763 included in any SMTP response.
32768 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
32773 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
32774 <option>pass_router</option>), overriding <option>no_more</option>.
32779 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
32780 new addresses, which are routed independently, starting with the first router,
32781 or the router specified by <option>redirect_router</option>, if set.
32786 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
32787 number of keyed data values, as follows (split into two lines here, to fit on
32790 <literallayout class="monospaced">
32791 ACCEPT TRANSPORT=<transport> HOSTS=<list of hosts>
32792 LOOKUP=byname|bydns DATA=<text>
32795 The data items can be given in any order, and all are optional. If no transport
32796 is included, the transport specified by the generic <option>transport</option> option is
32797 used. The list of hosts and the lookup type are needed only if the transport is
32798 an <command>smtp</command> transport that does not itself supply a list of hosts.
32801 The format of the list of hosts is the same as for the <command>manualroute</command> router.
32802 As well as host names and IP addresses with optional port numbers, as described
32803 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
32804 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
32805 (see section <xref linkend="SECThostshowused"/>).
32808 If the lookup type is not specified, Exim behaves as follows when trying to
32809 find an IP address for each host: First, a DNS lookup is done. If this yields
32810 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
32811 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
32812 result of the lookup is the result of that call.
32815 <indexterm role="variable">
32816 <primary><varname>$address_data</varname></primary>
32818 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
32819 variable. For example, this return line
32821 <literallayout class="monospaced">
32822 accept hosts=x1.y.example:x2.y.example data="rule1"
32825 routes the address to the default transport, passing a list of two hosts. When
32826 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
32827 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
32828 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
32832 <chapter id="CHAPredirect">
32833 <title>The redirect router</title>
32835 <indexterm role="concept" id="IIDredrou1" class="startofrange">
32836 <primary><command>redirect</command> router</primary>
32838 <indexterm role="concept" id="IIDredrou2" class="startofrange">
32839 <primary>routers</primary>
32840 <secondary><command>redirect</command></secondary>
32842 <indexterm role="concept">
32843 <primary>alias file</primary>
32844 <secondary>in a <command>redirect</command> router</secondary>
32846 <indexterm role="concept">
32847 <primary>address redirection</primary>
32848 <secondary><command>redirect</command> router</secondary>
32850 The <command>redirect</command> router handles several kinds of address redirection. Its most
32851 common uses are for resolving local part aliases from a central alias file
32852 (usually called <filename>/etc/aliases</filename>) and for handling users’ personal <filename>.forward</filename>
32853 files, but it has many other potential uses. The incoming address can be
32854 redirected in several different ways:
32859 It can be replaced by one or more new addresses which are themselves routed
32865 It can be routed to be delivered to a given file or directory.
32870 It can be routed to be delivered to a specified pipe command.
32875 It can cause an automatic reply to be generated.
32880 It can be forced to fail, optionally with a custom error message.
32885 It can be temporarily deferred, optionally with a custom message.
32890 It can be discarded.
32895 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
32896 However, there are some private options which define transports for delivery to
32897 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
32898 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
32900 <section id="SECID124">
32901 <title>Redirection data</title>
32903 The router operates by interpreting a text string which it obtains either by
32904 expanding the contents of the <option>data</option> option, or by reading the entire
32905 contents of a file whose name is given in the <option>file</option> option. These two
32906 options are mutually exclusive. The first is commonly used for handling system
32907 aliases, in a configuration like this:
32909 <literallayout class="monospaced">
32912 data = ${lookup{$local_part}lsearch{/etc/aliases}}
32915 If the lookup fails, the expanded string in this example is empty. When the
32916 expansion of <option>data</option> results in an empty string, the router declines. A forced
32917 expansion failure also causes the router to decline; other expansion failures
32918 cause delivery to be deferred.
32921 A configuration using <option>file</option> is commonly used for handling users’
32922 <filename>.forward</filename> files, like this:
32924 <literallayout class="monospaced">
32928 file = $home/.forward
32932 If the file does not exist, or causes no action to be taken (for example, it is
32933 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
32934 is not the case when the file contains syntactically valid items that happen to
32935 yield empty addresses, for example, items containing only RFC 2822 address
32939 <section id="SECID125">
32940 <title>Forward files and address verification</title>
32942 <indexterm role="concept">
32943 <primary>address redirection</primary>
32944 <secondary>while verifying</secondary>
32946 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users’
32947 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
32952 When Exim is receiving an incoming SMTP message from a remote host, it is
32953 running under the Exim uid, not as root. Exim is unable to change uid to read
32954 the file as the user, and it may not be able to read it as the Exim user. So in
32955 practice the router may not be able to operate.
32960 However, even when the router can operate, the existence of a <filename>.forward</filename> file
32961 is unimportant when verifying an address. What should be checked is whether the
32962 local part is a valid user name or not. Cutting out the redirection processing
32963 saves some resources.
32968 <section id="SECID126">
32969 <title>Interpreting redirection data</title>
32971 <indexterm role="concept">
32972 <primary>Sieve filter</primary>
32973 <secondary>specifying in redirection data</secondary>
32975 <indexterm role="concept">
32976 <primary>filter</primary>
32977 <secondary>specifying in redirection data</secondary>
32979 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
32980 can be interpreted in two different ways:
32985 If the <option>allow_filter</option> option is set true, and the data begins with the text
32986 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
32987 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
32988 respectively. Details of the syntax and semantics of filter files are described
32989 in a separate document entitled <emphasis>Exim’s interfaces to mail filtering</emphasis>; this
32990 document is intended for use by end users.
32995 Otherwise, the data must be a comma-separated list of redirection items, as
32996 described in the next section.
33001 When a message is redirected to a file (a <quote>mail folder</quote>), the file name given
33002 in a non-filter redirection list must always be an absolute path. A filter may
33003 generate a relative path – how this is handled depends on the transport’s
33004 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
33005 for the <command>appendfile</command> transport.
33008 <section id="SECTitenonfilred">
33009 <title>Items in a non-filter redirection list</title>
33011 <indexterm role="concept">
33012 <primary>address redirection</primary>
33013 <secondary>non-filter list items</secondary>
33015 When the redirection data is not an Exim or Sieve filter, for example, if it
33016 comes from a conventional alias or forward file, it consists of a list of
33017 addresses, file names, pipe commands, or certain special items (see section
33018 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
33019 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
33020 depending on their default values. The items in the list are separated by
33021 commas or newlines.
33022 If a comma is required in an item, the entire item must be enclosed in double
33026 Lines starting with a # character are comments, and are ignored, and # may
33027 also appear following a comma, in which case everything between the # and the
33028 next newline character is ignored.
33031 If an item is entirely enclosed in double quotes, these are removed. Otherwise
33032 double quotes are retained because some forms of mail address require their use
33033 (but never to enclose the entire address). In the following description,
33034 <quote>item</quote> refers to what remains after any surrounding double quotes have been
33038 <indexterm role="variable">
33039 <primary><varname>$local_part</varname></primary>
33041 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
33042 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
33043 of the <option>quote_local_part</option> expansion operator, in case the local part contains
33044 special characters. For example, to redirect all mail for the domain
33045 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
33048 <literallayout class="monospaced">
33049 data = ${quote_local_part:$local_part}@newdomain.example
33052 <section id="SECTredlocmai">
33053 <title>Redirecting to a local mailbox</title>
33055 <indexterm role="concept">
33056 <primary>routing</primary>
33057 <secondary>loops in</secondary>
33059 <indexterm role="concept">
33060 <primary>loop</primary>
33061 <secondary>while routing, avoidance of</secondary>
33063 <indexterm role="concept">
33064 <primary>address redirection</primary>
33065 <secondary>to local mailbox</secondary>
33067 A redirection item may safely be the same as the address currently under
33068 consideration. This does not cause a routing loop, because a router is
33069 automatically skipped if any ancestor of the address that is being processed
33070 is the same as the current address and was processed by the current router.
33071 Such an address is therefore passed to the following routers, so it is handled
33072 as if there were no redirection. When making this loop-avoidance test, the
33073 complete local part, including any prefix or suffix, is used.
33076 <indexterm role="concept">
33077 <primary>address redirection</primary>
33078 <secondary>local part without domain</secondary>
33080 Specifying the same local part without a domain is a common usage in personal
33081 filter files when the user wants to have messages delivered to the local
33082 mailbox and also forwarded elsewhere. For example, the user whose login is
33083 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
33085 <literallayout class="monospaced">
33086 cleo, cleopatra@egypt.example
33089 <indexterm role="concept">
33090 <primary>backslash in alias file</primary>
33092 <indexterm role="concept">
33093 <primary>alias file</primary>
33094 <secondary>backslash in</secondary>
33096 For compatibility with other MTAs, such unqualified local parts may be
33097 preceded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
33098 it does make a difference if more than one domain is being handled
33102 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
33103 2822 address that does not include a domain, the item is qualified using the
33104 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
33105 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
33106 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
33109 Care must be taken if there are alias names for local users.
33110 Consider an MTA handling a single local domain where the system alias file
33113 <literallayout class="monospaced">
33117 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
33118 messages in the local mailbox, and also forward copies elsewhere. He creates
33121 <literallayout class="monospaced">
33122 Sam.Reman, spqr@reme.elsewhere.example
33125 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
33126 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
33127 second time round, because it has previously routed it,
33128 and the following routers presumably cannot handle the alias. The forward file
33129 should really contain
33131 <literallayout class="monospaced">
33132 spqr, spqr@reme.elsewhere.example
33135 but because this is such a common error, the <option>check_ancestor</option> option (see
33136 below) exists to provide a way to get round it. This is normally set on a
33137 <command>redirect</command> router that is handling users’ <filename>.forward</filename> files.
33140 <section id="SECTspecitredli">
33141 <title>Special items in redirection lists</title>
33143 In addition to addresses, the following types of item may appear in redirection
33144 lists (that is, in non-filter redirection data):
33149 <indexterm role="concept">
33150 <primary>pipe</primary>
33151 <secondary>in redirection list</secondary>
33153 <indexterm role="concept">
33154 <primary>address redirection</primary>
33155 <secondary>to pipe</secondary>
33157 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
33158 as a valid RFC 2822 address that includes a domain. A transport for running the
33159 command must be specified by the <option>pipe_transport</option> option.
33160 Normally, either the router or the transport specifies a user and a group under
33161 which to run the delivery. The default is to use the Exim user and group.
33164 Single or double quotes can be used for enclosing the individual arguments of
33165 the pipe command; no interpretation of escapes is done for single quotes. If
33166 the command contains a comma character, it is necessary to put the whole item
33167 in double quotes, for example:
33169 <literallayout class="monospaced">
33170 "|/some/command ready,steady,go"
33173 since items in redirection lists are terminated by commas. Do not, however,
33174 quote just the command. An item such as
33176 <literallayout class="monospaced">
33177 |"/some/command ready,steady,go"
33180 is interpreted as a pipe with a rather strange command name, and no arguments.
33185 <indexterm role="concept">
33186 <primary>file</primary>
33187 <secondary>in redirection list</secondary>
33189 <indexterm role="concept">
33190 <primary>address redirection</primary>
33191 <secondary>to file</secondary>
33193 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
33194 parse as a valid RFC 2822 address that includes a domain. For example,
33196 <literallayout class="monospaced">
33197 /home/world/minbari
33200 is treated as a file name, but
33202 <literallayout class="monospaced">
33203 /s=molari/o=babylon/@x400gate.way
33206 is treated as an address. For a file name, a transport must be specified using
33207 the <option>file_transport</option> option. However, if the generated path name ends with a
33208 forward slash character, it is interpreted as a directory name rather than a
33209 file name, and <option>directory_transport</option> is used instead.
33212 Normally, either the router or the transport specifies a user and a group under
33213 which to run the delivery. The default is to use the Exim user and group.
33216 <indexterm role="concept">
33217 <primary><filename>/dev/null</filename></primary>
33219 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
33220 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
33221 instead of a transport name. In this case the user and group are not used.
33226 <indexterm role="concept">
33227 <primary>included address list</primary>
33229 <indexterm role="concept">
33230 <primary>address redirection</primary>
33231 <secondary>included external list</secondary>
33233 If an item is of the form
33235 <literallayout class="monospaced">
33236 :include:<path name>
33239 a list of further items is taken from the given file and included at that
33240 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
33241 out-of-line addition to the list. The items in the included list are separated
33242 by commas or newlines and are not subject to expansion. If this is the first
33243 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
33244 the alias name. This example is incorrect:
33246 <literallayout class="monospaced">
33247 list1 :include:/opt/lists/list1
33250 It must be given as
33252 <literallayout class="monospaced">
33253 list1: :include:/opt/lists/list1
33258 <indexterm role="concept">
33259 <primary>address redirection</primary>
33260 <secondary>to black hole</secondary>
33262 Sometimes you want to throw away mail to a particular local part. Making the
33263 <option>data</option> option expand to an empty string does not work, because that causes
33264 the router to decline. Instead, the alias item
33265 <indexterm role="concept">
33266 <primary>black hole</primary>
33268 <indexterm role="concept">
33269 <primary>abandoning mail</primary>
33271 <emphasis>:blackhole:</emphasis> can be used. It does what its name implies. No delivery is
33272 done, and no error message is generated. This has the same effect as specifing
33273 <filename>/dev/null</filename> as a destination, but it can be independently disabled.
33276 <emphasis role="bold">Warning</emphasis>: If <emphasis>:blackhole:</emphasis> appears anywhere in a redirection list, no
33277 delivery is done for the original local part, even if other redirection items
33278 are present. If you are generating a multi-item list (for example, by reading a
33279 database) and need the ability to provide a no-op item, you must use
33280 <filename>/dev/null</filename>.
33285 <indexterm role="concept">
33286 <primary>delivery</primary>
33287 <secondary>forcing failure</secondary>
33289 <indexterm role="concept">
33290 <primary>delivery</primary>
33291 <secondary>forcing deferral</secondary>
33293 <indexterm role="concept">
33294 <primary>failing delivery</primary>
33295 <secondary>forcing</secondary>
33297 <indexterm role="concept">
33298 <primary>deferred delivery, forcing</primary>
33300 <indexterm role="concept">
33301 <primary>customizing</primary>
33302 <secondary>failure message</secondary>
33304 An attempt to deliver a particular address can be deferred or forced to fail by
33305 redirection items of the form
33307 <literallayout class="monospaced">
33311 <para revisionflag="changed">
33312 respectively. When a redirection list contains such an item, it applies
33313 to the entire redirection; any other items in the list are ignored. Any
33314 text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error text
33315 associated with the failure. For example, an alias file might contain:
33317 <literallayout class="monospaced">
33318 X.Employee: :fail: Gone away, no forwarding address
33321 In the case of an address that is being verified from an ACL or as the subject
33323 <indexterm role="concept">
33324 <primary>VRFY</primary>
33325 <secondary>error text, display of</secondary>
33327 VRFY command, the text is included in the SMTP error response by
33329 <indexterm role="concept">
33330 <primary>EXPN</primary>
33331 <secondary>error text, display of</secondary>
33333 The text is not included in the response to an EXPN command. In non-SMTP cases
33334 the text is included in the error message that Exim generates.
33337 <indexterm role="concept">
33338 <primary>SMTP</primary>
33339 <secondary>error codes</secondary>
33341 By default, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
33342 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
33343 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
33344 followed by a space, and the very first digit is the same as the default error
33345 code, the code from the message is used instead. If the very first digit is
33346 incorrect, a panic error is logged, and the default code is used. You can
33347 suppress the use of the supplied code in a redirect router by setting the
33348 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
33352 <indexterm role="variable">
33353 <primary><varname>$acl_verify_message</varname></primary>
33355 In an ACL, an explicitly provided message overrides the default, but the
33356 default message is available in the variable <varname>$acl_verify_message</varname> and can
33357 therefore be included in a custom message if this is desired.
33360 Normally the error text is the rest of the redirection list – a comma does
33361 not terminate it – but a newline does act as a terminator. Newlines are not
33362 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
33363 as part of the continuation process, but they may exist in other kinds of
33364 lookup and in <emphasis>:include:</emphasis> files.
33367 During routing for message delivery (as opposed to verification), a redirection
33368 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
33369 whereas <emphasis>:defer:</emphasis> causes the message to remain on the queue so that a
33370 subsequent delivery attempt can happen at a later time. If an address is
33371 deferred for too long, it will ultimately fail, because the normal retry
33377 <indexterm role="concept">
33378 <primary>alias file</primary>
33379 <secondary>exception to default</secondary>
33381 Sometimes it is useful to use a single-key search type with a default (see
33382 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
33383 for exceptions to the default. These can be handled by aliasing them to
33384 <emphasis>:unknown:</emphasis>. This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command>
33385 router to decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which
33386 results in an empty redirection list has the same effect.
33391 <section id="SECTdupaddr">
33392 <title>Duplicate addresses</title>
33394 <indexterm role="concept">
33395 <primary>duplicate addresses</primary>
33397 <indexterm role="concept">
33398 <primary>address duplicate, discarding</primary>
33400 <indexterm role="concept">
33401 <primary>pipe</primary>
33402 <secondary>duplicated</secondary>
33404 Exim removes duplicate addresses from the list to which it is delivering, so as
33405 to deliver just one copy to each address. This does not apply to deliveries
33406 routed to pipes by different immediate parent addresses, but an indirect
33407 aliasing scheme of the type
33409 <literallayout class="monospaced">
33410 pipe: |/some/command $local_part
33415 does not work with a message that is addressed to both local parts, because
33416 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
33417 discarded as being the same as a previously handled address. However, a scheme
33420 <literallayout class="monospaced">
33421 localpart1: |/some/command $local_part
33422 localpart2: |/some/command $local_part
33425 does result in two different pipe deliveries, because the immediate parents of
33426 the pipes are distinct.
33429 <section id="SECID128">
33430 <title>Repeated redirection expansion</title>
33432 <indexterm role="concept">
33433 <primary>repeated redirection expansion</primary>
33435 <indexterm role="concept">
33436 <primary>address redirection</primary>
33437 <secondary>repeated for each delivery attempt</secondary>
33439 When a message cannot be delivered to all of its recipients immediately,
33440 leading to two or more delivery attempts, redirection expansion is carried out
33441 afresh each time for those addresses whose children were not all previously
33442 delivered. If redirection is being used as a mailing list, this can lead to new
33443 members of the list receiving copies of old messages. The <option>one_time</option> option
33444 can be used to avoid this.
33447 <section id="SECID129">
33448 <title>Errors in redirection lists</title>
33450 <indexterm role="concept">
33451 <primary>address redirection</primary>
33452 <secondary>errors</secondary>
33454 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
33455 error is skipped, and an entry is written to the main log. This may be useful
33456 for mailing lists that are automatically managed. Otherwise, if an error is
33457 detected while generating the list of new addresses, the original address is
33458 deferred. See also <option>syntax_errors_to</option>.
33461 <section id="SECID130">
33462 <title>Private options for the redirect router</title>
33464 <indexterm role="concept">
33465 <primary>options</primary>
33466 <secondary><command>redirect</command> router</secondary>
33468 The private options for the <command>redirect</command> router are as follows:
33471 <indexterm role="option">
33472 <primary><option>allow_defer</option></primary>
33475 <informaltable frame="all">
33476 <tgroup cols="4" colsep="0" rowsep="0">
33477 <colspec colwidth="8*" align="left"/>
33478 <colspec colwidth="6*" align="center"/>
33479 <colspec colwidth="6*" align="center"/>
33480 <colspec colwidth="6*" align="right"/>
33483 <entry><option>allow_defer</option></entry>
33484 <entry>Use: <emphasis>redirect</emphasis></entry>
33485 <entry>Type: <emphasis>boolean</emphasis></entry>
33486 <entry>Default: <emphasis>false</emphasis></entry>
33492 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
33493 data, or the <option>defer</option> command in an Exim filter file.
33496 <indexterm role="option">
33497 <primary><option>allow_fail</option></primary>
33500 <informaltable frame="all">
33501 <tgroup cols="4" colsep="0" rowsep="0">
33502 <colspec colwidth="8*" align="left"/>
33503 <colspec colwidth="6*" align="center"/>
33504 <colspec colwidth="6*" align="center"/>
33505 <colspec colwidth="6*" align="right"/>
33508 <entry><option>allow_fail</option></entry>
33509 <entry>Use: <emphasis>redirect</emphasis></entry>
33510 <entry>Type: <emphasis>boolean</emphasis></entry>
33511 <entry>Default: <emphasis>false</emphasis></entry>
33517 <indexterm role="concept">
33518 <primary>failing delivery</primary>
33519 <secondary>from filter</secondary>
33521 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
33522 and the <option>fail</option> command may be used in an Exim filter file.
33525 <indexterm role="option">
33526 <primary><option>allow_filter</option></primary>
33529 <informaltable frame="all">
33530 <tgroup cols="4" colsep="0" rowsep="0">
33531 <colspec colwidth="8*" align="left"/>
33532 <colspec colwidth="6*" align="center"/>
33533 <colspec colwidth="6*" align="center"/>
33534 <colspec colwidth="6*" align="right"/>
33537 <entry><option>allow_filter</option></entry>
33538 <entry>Use: <emphasis>redirect</emphasis></entry>
33539 <entry>Type: <emphasis>boolean</emphasis></entry>
33540 <entry>Default: <emphasis>false</emphasis></entry>
33546 <indexterm role="concept">
33547 <primary>filter</primary>
33548 <secondary>enabling use of</secondary>
33550 <indexterm role="concept">
33551 <primary>Sieve filter</primary>
33552 <secondary>enabling use of</secondary>
33554 Setting this option allows Exim to interpret redirection data that starts with
33555 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
33556 are some features of Exim filter files that some administrators may wish to
33557 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
33560 It is also possible to lock out Exim filters or Sieve filters while allowing
33561 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
33564 The filter is run using the uid and gid set by the generic <option>user</option> and
33565 <option>group</option> options. These take their defaults from the password data if
33566 <option>check_local_user</option> is set, so in the normal case of users’ personal filter
33567 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
33568 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
33571 <indexterm role="option">
33572 <primary><option>allow_freeze</option></primary>
33575 <informaltable frame="all">
33576 <tgroup cols="4" colsep="0" rowsep="0">
33577 <colspec colwidth="8*" align="left"/>
33578 <colspec colwidth="6*" align="center"/>
33579 <colspec colwidth="6*" align="center"/>
33580 <colspec colwidth="6*" align="right"/>
33583 <entry><option>allow_freeze</option></entry>
33584 <entry>Use: <emphasis>redirect</emphasis></entry>
33585 <entry>Type: <emphasis>boolean</emphasis></entry>
33586 <entry>Default: <emphasis>false</emphasis></entry>
33592 <indexterm role="concept">
33593 <primary>freezing messages</primary>
33594 <secondary>allowing in filter</secondary>
33596 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
33597 This command is more normally encountered in system filters, and is disabled by
33598 default for redirection filters because it isn’t something you usually want to
33599 let ordinary users do.
33602 <indexterm role="option">
33603 <primary><option>check_ancestor</option></primary>
33606 <informaltable frame="all">
33607 <tgroup cols="4" colsep="0" rowsep="0">
33608 <colspec colwidth="8*" align="left"/>
33609 <colspec colwidth="6*" align="center"/>
33610 <colspec colwidth="6*" align="center"/>
33611 <colspec colwidth="6*" align="right"/>
33614 <entry><option>check_ancestor</option></entry>
33615 <entry>Use: <emphasis>redirect</emphasis></entry>
33616 <entry>Type: <emphasis>boolean</emphasis></entry>
33617 <entry>Default: <emphasis>false</emphasis></entry>
33623 This option is concerned with handling generated addresses that are the same
33624 as some address in the list of redirection ancestors of the current address.
33625 Although it is turned off by default in the code, it is set in the default
33626 configuration file for handling users’ <filename>.forward</filename> files. It is recommended
33627 for this use of the <command>redirect</command> router.
33630 When <option>check_ancestor</option> is set, if a generated address (including the domain)
33631 is the same as any ancestor of the current address, it is replaced by a copy of
33632 the current address. This helps in the case where local part A is aliased to B,
33633 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
33634 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
33635 <filename> jb/.forward</filename> contains:
33637 <literallayout class="monospaced">
33638 \Joe.Bloggs, <other item(s)>
33641 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
33642 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
33643 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
33644 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
33645 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
33646 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
33647 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
33648 original address. See also the <option>repeat_use</option> option below.
33651 <indexterm role="option">
33652 <primary><option>check_group</option></primary>
33655 <informaltable frame="all">
33656 <tgroup cols="4" colsep="0" rowsep="0">
33657 <colspec colwidth="8*" align="left"/>
33658 <colspec colwidth="6*" align="center"/>
33659 <colspec colwidth="6*" align="center"/>
33660 <colspec colwidth="6*" align="right"/>
33663 <entry><option>check_group</option></entry>
33664 <entry>Use: <emphasis>redirect</emphasis></entry>
33665 <entry>Type: <emphasis>boolean</emphasis></entry>
33666 <entry>Default: <emphasis>see below</emphasis></entry>
33672 When the <option>file</option> option is used, the group owner of the file is checked only
33673 when this option is set. The permitted groups are those listed in the
33674 <option>owngroups</option> option, together with the user’s default group if
33675 <option>check_local_user</option> is set. If the file has the wrong group, routing is
33676 deferred. The default setting for this option is true if <option>check_local_user</option>
33677 is set and the <option>modemask</option> option permits the group write bit, or if the
33678 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
33681 <indexterm role="option">
33682 <primary><option>check_owner</option></primary>
33685 <informaltable frame="all">
33686 <tgroup cols="4" colsep="0" rowsep="0">
33687 <colspec colwidth="8*" align="left"/>
33688 <colspec colwidth="6*" align="center"/>
33689 <colspec colwidth="6*" align="center"/>
33690 <colspec colwidth="6*" align="right"/>
33693 <entry><option>check_owner</option></entry>
33694 <entry>Use: <emphasis>redirect</emphasis></entry>
33695 <entry>Type: <emphasis>boolean</emphasis></entry>
33696 <entry>Default: <emphasis>see below</emphasis></entry>
33702 When the <option>file</option> option is used, the owner of the file is checked only when
33703 this option is set. If <option>check_local_user</option> is set, the local user is
33704 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
33705 option. The default value for this option is true if <option>check_local_user</option> or
33706 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
33709 <indexterm role="option">
33710 <primary><option>data</option></primary>
33713 <informaltable frame="all">
33714 <tgroup cols="4" colsep="0" rowsep="0">
33715 <colspec colwidth="8*" align="left"/>
33716 <colspec colwidth="6*" align="center"/>
33717 <colspec colwidth="6*" align="center"/>
33718 <colspec colwidth="6*" align="right"/>
33721 <entry><option>data</option></entry>
33722 <entry>Use: <emphasis>redirect</emphasis></entry>
33723 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
33724 <entry>Default: <emphasis>unset</emphasis></entry>
33730 This option is mutually exclusive with <option>file</option>. One or other of them must be
33731 set, but not both. The contents of <option>data</option> are expanded, and then used as the
33732 list of forwarding items, or as a set of filtering instructions. If the
33733 expansion is forced to fail, or the result is an empty string or a string that
33734 has no effect (consists entirely of comments), the router declines.
33737 When filtering instructions are used, the string must begin with <quote>#Exim
33738 filter</quote>, and all comments in the string, including this initial one, must be
33739 terminated with newline characters. For example:
33741 <literallayout class="monospaced">
33742 data = #Exim filter\n\
33743 if $h_to: contains Exim then save $home/mail/exim endif
33746 If you are reading the data from a database where newlines cannot be included,
33747 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
33748 choice into a newline.
33751 <indexterm role="option">
33752 <primary><option>directory_transport</option></primary>
33755 <informaltable frame="all">
33756 <tgroup cols="4" colsep="0" rowsep="0">
33757 <colspec colwidth="8*" align="left"/>
33758 <colspec colwidth="6*" align="center"/>
33759 <colspec colwidth="6*" align="center"/>
33760 <colspec colwidth="6*" align="right"/>
33763 <entry><option>directory_transport</option></entry>
33764 <entry>Use: <emphasis>redirect</emphasis></entry>
33765 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
33766 <entry>Default: <emphasis>unset</emphasis></entry>
33772 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
33773 ending with a slash is specified as a new <quote>address</quote>. The transport used is
33774 specified by this option, which, after expansion, must be the name of a
33775 configured transport. This should normally be an <command>appendfile</command> transport.
33778 <indexterm role="option">
33779 <primary><option>file</option></primary>
33782 <informaltable frame="all">
33783 <tgroup cols="4" colsep="0" rowsep="0">
33784 <colspec colwidth="8*" align="left"/>
33785 <colspec colwidth="6*" align="center"/>
33786 <colspec colwidth="6*" align="center"/>
33787 <colspec colwidth="6*" align="right"/>
33790 <entry><option>file</option></entry>
33791 <entry>Use: <emphasis>redirect</emphasis></entry>
33792 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
33793 <entry>Default: <emphasis>unset</emphasis></entry>
33799 This option specifies the name of a file that contains the redirection data. It
33800 is mutually exclusive with the <option>data</option> option. The string is expanded before
33801 use; if the expansion is forced to fail, the router declines. Other expansion
33802 failures cause delivery to be deferred. The result of a successful expansion
33803 must be an absolute path. The entire file is read and used as the redirection
33804 data. If the data is an empty string or a string that has no effect (consists
33805 entirely of comments), the router declines.
33808 <indexterm role="concept">
33809 <primary>NFS</primary>
33810 <secondary>checking for file existence</secondary>
33812 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
33813 runs a check on the containing directory,
33814 unless <option>ignore_enotdir</option> is true (see below).
33815 If the directory does not appear to exist, delivery is deferred. This can
33816 happen when users’ <filename>.forward</filename> files are in NFS-mounted directories, and there
33817 is a mount problem. If the containing directory does exist, but the file does
33818 not, the router declines.
33821 <indexterm role="option">
33822 <primary><option>file_transport</option></primary>
33825 <informaltable frame="all">
33826 <tgroup cols="4" colsep="0" rowsep="0">
33827 <colspec colwidth="8*" align="left"/>
33828 <colspec colwidth="6*" align="center"/>
33829 <colspec colwidth="6*" align="center"/>
33830 <colspec colwidth="6*" align="right"/>
33833 <entry><option>file_transport</option></entry>
33834 <entry>Use: <emphasis>redirect</emphasis></entry>
33835 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
33836 <entry>Default: <emphasis>unset</emphasis></entry>
33842 <indexterm role="variable">
33843 <primary><varname>$address_file</varname></primary>
33845 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
33846 ending in a slash is specified as a new <quote>address</quote>. The transport used is
33847 specified by this option, which, after expansion, must be the name of a
33848 configured transport. This should normally be an <command>appendfile</command> transport. When
33849 it is running, the file name is in <varname>$address_file</varname>.
33852 <indexterm role="option">
33853 <primary><option>filter_prepend_home</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>filter_prepend_home</option></entry>
33865 <entry>Use: <emphasis>redirect</emphasis></entry>
33866 <entry>Type: <emphasis>boolean</emphasis></entry>
33867 <entry>Default: <emphasis>true</emphasis></entry>
33873 When this option is true, if a <command>save</command> command in an Exim filter specifies a
33874 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
33875 relative path. If this option is set false, this action does not happen. The
33876 relative path is then passed to the transport unmodified.
33879 <indexterm role="option">
33880 <primary><option>forbid_blackhole</option></primary>
33883 <informaltable frame="all">
33884 <tgroup cols="4" colsep="0" rowsep="0">
33885 <colspec colwidth="8*" align="left"/>
33886 <colspec colwidth="6*" align="center"/>
33887 <colspec colwidth="6*" align="center"/>
33888 <colspec colwidth="6*" align="right"/>
33891 <entry><option>forbid_blackhole</option></entry>
33892 <entry>Use: <emphasis>redirect</emphasis></entry>
33893 <entry>Type: <emphasis>boolean</emphasis></entry>
33894 <entry>Default: <emphasis>false</emphasis></entry>
33900 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
33904 <indexterm role="option">
33905 <primary><option>forbid_exim_filter</option></primary>
33908 <informaltable frame="all">
33909 <tgroup cols="4" colsep="0" rowsep="0">
33910 <colspec colwidth="8*" align="left"/>
33911 <colspec colwidth="6*" align="center"/>
33912 <colspec colwidth="6*" align="center"/>
33913 <colspec colwidth="6*" align="right"/>
33916 <entry><option>forbid_exim_filter</option></entry>
33917 <entry>Use: <emphasis>redirect</emphasis></entry>
33918 <entry>Type: <emphasis>boolean</emphasis></entry>
33919 <entry>Default: <emphasis>false</emphasis></entry>
33925 If this option is set true, only Sieve filters are permitted when
33926 <option>allow_filter</option> is true.
33929 <indexterm role="option">
33930 <primary><option>forbid_file</option></primary>
33933 <informaltable frame="all">
33934 <tgroup cols="4" colsep="0" rowsep="0">
33935 <colspec colwidth="8*" align="left"/>
33936 <colspec colwidth="6*" align="center"/>
33937 <colspec colwidth="6*" align="center"/>
33938 <colspec colwidth="6*" align="right"/>
33941 <entry><option>forbid_file</option></entry>
33942 <entry>Use: <emphasis>redirect</emphasis></entry>
33943 <entry>Type: <emphasis>boolean</emphasis></entry>
33944 <entry>Default: <emphasis>false</emphasis></entry>
33950 <indexterm role="concept">
33951 <primary>delivery</primary>
33952 <secondary>to file; forbidding</secondary>
33954 <indexterm role="concept">
33955 <primary>Sieve filter</primary>
33956 <secondary>forbidding delivery to a file</secondary>
33958 <indexterm role="concept">
33959 <primary>Sieve filter</primary>
33960 <secondary><quote>keep</quote> facility; disabling</secondary>
33962 If this option is true, this router may not generate a new address that
33963 specifies delivery to a local file or directory, either from a filter or from a
33964 conventional forward file. This option is forced to be true if <option>one_time</option> is
33965 set. It applies to Sieve filters as well as to Exim filters, but if true, it
33966 locks out the Sieve’s <quote>keep</quote> facility.
33969 <indexterm role="option">
33970 <primary><option>forbid_filter_dlfunc</option></primary>
33973 <informaltable frame="all">
33974 <tgroup cols="4" colsep="0" rowsep="0">
33975 <colspec colwidth="8*" align="left"/>
33976 <colspec colwidth="6*" align="center"/>
33977 <colspec colwidth="6*" align="center"/>
33978 <colspec colwidth="6*" align="right"/>
33981 <entry><option>forbid_filter_dlfunc</option></entry>
33982 <entry>Use: <emphasis>redirect</emphasis></entry>
33983 <entry>Type: <emphasis>boolean</emphasis></entry>
33984 <entry>Default: <emphasis>false</emphasis></entry>
33990 <indexterm role="concept">
33991 <primary>filter</primary>
33992 <secondary>locking out certain features</secondary>
33994 If this option is true, string expansions in Exim filters are not allowed to
33995 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
33999 <indexterm role="option">
34000 <primary><option>forbid_filter_existstest</option></primary>
34003 <informaltable frame="all">
34004 <tgroup cols="4" colsep="0" rowsep="0">
34005 <colspec colwidth="8*" align="left"/>
34006 <colspec colwidth="6*" align="center"/>
34007 <colspec colwidth="6*" align="center"/>
34008 <colspec colwidth="6*" align="right"/>
34011 <entry><option>forbid_filter_existstest</option></entry>
34012 <entry>Use: <emphasis>redirect</emphasis></entry>
34013 <entry>Type: <emphasis>boolean</emphasis></entry>
34014 <entry>Default: <emphasis>false</emphasis></entry>
34020 <indexterm role="concept">
34021 <primary>expansion</primary>
34022 <secondary>statting a file</secondary>
34024 If this option is true, string expansions in Exim filters are not allowed to
34025 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
34028 <indexterm role="option">
34029 <primary><option>forbid_filter_logwrite</option></primary>
34032 <informaltable frame="all">
34033 <tgroup cols="4" colsep="0" rowsep="0">
34034 <colspec colwidth="8*" align="left"/>
34035 <colspec colwidth="6*" align="center"/>
34036 <colspec colwidth="6*" align="center"/>
34037 <colspec colwidth="6*" align="right"/>
34040 <entry><option>forbid_filter_logwrite</option></entry>
34041 <entry>Use: <emphasis>redirect</emphasis></entry>
34042 <entry>Type: <emphasis>boolean</emphasis></entry>
34043 <entry>Default: <emphasis>false</emphasis></entry>
34049 If this option is true, use of the logging facility in Exim filters is not
34050 permitted. Logging is in any case available only if the filter is being run
34051 under some unprivileged uid (which is normally the case for ordinary users’
34052 <filename>.forward</filename> files).
34055 <indexterm role="option">
34056 <primary><option>forbid_filter_lookup</option></primary>
34059 <informaltable frame="all">
34060 <tgroup cols="4" colsep="0" rowsep="0">
34061 <colspec colwidth="8*" align="left"/>
34062 <colspec colwidth="6*" align="center"/>
34063 <colspec colwidth="6*" align="center"/>
34064 <colspec colwidth="6*" align="right"/>
34067 <entry><option>forbid_filter_lookup</option></entry>
34068 <entry>Use: <emphasis>redirect</emphasis></entry>
34069 <entry>Type: <emphasis>boolean</emphasis></entry>
34070 <entry>Default: <emphasis>false</emphasis></entry>
34076 If this option is true, string expansions in Exim filter files are not allowed
34077 to make use of <option>lookup</option> items.
34080 <indexterm role="option">
34081 <primary><option>forbid_filter_perl</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_filter_perl</option></entry>
34093 <entry>Use: <emphasis>redirect</emphasis></entry>
34094 <entry>Type: <emphasis>boolean</emphasis></entry>
34095 <entry>Default: <emphasis>false</emphasis></entry>
34101 This option has an effect only if Exim is built with embedded Perl support. If
34102 it is true, string expansions in Exim filter files are not allowed to make use
34103 of the embedded Perl support.
34106 <indexterm role="option">
34107 <primary><option>forbid_filter_readfile</option></primary>
34110 <informaltable frame="all">
34111 <tgroup cols="4" colsep="0" rowsep="0">
34112 <colspec colwidth="8*" align="left"/>
34113 <colspec colwidth="6*" align="center"/>
34114 <colspec colwidth="6*" align="center"/>
34115 <colspec colwidth="6*" align="right"/>
34118 <entry><option>forbid_filter_readfile</option></entry>
34119 <entry>Use: <emphasis>redirect</emphasis></entry>
34120 <entry>Type: <emphasis>boolean</emphasis></entry>
34121 <entry>Default: <emphasis>false</emphasis></entry>
34127 If this option is true, string expansions in Exim filter files are not allowed
34128 to make use of <option>readfile</option> items.
34131 <indexterm role="option">
34132 <primary><option>forbid_filter_readsocket</option></primary>
34135 <informaltable frame="all">
34136 <tgroup cols="4" colsep="0" rowsep="0">
34137 <colspec colwidth="8*" align="left"/>
34138 <colspec colwidth="6*" align="center"/>
34139 <colspec colwidth="6*" align="center"/>
34140 <colspec colwidth="6*" align="right"/>
34143 <entry><option>forbid_filter_readsocket</option></entry>
34144 <entry>Use: <emphasis>redirect</emphasis></entry>
34145 <entry>Type: <emphasis>boolean</emphasis></entry>
34146 <entry>Default: <emphasis>false</emphasis></entry>
34152 If this option is true, string expansions in Exim filter files are not allowed
34153 to make use of <option>readsocket</option> items.
34156 <indexterm role="option">
34157 <primary><option>forbid_filter_reply</option></primary>
34160 <informaltable frame="all">
34161 <tgroup cols="4" colsep="0" rowsep="0">
34162 <colspec colwidth="8*" align="left"/>
34163 <colspec colwidth="6*" align="center"/>
34164 <colspec colwidth="6*" align="center"/>
34165 <colspec colwidth="6*" align="right"/>
34168 <entry><option>forbid_filter_reply</option></entry>
34169 <entry>Use: <emphasis>redirect</emphasis></entry>
34170 <entry>Type: <emphasis>boolean</emphasis></entry>
34171 <entry>Default: <emphasis>false</emphasis></entry>
34177 If this option is true, this router may not generate an automatic reply
34178 message. Automatic replies can be generated only from Exim or Sieve filter
34179 files, not from traditional forward files. This option is forced to be true if
34180 <option>one_time</option> is set.
34183 <indexterm role="option">
34184 <primary><option>forbid_filter_run</option></primary>
34187 <informaltable frame="all">
34188 <tgroup cols="4" colsep="0" rowsep="0">
34189 <colspec colwidth="8*" align="left"/>
34190 <colspec colwidth="6*" align="center"/>
34191 <colspec colwidth="6*" align="center"/>
34192 <colspec colwidth="6*" align="right"/>
34195 <entry><option>forbid_filter_run</option></entry>
34196 <entry>Use: <emphasis>redirect</emphasis></entry>
34197 <entry>Type: <emphasis>boolean</emphasis></entry>
34198 <entry>Default: <emphasis>false</emphasis></entry>
34204 If this option is true, string expansions in Exim filter files are not allowed
34205 to make use of <option>run</option> items.
34208 <indexterm role="option">
34209 <primary><option>forbid_include</option></primary>
34212 <informaltable frame="all">
34213 <tgroup cols="4" colsep="0" rowsep="0">
34214 <colspec colwidth="8*" align="left"/>
34215 <colspec colwidth="6*" align="center"/>
34216 <colspec colwidth="6*" align="center"/>
34217 <colspec colwidth="6*" align="right"/>
34220 <entry><option>forbid_include</option></entry>
34221 <entry>Use: <emphasis>redirect</emphasis></entry>
34222 <entry>Type: <emphasis>boolean</emphasis></entry>
34223 <entry>Default: <emphasis>false</emphasis></entry>
34229 If this option is true, items of the form
34231 <literallayout class="monospaced">
34232 :include:<path name>
34235 are not permitted in non-filter redirection lists.
34238 <indexterm role="option">
34239 <primary><option>forbid_pipe</option></primary>
34242 <informaltable frame="all">
34243 <tgroup cols="4" colsep="0" rowsep="0">
34244 <colspec colwidth="8*" align="left"/>
34245 <colspec colwidth="6*" align="center"/>
34246 <colspec colwidth="6*" align="center"/>
34247 <colspec colwidth="6*" align="right"/>
34250 <entry><option>forbid_pipe</option></entry>
34251 <entry>Use: <emphasis>redirect</emphasis></entry>
34252 <entry>Type: <emphasis>boolean</emphasis></entry>
34253 <entry>Default: <emphasis>false</emphasis></entry>
34259 <indexterm role="concept">
34260 <primary>delivery</primary>
34261 <secondary>to pipe; forbidding</secondary>
34263 If this option is true, this router may not generate a new address which
34264 specifies delivery to a pipe, either from an Exim filter or from a conventional
34265 forward file. This option is forced to be true if <option>one_time</option> is set.
34268 <indexterm role="option">
34269 <primary><option>forbid_sieve_filter</option></primary>
34272 <informaltable frame="all">
34273 <tgroup cols="4" colsep="0" rowsep="0">
34274 <colspec colwidth="8*" align="left"/>
34275 <colspec colwidth="6*" align="center"/>
34276 <colspec colwidth="6*" align="center"/>
34277 <colspec colwidth="6*" align="right"/>
34280 <entry><option>forbid_sieve_filter</option></entry>
34281 <entry>Use: <emphasis>redirect</emphasis></entry>
34282 <entry>Type: <emphasis>boolean</emphasis></entry>
34283 <entry>Default: <emphasis>false</emphasis></entry>
34289 If this option is set true, only Exim filters are permitted when
34290 <option>allow_filter</option> is true.
34293 <indexterm role="concept">
34294 <primary>SMTP</primary>
34295 <secondary>error codes</secondary>
34297 <indexterm role="option">
34298 <primary><option>forbid_smtp_code</option></primary>
34301 <informaltable frame="all">
34302 <tgroup cols="4" colsep="0" rowsep="0">
34303 <colspec colwidth="8*" align="left"/>
34304 <colspec colwidth="6*" align="center"/>
34305 <colspec colwidth="6*" align="center"/>
34306 <colspec colwidth="6*" align="right"/>
34309 <entry><option>forbid_smtp_code</option></entry>
34310 <entry>Use: <emphasis>redirect</emphasis></entry>
34311 <entry>Type: <emphasis>boolean</emphasis></entry>
34312 <entry>Default: <emphasis>false</emphasis></entry>
34318 If this option is set true, any SMTP error codes that are present at the start
34319 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
34320 the default codes (451 and 550, respectively) are always used.
34323 <indexterm role="option">
34324 <primary><option>hide_child_in_errmsg</option></primary>
34327 <informaltable frame="all">
34328 <tgroup cols="4" colsep="0" rowsep="0">
34329 <colspec colwidth="8*" align="left"/>
34330 <colspec colwidth="6*" align="center"/>
34331 <colspec colwidth="6*" align="center"/>
34332 <colspec colwidth="6*" align="right"/>
34335 <entry><option>hide_child_in_errmsg</option></entry>
34336 <entry>Use: <emphasis>redirect</emphasis></entry>
34337 <entry>Type: <emphasis>boolean</emphasis></entry>
34338 <entry>Default: <emphasis>false</emphasis></entry>
34344 <indexterm role="concept">
34345 <primary>bounce message</primary>
34346 <secondary>redirection details; suppressing</secondary>
34348 If this option is true, it prevents Exim from quoting a child address if it
34349 generates a bounce or delay message for it. Instead it says <quote>an address
34350 generated from <<emphasis>the top level address</emphasis>></quote>. Of course, this applies only to
34351 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
34352 bounce may well quote the generated address.
34355 <indexterm role="option">
34356 <primary><option>ignore_eacces</option></primary>
34359 <informaltable frame="all">
34360 <tgroup cols="4" colsep="0" rowsep="0">
34361 <colspec colwidth="8*" align="left"/>
34362 <colspec colwidth="6*" align="center"/>
34363 <colspec colwidth="6*" align="center"/>
34364 <colspec colwidth="6*" align="right"/>
34367 <entry><option>ignore_eacces</option></entry>
34368 <entry>Use: <emphasis>redirect</emphasis></entry>
34369 <entry>Type: <emphasis>boolean</emphasis></entry>
34370 <entry>Default: <emphasis>false</emphasis></entry>
34376 <indexterm role="concept">
34377 <primary>EACCES</primary>
34379 If this option is set and an attempt to open a redirection file yields the
34380 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
34381 file did not exist.
34384 <indexterm role="option">
34385 <primary><option>ignore_enotdir</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>ignore_enotdir</option></entry>
34397 <entry>Use: <emphasis>redirect</emphasis></entry>
34398 <entry>Type: <emphasis>boolean</emphasis></entry>
34399 <entry>Default: <emphasis>false</emphasis></entry>
34405 <indexterm role="concept">
34406 <primary>ENOTDIR</primary>
34408 If this option is set and an attempt to open a redirection file yields the
34409 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
34410 router behaves as if the file did not exist.
34413 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
34414 router that has the <option>file</option> option set discovers that the file does not exist
34415 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
34416 against unmounted NFS directories. If the parent can not be statted, delivery
34417 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
34418 is set, because that option tells Exim to ignore <quote>something on the path is not
34419 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
34420 that some operating systems give ENOENT where others give ENOTDIR.
34423 <indexterm role="option">
34424 <primary><option>include_directory</option></primary>
34427 <informaltable frame="all">
34428 <tgroup cols="4" colsep="0" rowsep="0">
34429 <colspec colwidth="8*" align="left"/>
34430 <colspec colwidth="6*" align="center"/>
34431 <colspec colwidth="6*" align="center"/>
34432 <colspec colwidth="6*" align="right"/>
34435 <entry><option>include_directory</option></entry>
34436 <entry>Use: <emphasis>redirect</emphasis></entry>
34437 <entry>Type: <emphasis>string</emphasis></entry>
34438 <entry>Default: <emphasis>unset</emphasis></entry>
34444 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
34445 redirection list must start with this directory.
34448 <indexterm role="option">
34449 <primary><option>modemask</option></primary>
34452 <informaltable frame="all">
34453 <tgroup cols="4" colsep="0" rowsep="0">
34454 <colspec colwidth="8*" align="left"/>
34455 <colspec colwidth="6*" align="center"/>
34456 <colspec colwidth="6*" align="center"/>
34457 <colspec colwidth="6*" align="right"/>
34460 <entry><option>modemask</option></entry>
34461 <entry>Use: <emphasis>redirect</emphasis></entry>
34462 <entry>Type: <emphasis>octal integer</emphasis></entry>
34463 <entry>Default: <emphasis>022</emphasis></entry>
34469 This specifies mode bits which must not be set for a file specified by the
34470 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
34473 <indexterm role="option">
34474 <primary><option>one_time</option></primary>
34477 <informaltable frame="all">
34478 <tgroup cols="4" colsep="0" rowsep="0">
34479 <colspec colwidth="8*" align="left"/>
34480 <colspec colwidth="6*" align="center"/>
34481 <colspec colwidth="6*" align="center"/>
34482 <colspec colwidth="6*" align="right"/>
34485 <entry><option>one_time</option></entry>
34486 <entry>Use: <emphasis>redirect</emphasis></entry>
34487 <entry>Type: <emphasis>boolean</emphasis></entry>
34488 <entry>Default: <emphasis>false</emphasis></entry>
34494 <indexterm role="concept">
34495 <primary>one-time aliasing/forwarding expansion</primary>
34497 <indexterm role="concept">
34498 <primary>alias file</primary>
34499 <secondary>one-time expansion</secondary>
34501 <indexterm role="concept">
34502 <primary>forward file</primary>
34503 <secondary>one-time expansion</secondary>
34505 <indexterm role="concept">
34506 <primary>mailing lists</primary>
34507 <secondary>one-time expansion</secondary>
34509 <indexterm role="concept">
34510 <primary>address redirection</primary>
34511 <secondary>one-time expansion</secondary>
34513 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
34514 files each time it tries to deliver a message causes a problem when one or more
34515 of the generated addresses fails be delivered at the first attempt. The problem
34516 is not one of duplicate delivery – Exim is clever enough to handle that –
34517 but of what happens when the redirection list changes during the time that the
34518 message is on Exim’s queue. This is particularly true in the case of mailing
34519 lists, where new subscribers might receive copies of messages that were posted
34520 before they subscribed.
34523 If <option>one_time</option> is set and any addresses generated by the router fail to
34524 deliver at the first attempt, the failing addresses are added to the message as
34525 <quote>top level</quote> addresses, and the parent address that generated them is marked
34526 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
34530 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
34531 router would be lost if delivery did not succeed at the first attempt. For this
34532 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
34533 permitted when <option>one_time</option> is set.
34536 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
34537 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
34538 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
34541 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
34542 <option>one_time</option>.
34545 The original top-level address is remembered with each of the generated
34546 addresses, and is output in any log messages. However, any intermediate parent
34547 addresses are not recorded. This makes a difference to the log only if
34548 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
34549 typically be used for mailing lists, where there is normally just one level of
34553 <indexterm role="option">
34554 <primary><option>owners</option></primary>
34557 <informaltable frame="all">
34558 <tgroup cols="4" colsep="0" rowsep="0">
34559 <colspec colwidth="8*" align="left"/>
34560 <colspec colwidth="6*" align="center"/>
34561 <colspec colwidth="6*" align="center"/>
34562 <colspec colwidth="6*" align="right"/>
34565 <entry><option>owners</option></entry>
34566 <entry>Use: <emphasis>redirect</emphasis></entry>
34567 <entry>Type: <emphasis>string list</emphasis></entry>
34568 <entry>Default: <emphasis>unset</emphasis></entry>
34574 <indexterm role="concept">
34575 <primary>ownership</primary>
34576 <secondary>alias file</secondary>
34578 <indexterm role="concept">
34579 <primary>ownership</primary>
34580 <secondary>forward file</secondary>
34582 <indexterm role="concept">
34583 <primary>alias file</primary>
34584 <secondary>ownership</secondary>
34586 <indexterm role="concept">
34587 <primary>forward file</primary>
34588 <secondary>ownership</secondary>
34590 This specifies a list of permitted owners for the file specified by <option>file</option>.
34591 This list is in addition to the local user when <option>check_local_user</option> is set.
34592 See <option>check_owner</option> above.
34595 <indexterm role="option">
34596 <primary><option>owngroups</option></primary>
34599 <informaltable frame="all">
34600 <tgroup cols="4" colsep="0" rowsep="0">
34601 <colspec colwidth="8*" align="left"/>
34602 <colspec colwidth="6*" align="center"/>
34603 <colspec colwidth="6*" align="center"/>
34604 <colspec colwidth="6*" align="right"/>
34607 <entry><option>owngroups</option></entry>
34608 <entry>Use: <emphasis>redirect</emphasis></entry>
34609 <entry>Type: <emphasis>string list</emphasis></entry>
34610 <entry>Default: <emphasis>unset</emphasis></entry>
34616 This specifies a list of permitted groups for the file specified by <option>file</option>.
34617 The list is in addition to the local user’s primary group when
34618 <option>check_local_user</option> is set. See <option>check_group</option> above.
34621 <indexterm role="option">
34622 <primary><option>pipe_transport</option></primary>
34625 <informaltable frame="all">
34626 <tgroup cols="4" colsep="0" rowsep="0">
34627 <colspec colwidth="8*" align="left"/>
34628 <colspec colwidth="6*" align="center"/>
34629 <colspec colwidth="6*" align="center"/>
34630 <colspec colwidth="6*" align="right"/>
34633 <entry><option>pipe_transport</option></entry>
34634 <entry>Use: <emphasis>redirect</emphasis></entry>
34635 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34636 <entry>Default: <emphasis>unset</emphasis></entry>
34642 <indexterm role="variable">
34643 <primary><varname>$address_pipe</varname></primary>
34645 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
34646 starting with a vertical bar character is specified as a new <quote>address</quote>. The
34647 transport used is specified by this option, which, after expansion, must be the
34648 name of a configured transport. This should normally be a <command>pipe</command> transport.
34649 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
34652 <indexterm role="option">
34653 <primary><option>qualify_domain</option></primary>
34656 <informaltable frame="all">
34657 <tgroup cols="4" colsep="0" rowsep="0">
34658 <colspec colwidth="8*" align="left"/>
34659 <colspec colwidth="6*" align="center"/>
34660 <colspec colwidth="6*" align="center"/>
34661 <colspec colwidth="6*" align="right"/>
34664 <entry><option>qualify_domain</option></entry>
34665 <entry>Use: <emphasis>redirect</emphasis></entry>
34666 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34667 <entry>Default: <emphasis>unset</emphasis></entry>
34673 <indexterm role="variable">
34674 <primary><varname>$qualify_recipient</varname></primary>
34676 If this option is set, and an unqualified address (one without a domain) is
34677 generated, and that address would normally be qualified by the global setting
34678 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
34679 expanding this string. If the expansion fails, the router declines. If you want
34680 to revert to the default, you can have the expansion generate
34681 <varname>$qualify_recipient</varname>.
34684 This option applies to all unqualified addresses generated by Exim filters,
34685 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
34686 not preceded by a backslash. Sieve filters cannot generate unqualified
34690 <indexterm role="option">
34691 <primary><option>qualify_preserve_domain</option></primary>
34694 <informaltable frame="all">
34695 <tgroup cols="4" colsep="0" rowsep="0">
34696 <colspec colwidth="8*" align="left"/>
34697 <colspec colwidth="6*" align="center"/>
34698 <colspec colwidth="6*" align="center"/>
34699 <colspec colwidth="6*" align="right"/>
34702 <entry><option>qualify_preserve_domain</option></entry>
34703 <entry>Use: <emphasis>redirect</emphasis></entry>
34704 <entry>Type: <emphasis>boolean</emphasis></entry>
34705 <entry>Default: <emphasis>false</emphasis></entry>
34711 <indexterm role="concept">
34712 <primary>domain</primary>
34713 <secondary>in redirection; preserving</secondary>
34715 <indexterm role="concept">
34716 <primary>preserving domain in redirection</primary>
34718 <indexterm role="concept">
34719 <primary>address redirection</primary>
34720 <secondary>domain; preserving</secondary>
34722 If this option is set, the router’s local <option>qualify_domain</option> option must not be
34723 set (a configuration error occurs if it is). If an unqualified address (one
34724 without a domain) is generated, it is qualified with the domain of the parent
34725 address (the immediately preceding ancestor) instead of the global
34726 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
34727 this applies whether or not the address is preceded by a backslash.
34730 <indexterm role="option">
34731 <primary><option>repeat_use</option></primary>
34734 <informaltable frame="all">
34735 <tgroup cols="4" colsep="0" rowsep="0">
34736 <colspec colwidth="8*" align="left"/>
34737 <colspec colwidth="6*" align="center"/>
34738 <colspec colwidth="6*" align="center"/>
34739 <colspec colwidth="6*" align="right"/>
34742 <entry><option>repeat_use</option></entry>
34743 <entry>Use: <emphasis>redirect</emphasis></entry>
34744 <entry>Type: <emphasis>boolean</emphasis></entry>
34745 <entry>Default: <emphasis>true</emphasis></entry>
34751 If this option is set false, the router is skipped for a child address that has
34752 any ancestor that was routed by this router. This test happens before any of
34753 the other preconditions are tested. Exim’s default anti-looping rules skip
34754 only when the ancestor is the same as the current address. See also
34755 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
34758 <indexterm role="option">
34759 <primary><option>reply_transport</option></primary>
34762 <informaltable frame="all">
34763 <tgroup cols="4" colsep="0" rowsep="0">
34764 <colspec colwidth="8*" align="left"/>
34765 <colspec colwidth="6*" align="center"/>
34766 <colspec colwidth="6*" align="center"/>
34767 <colspec colwidth="6*" align="right"/>
34770 <entry><option>reply_transport</option></entry>
34771 <entry>Use: <emphasis>redirect</emphasis></entry>
34772 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34773 <entry>Default: <emphasis>unset</emphasis></entry>
34779 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
34780 <option>vacation</option> command is used in a filter file. The transport used is specified
34781 by this option, which, after expansion, must be the name of a configured
34782 transport. This should normally be an <command>autoreply</command> transport. Other transports
34783 are unlikely to do anything sensible or useful.
34786 <indexterm role="option">
34787 <primary><option>rewrite</option></primary>
34790 <informaltable frame="all">
34791 <tgroup cols="4" colsep="0" rowsep="0">
34792 <colspec colwidth="8*" align="left"/>
34793 <colspec colwidth="6*" align="center"/>
34794 <colspec colwidth="6*" align="center"/>
34795 <colspec colwidth="6*" align="right"/>
34798 <entry><option>rewrite</option></entry>
34799 <entry>Use: <emphasis>redirect</emphasis></entry>
34800 <entry>Type: <emphasis>boolean</emphasis></entry>
34801 <entry>Default: <emphasis>true</emphasis></entry>
34807 <indexterm role="concept">
34808 <primary>address redirection</primary>
34809 <secondary>disabling rewriting</secondary>
34811 If this option is set false, addresses generated by the router are not
34812 subject to address rewriting. Otherwise, they are treated like new addresses
34813 and are rewritten according to the global rewriting rules.
34816 <indexterm role="option">
34817 <primary><option>sieve_subaddress</option></primary>
34820 <informaltable frame="all">
34821 <tgroup cols="4" colsep="0" rowsep="0">
34822 <colspec colwidth="8*" align="left"/>
34823 <colspec colwidth="6*" align="center"/>
34824 <colspec colwidth="6*" align="center"/>
34825 <colspec colwidth="6*" align="right"/>
34828 <entry><option>sieve_subaddress</option></entry>
34829 <entry>Use: <emphasis>redirect</emphasis></entry>
34830 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34831 <entry>Default: <emphasis>unset</emphasis></entry>
34837 The value of this option is passed to a Sieve filter to specify the
34838 :subaddress part of an address.
34841 <indexterm role="option">
34842 <primary><option>sieve_useraddress</option></primary>
34845 <informaltable frame="all">
34846 <tgroup cols="4" colsep="0" rowsep="0">
34847 <colspec colwidth="8*" align="left"/>
34848 <colspec colwidth="6*" align="center"/>
34849 <colspec colwidth="6*" align="center"/>
34850 <colspec colwidth="6*" align="right"/>
34853 <entry><option>sieve_useraddress</option></entry>
34854 <entry>Use: <emphasis>redirect</emphasis></entry>
34855 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34856 <entry>Default: <emphasis>unset</emphasis></entry>
34862 The value of this option is passed to a Sieve filter to specify the :user part
34863 of an address. However, if it is unset, the entire original local part
34864 (including any prefix or suffix) is used for :user.
34867 <indexterm role="option">
34868 <primary><option>sieve_vacation_directory</option></primary>
34871 <informaltable frame="all">
34872 <tgroup cols="4" colsep="0" rowsep="0">
34873 <colspec colwidth="8*" align="left"/>
34874 <colspec colwidth="6*" align="center"/>
34875 <colspec colwidth="6*" align="center"/>
34876 <colspec colwidth="6*" align="right"/>
34879 <entry><option>sieve_vacation_directory</option></entry>
34880 <entry>Use: <emphasis>redirect</emphasis></entry>
34881 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34882 <entry>Default: <emphasis>unset</emphasis></entry>
34888 <indexterm role="concept">
34889 <primary>Sieve filter</primary>
34890 <secondary>vacation directory</secondary>
34892 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
34893 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
34894 (do not put anything else in that directory), and ensure that the
34895 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
34896 needs their own directory; Exim will create it if necessary.
34899 <indexterm role="option">
34900 <primary><option>skip_syntax_errors</option></primary>
34903 <informaltable frame="all">
34904 <tgroup cols="4" colsep="0" rowsep="0">
34905 <colspec colwidth="8*" align="left"/>
34906 <colspec colwidth="6*" align="center"/>
34907 <colspec colwidth="6*" align="center"/>
34908 <colspec colwidth="6*" align="right"/>
34911 <entry><option>skip_syntax_errors</option></entry>
34912 <entry>Use: <emphasis>redirect</emphasis></entry>
34913 <entry>Type: <emphasis>boolean</emphasis></entry>
34914 <entry>Default: <emphasis>false</emphasis></entry>
34920 <indexterm role="concept">
34921 <primary>forward file</primary>
34922 <secondary>broken</secondary>
34924 <indexterm role="concept">
34925 <primary>address redirection</primary>
34926 <secondary>broken files</secondary>
34928 <indexterm role="concept">
34929 <primary>alias file</primary>
34930 <secondary>broken</secondary>
34932 <indexterm role="concept">
34933 <primary>broken alias or forward files</primary>
34935 <indexterm role="concept">
34936 <primary>ignoring faulty addresses</primary>
34938 <indexterm role="concept">
34939 <primary>skipping faulty addresses</primary>
34941 <indexterm role="concept">
34942 <primary>error</primary>
34943 <secondary>skipping bad syntax</secondary>
34945 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
34946 non-filter redirection data are skipped, and each failing address is logged. If
34947 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
34948 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
34949 are expanded and placed at the head of the error message generated by
34950 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
34951 be the same address as the generic <option>errors_to</option> option. The
34952 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
34955 If all the addresses in a redirection list are skipped because of syntax
34956 errors, the router declines to handle the original address, and it is passed to
34957 the following routers.
34960 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
34961 error in the filter causes filtering to be abandoned without any action being
34962 taken. The incident is logged, and the router declines to handle the address,
34963 so it is passed to the following routers.
34966 <indexterm role="concept">
34967 <primary>Sieve filter</primary>
34968 <secondary>syntax errors in</secondary>
34970 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
34971 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
34972 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
34975 <option>skip_syntax_errors</option> can be used to specify that errors in users’ forward
34976 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
34977 option, used with an address that does not get redirected, can be used to
34978 notify users of these errors, by means of a router like this:
34980 <literallayout class="monospaced">
34985 file = $home/.forward
34986 file_transport = address_file
34987 pipe_transport = address_pipe
34988 reply_transport = address_reply
34991 syntax_errors_to = real-$local_part@$domain
34992 syntax_errors_text = \
34993 This is an automatically generated message. An error has\n\
34994 been found in your .forward file. Details of the error are\n\
34995 reported below. While this error persists, you will receive\n\
34996 a copy of this message for every message that is addressed\n\
34997 to you. If your .forward file is a filter file, or if it is\n\
34998 a non-filter file containing no valid forwarding addresses,\n\
34999 a copy of each incoming message will be put in your normal\n\
35000 mailbox. If a non-filter file contains at least one valid\n\
35001 forwarding address, forwarding to the valid addresses will\n\
35002 happen, and those will be the only deliveries that occur.
35005 You also need a router to ensure that local addresses that are prefixed by
35006 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
35007 put this immediately before the <command>userforward</command> router:
35009 <literallayout class="monospaced">
35013 local_part_prefix = real-
35014 transport = local_delivery
35017 For security, it would probably be a good idea to restrict the use of this
35018 router to locally-generated messages, using a condition such as this:
35020 <literallayout class="monospaced">
35021 condition = ${if match {$sender_host_address}\
35022 {\N^(|127\.0\.0\.1)$\N}}
35025 <indexterm role="option">
35026 <primary><option>syntax_errors_text</option></primary>
35029 <informaltable frame="all">
35030 <tgroup cols="4" colsep="0" rowsep="0">
35031 <colspec colwidth="8*" align="left"/>
35032 <colspec colwidth="6*" align="center"/>
35033 <colspec colwidth="6*" align="center"/>
35034 <colspec colwidth="6*" align="right"/>
35037 <entry><option>syntax_errors_text</option></entry>
35038 <entry>Use: <emphasis>redirect</emphasis></entry>
35039 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35040 <entry>Default: <emphasis>unset</emphasis></entry>
35046 See <option>skip_syntax_errors</option> above.
35049 <indexterm role="option">
35050 <primary><option>syntax_errors_to</option></primary>
35053 <informaltable frame="all">
35054 <tgroup cols="4" colsep="0" rowsep="0">
35055 <colspec colwidth="8*" align="left"/>
35056 <colspec colwidth="6*" align="center"/>
35057 <colspec colwidth="6*" align="center"/>
35058 <colspec colwidth="6*" align="right"/>
35061 <entry><option>syntax_errors_to</option></entry>
35062 <entry>Use: <emphasis>redirect</emphasis></entry>
35063 <entry>Type: <emphasis>string</emphasis></entry>
35064 <entry>Default: <emphasis>unset</emphasis></entry>
35070 See <option>skip_syntax_errors</option> above.
35071 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
35072 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
35077 <chapter id="CHAPenvironment">
35078 <title>Environment for running local transports</title>
35079 <titleabbrev>Environment for local transports</titleabbrev>
35081 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
35082 <primary>local transports</primary>
35083 <secondary>environment for</secondary>
35085 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
35086 <primary>environment for local transports</primary>
35088 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
35089 <primary>transport</primary>
35090 <secondary>local; environment for</secondary>
35092 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
35093 transport can be thought of as similar to a pipe.) Exim always runs transports
35094 in subprocesses, under specified uids and gids. Typical deliveries to local
35095 mailboxes run under the uid and gid of the local user.
35098 Exim also sets a specific current directory while running the transport; for
35099 some transports a home directory setting is also relevant. The <command>pipe</command>
35100 transport is the only one that sets up environment variables; see section
35101 <xref linkend="SECTpipeenv"/> for details.
35104 The values used for the uid, gid, and the directories may come from several
35105 different places. In many cases, the router that handles the address associates
35106 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
35107 or <option>user</option> options. However, values may also be given in the transport’s own
35108 configuration, and these override anything that comes from the router.
35110 <section id="SECID131">
35111 <title>Concurrent deliveries</title>
35113 <indexterm role="concept">
35114 <primary>concurrent deliveries</primary>
35116 <indexterm role="concept">
35117 <primary>simultaneous deliveries</primary>
35119 If two different messages for the same local recipient arrive more or less
35120 simultaneously, the two delivery processes are likely to run concurrently. When
35121 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
35122 rules to stop concurrent processes from writing to the same file at the same
35126 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
35127 locking that is needed. Here is a silly example:
35129 <literallayout class="monospaced">
35132 command = /bin/sh -c 'cat >>/some/file'
35135 This is supposed to write the message at the end of the file. However, if two
35136 messages arrive at the same time, the file will be scrambled. You can use the
35137 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
35138 file using the same algorithm that Exim itself uses.
35141 <section id="SECTenvuidgid">
35142 <title>Uids and gids</title>
35144 <indexterm role="concept">
35145 <primary>local transports</primary>
35146 <secondary>uid and gid</secondary>
35148 <indexterm role="concept">
35149 <primary>transport</primary>
35150 <secondary>local; uid and gid</secondary>
35152 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
35153 overrides any group that the router set in the address, even if <option>user</option> is not
35154 set for the transport. This makes it possible, for example, to run local mail
35155 delivery under the uid of the recipient (set by the router), but in a special
35156 group (set by the transport). For example:
35158 <literallayout class="monospaced">
35160 # User/group are set by check_local_user in this router
35164 transport = group_delivery
35167 # This transport overrides the group
35169 driver = appendfile
35170 file = /var/spool/mail/$local_part
35174 If <option>user</option> is set for a transport, its value overrides what is set in the
35175 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
35176 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
35180 <indexterm role="option">
35181 <primary><option>initgroups</option></primary>
35183 When the uid is taken from the transport’s configuration, the <function>initgroups()</function>
35184 function is called for the groups associated with that uid if the
35185 <option>initgroups</option> option is set for the transport. When the uid is not specified
35186 by the transport, but is associated with the address by a router, the option
35187 for calling <function>initgroups()</function> is taken from the router configuration.
35190 <indexterm role="concept">
35191 <primary><command>pipe</command> transport</primary>
35192 <secondary>uid for</secondary>
35194 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
35195 is set and <option>user</option> is not set, the uid of the process that called Exim to
35196 receive the message is used, and if <option>group</option> is not set, the corresponding
35197 original gid is also used.
35200 This is the detailed preference order for obtaining a gid; the first of the
35201 following that is set is used:
35206 A <option>group</option> setting of the transport;
35211 A <option>group</option> setting of the router;
35216 A gid associated with a user setting of the router, either as a result of
35217 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
35222 The group associated with a non-numeric <option>user</option> setting of the transport;
35227 In a <command>pipe</command> transport, the creator’s gid if <option>deliver_as_creator</option> is set and
35228 the uid is the creator’s uid;
35233 The Exim gid if the Exim uid is being used as a default.
35238 If, for example, the user is specified numerically on the router and there are
35239 no group settings, no gid is available. In this situation, an error occurs.
35240 This is different for the uid, for which there always is an ultimate default.
35241 The first of the following that is set is used:
35246 A <option>user</option> setting of the transport;
35251 In a <command>pipe</command> transport, the creator’s uid if <option>deliver_as_creator</option> is set;
35256 A <option>user</option> setting of the router;
35261 A <option>check_local_user</option> setting of the router;
35271 Of course, an error will still occur if the uid that is chosen is on the
35272 <option>never_users</option> list.
35275 <section id="SECID132">
35276 <title>Current and home directories</title>
35278 <indexterm role="concept">
35279 <primary>current directory for local transport</primary>
35281 <indexterm role="concept">
35282 <primary>home directory</primary>
35283 <secondary>for local transport</secondary>
35285 <indexterm role="concept">
35286 <primary>transport</primary>
35287 <secondary>local; home directory for</secondary>
35289 <indexterm role="concept">
35290 <primary>transport</primary>
35291 <secondary>local; current directory for</secondary>
35293 Routers may set current and home directories for local transports by means of
35294 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
35295 However, if the transport’s <option>current_directory</option> or <option>home_directory</option> options
35296 are set, they override the router’s values. In detail, the home directory
35297 for a local transport is taken from the first of these values that is set:
35302 The <option>home_directory</option> option on the transport;
35307 The <option>transport_home_directory</option> option on the router;
35312 The password data if <option>check_local_user</option> is set on the router;
35317 The <option>router_home_directory</option> option on the router.
35322 The current directory is taken from the first of these values that is set:
35327 The <option>current_directory</option> option on the transport;
35332 The <option>transport_current_directory</option> option on the router.
35337 If neither the router nor the transport sets a current directory, Exim uses the
35338 value of the home directory, if it is set. Otherwise it sets the current
35339 directory to <filename>/</filename> before running a local transport.
35342 <section id="SECID133">
35343 <title>Expansion variables derived from the address</title>
35345 <indexterm role="variable">
35346 <primary><varname>$domain</varname></primary>
35348 <indexterm role="variable">
35349 <primary><varname>$local_part</varname></primary>
35351 <indexterm role="variable">
35352 <primary><varname>$original_domain</varname></primary>
35354 Normally a local delivery is handling a single address, and in that case the
35355 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
35356 deliveries. However, in some circumstances more than one address may be handled
35357 at once (for example, while writing batch SMTP for onward transmission by some
35358 other means). In this case, the variables associated with the local part are
35359 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
35360 and <varname>$original_domain</varname> is never set.
35361 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
35362 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
35363 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
35368 <chapter id="CHAPtransportgeneric">
35369 <title>Generic options for transports</title>
35371 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
35372 <primary>generic options</primary>
35373 <secondary>transport</secondary>
35375 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
35376 <primary>options</primary>
35377 <secondary>generic; for transports</secondary>
35379 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
35380 <primary>transport</primary>
35381 <secondary>generic options for</secondary>
35383 The following generic options apply to all transports:
35386 <indexterm role="option">
35387 <primary><option>body_only</option></primary>
35390 <informaltable frame="all">
35391 <tgroup cols="4" colsep="0" rowsep="0">
35392 <colspec colwidth="8*" align="left"/>
35393 <colspec colwidth="6*" align="center"/>
35394 <colspec colwidth="6*" align="center"/>
35395 <colspec colwidth="6*" align="right"/>
35398 <entry><option>body_only</option></entry>
35399 <entry>Use: <emphasis>transports</emphasis></entry>
35400 <entry>Type: <emphasis>boolean</emphasis></entry>
35401 <entry>Default: <emphasis>false</emphasis></entry>
35407 <indexterm role="concept">
35408 <primary>transport</primary>
35409 <secondary>body only</secondary>
35411 <indexterm role="concept">
35412 <primary>message</primary>
35413 <secondary>transporting body only</secondary>
35415 <indexterm role="concept">
35416 <primary>body of message</primary>
35417 <secondary>transporting</secondary>
35419 If this option is set, the message’s headers are not transported. It is
35420 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
35421 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
35422 <option>message_suffix</option> should be checked, because this option does not
35423 automatically suppress them.
35426 <indexterm role="option">
35427 <primary><option>current_directory</option></primary>
35430 <informaltable frame="all">
35431 <tgroup cols="4" colsep="0" rowsep="0">
35432 <colspec colwidth="8*" align="left"/>
35433 <colspec colwidth="6*" align="center"/>
35434 <colspec colwidth="6*" align="center"/>
35435 <colspec colwidth="6*" align="right"/>
35438 <entry><option>current_directory</option></entry>
35439 <entry>Use: <emphasis>transports</emphasis></entry>
35440 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35441 <entry>Default: <emphasis>unset</emphasis></entry>
35447 <indexterm role="concept">
35448 <primary>transport</primary>
35449 <secondary>current directory for</secondary>
35451 This specifies the current directory that is to be set while running the
35452 transport, overriding any value that may have been set by the router.
35453 If the expansion fails for any reason, including forced failure, an error is
35454 logged, and delivery is deferred.
35457 <indexterm role="option">
35458 <primary><option>disable_logging</option></primary>
35461 <informaltable frame="all">
35462 <tgroup cols="4" colsep="0" rowsep="0">
35463 <colspec colwidth="8*" align="left"/>
35464 <colspec colwidth="6*" align="center"/>
35465 <colspec colwidth="6*" align="center"/>
35466 <colspec colwidth="6*" align="right"/>
35469 <entry><option>disable_logging</option></entry>
35470 <entry>Use: <emphasis>transports</emphasis></entry>
35471 <entry>Type: <emphasis>boolean</emphasis></entry>
35472 <entry>Default: <emphasis>false</emphasis></entry>
35478 If this option is set true, nothing is logged for any
35479 deliveries by the transport or for any
35480 transport errors. You should not set this option unless you really, really know
35481 what you are doing.
35484 <indexterm role="option">
35485 <primary><option>debug_print</option></primary>
35488 <informaltable frame="all">
35489 <tgroup cols="4" colsep="0" rowsep="0">
35490 <colspec colwidth="8*" align="left"/>
35491 <colspec colwidth="6*" align="center"/>
35492 <colspec colwidth="6*" align="center"/>
35493 <colspec colwidth="6*" align="right"/>
35496 <entry><option>debug_print</option></entry>
35497 <entry>Use: <emphasis>transports</emphasis></entry>
35498 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35499 <entry>Default: <emphasis>unset</emphasis></entry>
35505 <indexterm role="concept">
35506 <primary>testing</primary>
35507 <secondary>variables in drivers</secondary>
35509 If this option is set and debugging is enabled (see the <option>-d</option> command line
35510 option), the string is expanded and included in the debugging output when the
35512 If expansion of the string fails, the error message is written to the debugging
35513 output, and Exim carries on processing.
35514 This facility is provided to help with checking out the values of variables and
35515 so on when debugging driver configurations. For example, if a <option>headers_add</option>
35516 option is not working properly, <option>debug_print</option> could be used to output the
35517 variables it references. A newline is added to the text if it does not end with
35521 <indexterm role="option">
35522 <primary><option>delivery_date_add</option></primary>
35525 <informaltable frame="all">
35526 <tgroup cols="4" colsep="0" rowsep="0">
35527 <colspec colwidth="8*" align="left"/>
35528 <colspec colwidth="6*" align="center"/>
35529 <colspec colwidth="6*" align="center"/>
35530 <colspec colwidth="6*" align="right"/>
35533 <entry><option>delivery_date_add</option></entry>
35534 <entry>Use: <emphasis>transports</emphasis></entry>
35535 <entry>Type: <emphasis>boolean</emphasis></entry>
35536 <entry>Default: <emphasis>false</emphasis></entry>
35542 <indexterm role="concept">
35543 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
35545 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
35546 This gives the actual time the delivery was made. As this is not a standard
35547 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
35548 requests its removal from incoming messages, so that delivered messages can
35549 safely be resent to other recipients.
35552 <indexterm role="option">
35553 <primary><option>driver</option></primary>
35556 <informaltable frame="all">
35557 <tgroup cols="4" colsep="0" rowsep="0">
35558 <colspec colwidth="8*" align="left"/>
35559 <colspec colwidth="6*" align="center"/>
35560 <colspec colwidth="6*" align="center"/>
35561 <colspec colwidth="6*" align="right"/>
35564 <entry><option>driver</option></entry>
35565 <entry>Use: <emphasis>transports</emphasis></entry>
35566 <entry>Type: <emphasis>string</emphasis></entry>
35567 <entry>Default: <emphasis>unset</emphasis></entry>
35573 This specifies which of the available transport drivers is to be used.
35574 There is no default, and this option must be set for every transport.
35577 <indexterm role="option">
35578 <primary><option>envelope_to_add</option></primary>
35581 <informaltable frame="all">
35582 <tgroup cols="4" colsep="0" rowsep="0">
35583 <colspec colwidth="8*" align="left"/>
35584 <colspec colwidth="6*" align="center"/>
35585 <colspec colwidth="6*" align="center"/>
35586 <colspec colwidth="6*" align="right"/>
35589 <entry><option>envelope_to_add</option></entry>
35590 <entry>Use: <emphasis>transports</emphasis></entry>
35591 <entry>Type: <emphasis>boolean</emphasis></entry>
35592 <entry>Default: <emphasis>false</emphasis></entry>
35598 <indexterm role="concept">
35599 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
35601 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
35602 This gives the original address(es) in the incoming envelope that caused this
35603 delivery to happen. More than one address may be present if the transport is
35604 configured to handle several addresses at once, or if more than one original
35605 address was redirected to the same final address. As this is not a standard
35606 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
35607 its removal from incoming messages, so that delivered messages can safely be
35608 resent to other recipients.
35611 <indexterm role="option">
35612 <primary><option>group</option></primary>
35615 <informaltable frame="all">
35616 <tgroup cols="4" colsep="0" rowsep="0">
35617 <colspec colwidth="8*" align="left"/>
35618 <colspec colwidth="6*" align="center"/>
35619 <colspec colwidth="6*" align="center"/>
35620 <colspec colwidth="6*" align="right"/>
35623 <entry><option>group</option></entry>
35624 <entry>Use: <emphasis>transports</emphasis></entry>
35625 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35626 <entry>Default: <emphasis>Exim group</emphasis></entry>
35632 <indexterm role="concept">
35633 <primary>transport</primary>
35634 <secondary>group; specifying</secondary>
35636 This option specifies a gid for running the transport process, overriding any
35637 value that the router supplies, and also overriding any value associated with
35638 <option>user</option> (see below).
35641 <indexterm role="option">
35642 <primary><option>headers_add</option></primary>
35645 <informaltable frame="all">
35646 <tgroup cols="4" colsep="0" rowsep="0">
35647 <colspec colwidth="8*" align="left"/>
35648 <colspec colwidth="6*" align="center"/>
35649 <colspec colwidth="6*" align="center"/>
35650 <colspec colwidth="6*" align="right"/>
35653 <entry><option>headers_add</option></entry>
35654 <entry>Use: <emphasis>transports</emphasis></entry>
35655 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35656 <entry>Default: <emphasis>unset</emphasis></entry>
35662 <indexterm role="concept">
35663 <primary>header lines</primary>
35664 <secondary>adding in transport</secondary>
35666 <indexterm role="concept">
35667 <primary>transport</primary>
35668 <secondary>header lines; adding</secondary>
35670 This option specifies a string of text that is expanded and added to the header
35671 portion of a message as it is transported, as described in section
35672 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
35673 routers. If the result of the expansion is an empty string, or if the expansion
35674 is forced to fail, no action is taken. Other expansion failures are treated as
35675 errors and cause the delivery to be deferred.
35678 <indexterm role="option">
35679 <primary><option>headers_only</option></primary>
35682 <informaltable frame="all">
35683 <tgroup cols="4" colsep="0" rowsep="0">
35684 <colspec colwidth="8*" align="left"/>
35685 <colspec colwidth="6*" align="center"/>
35686 <colspec colwidth="6*" align="center"/>
35687 <colspec colwidth="6*" align="right"/>
35690 <entry><option>headers_only</option></entry>
35691 <entry>Use: <emphasis>transports</emphasis></entry>
35692 <entry>Type: <emphasis>boolean</emphasis></entry>
35693 <entry>Default: <emphasis>false</emphasis></entry>
35699 <indexterm role="concept">
35700 <primary>transport</primary>
35701 <secondary>header lines only</secondary>
35703 <indexterm role="concept">
35704 <primary>message</primary>
35705 <secondary>transporting headers only</secondary>
35707 <indexterm role="concept">
35708 <primary>header lines</primary>
35709 <secondary>transporting</secondary>
35711 If this option is set, the message’s body is not transported. It is mutually
35712 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
35713 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
35714 checked, since this option does not automatically suppress them.
35717 <indexterm role="option">
35718 <primary><option>headers_remove</option></primary>
35721 <informaltable frame="all">
35722 <tgroup cols="4" colsep="0" rowsep="0">
35723 <colspec colwidth="8*" align="left"/>
35724 <colspec colwidth="6*" align="center"/>
35725 <colspec colwidth="6*" align="center"/>
35726 <colspec colwidth="6*" align="right"/>
35729 <entry><option>headers_remove</option></entry>
35730 <entry>Use: <emphasis>transports</emphasis></entry>
35731 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35732 <entry>Default: <emphasis>unset</emphasis></entry>
35738 <indexterm role="concept">
35739 <primary>header lines</primary>
35740 <secondary>removing</secondary>
35742 <indexterm role="concept">
35743 <primary>transport</primary>
35744 <secondary>header lines; removing</secondary>
35746 This option specifies a string that is expanded into a list of header names;
35747 these headers are omitted from the message as it is transported, as described
35748 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
35749 routers. If the result of the expansion is an empty string, or if the expansion
35750 is forced to fail, no action is taken. Other expansion failures are treated as
35751 errors and cause the delivery to be deferred.
35754 <indexterm role="option">
35755 <primary><option>headers_rewrite</option></primary>
35758 <informaltable frame="all">
35759 <tgroup cols="4" colsep="0" rowsep="0">
35760 <colspec colwidth="8*" align="left"/>
35761 <colspec colwidth="6*" align="center"/>
35762 <colspec colwidth="6*" align="center"/>
35763 <colspec colwidth="6*" align="right"/>
35766 <entry><option>headers_rewrite</option></entry>
35767 <entry>Use: <emphasis>transports</emphasis></entry>
35768 <entry>Type: <emphasis>string</emphasis></entry>
35769 <entry>Default: <emphasis>unset</emphasis></entry>
35775 <indexterm role="concept">
35776 <primary>transport</primary>
35777 <secondary>header lines; rewriting</secondary>
35779 <indexterm role="concept">
35780 <primary>rewriting</primary>
35781 <secondary>at transport time</secondary>
35783 This option allows addresses in header lines to be rewritten at transport time,
35784 that is, as the message is being copied to its destination. The contents of the
35785 option are a colon-separated list of rewriting rules. Each rule is in exactly
35786 the same form as one of the general rewriting rules that are applied when a
35787 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
35790 <literallayout class="monospaced">
35791 headers_rewrite = a@b c@d f : \
35795 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
35796 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
35797 header lines just before they are written out at transport time, so they affect
35798 only those copies of the message that pass through the transport. However, only
35799 the message’s original header lines, and any that were added by a system
35800 filter, are rewritten. If a router or transport adds header lines, they are not
35801 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
35802 envelope. You can change the return path using <option>return_path</option>, but you cannot
35803 change envelope recipients at this time.
35806 <indexterm role="option">
35807 <primary><option>home_directory</option></primary>
35810 <informaltable frame="all">
35811 <tgroup cols="4" colsep="0" rowsep="0">
35812 <colspec colwidth="8*" align="left"/>
35813 <colspec colwidth="6*" align="center"/>
35814 <colspec colwidth="6*" align="center"/>
35815 <colspec colwidth="6*" align="right"/>
35818 <entry><option>home_directory</option></entry>
35819 <entry>Use: <emphasis>transports</emphasis></entry>
35820 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35821 <entry>Default: <emphasis>unset</emphasis></entry>
35827 <indexterm role="concept">
35828 <primary>transport</primary>
35829 <secondary>home directory for</secondary>
35831 <indexterm role="variable">
35832 <primary><varname>$home</varname></primary>
35834 This option specifies a home directory setting for a local transport,
35835 overriding any value that may be set by the router. The home directory is
35836 placed in <varname>$home</varname> while expanding the transport’s private options. It is also
35837 used as the current directory if no current directory is set by the
35838 <option>current_directory</option> option on the transport or the
35839 <option>transport_current_directory</option> option on the router. If the expansion fails
35840 for any reason, including forced failure, an error is logged, and delivery is
35844 <indexterm role="option">
35845 <primary><option>initgroups</option></primary>
35848 <informaltable frame="all">
35849 <tgroup cols="4" colsep="0" rowsep="0">
35850 <colspec colwidth="8*" align="left"/>
35851 <colspec colwidth="6*" align="center"/>
35852 <colspec colwidth="6*" align="center"/>
35853 <colspec colwidth="6*" align="right"/>
35856 <entry><option>initgroups</option></entry>
35857 <entry>Use: <emphasis>transports</emphasis></entry>
35858 <entry>Type: <emphasis>boolean</emphasis></entry>
35859 <entry>Default: <emphasis>false</emphasis></entry>
35865 <indexterm role="concept">
35866 <primary>additional groups</primary>
35868 <indexterm role="concept">
35869 <primary>groups</primary>
35870 <secondary>additional</secondary>
35872 <indexterm role="concept">
35873 <primary>transport</primary>
35874 <secondary>group; additional</secondary>
35876 If this option is true and the uid for the delivery process is provided by the
35877 transport, the <function>initgroups()</function> function is called when running the transport
35878 to ensure that any additional groups associated with the uid are set up.
35881 <indexterm role="option">
35882 <primary><option>message_size_limit</option></primary>
35885 <informaltable frame="all">
35886 <tgroup cols="4" colsep="0" rowsep="0">
35887 <colspec colwidth="8*" align="left"/>
35888 <colspec colwidth="6*" align="center"/>
35889 <colspec colwidth="6*" align="center"/>
35890 <colspec colwidth="6*" align="right"/>
35893 <entry><option>message_size_limit</option></entry>
35894 <entry>Use: <emphasis>transports</emphasis></entry>
35895 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35896 <entry>Default: <emphasis>0</emphasis></entry>
35902 <indexterm role="concept">
35903 <primary>limit</primary>
35904 <secondary>message size per transport</secondary>
35906 <indexterm role="concept">
35907 <primary>size</primary>
35908 <secondary>of message, limit</secondary>
35910 <indexterm role="concept">
35911 <primary>transport</primary>
35912 <secondary>message size; limiting</secondary>
35914 This option controls the size of messages passed through the transport. It is
35915 expanded before use; the result of the expansion must be a sequence of decimal
35916 digits, optionally followed by K or M. If the expansion fails for any reason,
35917 including forced failure, or if the result is not of the required form,
35918 delivery is deferred. If the value is greater than zero and the size of a
35919 message exceeds this limit, the address is failed. If there is any chance that
35920 the resulting bounce message could be routed to the same transport, you should
35921 ensure that <option>return_size_limit</option> is less than the transport’s
35922 <option>message_size_limit</option>, as otherwise the bounce message will fail to get
35926 <indexterm role="option">
35927 <primary><option>rcpt_include_affixes</option></primary>
35930 <informaltable frame="all">
35931 <tgroup cols="4" colsep="0" rowsep="0">
35932 <colspec colwidth="8*" align="left"/>
35933 <colspec colwidth="6*" align="center"/>
35934 <colspec colwidth="6*" align="center"/>
35935 <colspec colwidth="6*" align="right"/>
35938 <entry><option>rcpt_include_affixes</option></entry>
35939 <entry>Use: <emphasis>transports</emphasis></entry>
35940 <entry>Type: <emphasis>boolean</emphasis></entry>
35941 <entry>Default: <emphasis>false</emphasis></entry>
35947 <indexterm role="concept">
35948 <primary>prefix</primary>
35949 <secondary>for local part, including in envelope</secondary>
35951 <indexterm role="concept">
35952 <primary>suffix for local part</primary>
35953 <secondary>including in envelope</secondary>
35955 <indexterm role="concept">
35956 <primary>local part</primary>
35957 <secondary>prefix</secondary>
35959 <indexterm role="concept">
35960 <primary>local part</primary>
35961 <secondary>suffix</secondary>
35963 When this option is false (the default), and an address that has had any
35964 affixes (prefixes or suffixes) removed from the local part is delivered by any
35965 form of SMTP or LMTP, the affixes are not included. For example, if a router
35968 <literallayout class="monospaced">
35969 local_part_prefix = *-
35972 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
35975 <literallayout class="monospaced">
35976 RCPT TO:<xyz@some.domain>
35979 This is also the case when an ACL-time callout is being used to verify a
35980 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
35981 whole local part is included in the RCPT command. This option applies to BSMTP
35982 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
35983 <command>lmtp</command> and <command>smtp</command> transports.
35986 <indexterm role="option">
35987 <primary><option>retry_use_local_part</option></primary>
35990 <informaltable frame="all">
35991 <tgroup cols="4" colsep="0" rowsep="0">
35992 <colspec colwidth="8*" align="left"/>
35993 <colspec colwidth="6*" align="center"/>
35994 <colspec colwidth="6*" align="center"/>
35995 <colspec colwidth="6*" align="right"/>
35998 <entry><option>retry_use_local_part</option></entry>
35999 <entry>Use: <emphasis>transports</emphasis></entry>
36000 <entry>Type: <emphasis>boolean</emphasis></entry>
36001 <entry>Default: <emphasis>see below</emphasis></entry>
36007 <indexterm role="concept">
36008 <primary>hints database</primary>
36009 <secondary>retry keys</secondary>
36011 When a delivery suffers a temporary failure, a retry record is created
36012 in Exim’s hints database. For remote deliveries, the key for the retry record
36013 is based on the name and/or IP address of the failing remote host. For local
36014 deliveries, the key is normally the entire address, including both the local
36015 part and the domain. This is suitable for most common cases of local delivery
36016 temporary failure – for example, exceeding a mailbox quota should delay only
36017 deliveries to that mailbox, not to the whole domain.
36020 However, in some special cases you may want to treat a temporary local delivery
36021 as a failure associated with the domain, and not with a particular local part.
36022 (For example, if you are storing all mail for some domain in files.) You can do
36023 this by setting <option>retry_use_local_part</option> false.
36026 For all the local transports, its default value is true. For remote transports,
36027 the default value is false for tidiness, but changing the value has no effect
36028 on a remote transport in the current implementation.
36031 <indexterm role="option">
36032 <primary><option>return_path</option></primary>
36035 <informaltable frame="all">
36036 <tgroup cols="4" colsep="0" rowsep="0">
36037 <colspec colwidth="8*" align="left"/>
36038 <colspec colwidth="6*" align="center"/>
36039 <colspec colwidth="6*" align="center"/>
36040 <colspec colwidth="6*" align="right"/>
36043 <entry><option>return_path</option></entry>
36044 <entry>Use: <emphasis>transports</emphasis></entry>
36045 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36046 <entry>Default: <emphasis>unset</emphasis></entry>
36052 <indexterm role="concept">
36053 <primary>envelope sender</primary>
36055 <indexterm role="concept">
36056 <primary>transport</primary>
36057 <secondary>return path; changing</secondary>
36059 <indexterm role="concept">
36060 <primary>return path</primary>
36061 <secondary>changing in transport</secondary>
36063 If this option is set, the string is expanded at transport time and replaces
36064 the existing return path (envelope sender) value in the copy of the message
36065 that is being delivered. An empty return path is permitted. This feature is
36066 designed for remote deliveries, where the value of this option is used in the
36067 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
36068 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
36069 header line, if one is added to the message (see the next option).
36072 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
36073 <option>return_path_on_delivery</option> to the log selector.
36076 <indexterm role="variable">
36077 <primary><varname>$return_path</varname></primary>
36079 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
36080 either the message’s envelope sender, or an address set by the
36081 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
36082 replacement occurs; if it fails for another reason, delivery is deferred. This
36083 option can be used to support VERP (Variable Envelope Return Paths) – see
36084 section <xref linkend="SECTverp"/>.
36087 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
36088 remote server rejects a message at SMTP time, the bounce message is not sent to
36089 the value of this option. It is sent to the previously set errors address.
36090 This defaults to the incoming sender address, but can be changed by setting
36091 <option>errors_to</option> in a router.
36094 <indexterm role="option">
36095 <primary><option>return_path_add</option></primary>
36098 <informaltable frame="all">
36099 <tgroup cols="4" colsep="0" rowsep="0">
36100 <colspec colwidth="8*" align="left"/>
36101 <colspec colwidth="6*" align="center"/>
36102 <colspec colwidth="6*" align="center"/>
36103 <colspec colwidth="6*" align="right"/>
36106 <entry><option>return_path_add</option></entry>
36107 <entry>Use: <emphasis>transports</emphasis></entry>
36108 <entry>Type: <emphasis>boolean</emphasis></entry>
36109 <entry>Default: <emphasis>false</emphasis></entry>
36115 <indexterm role="concept">
36116 <primary><emphasis>Return-path:</emphasis> header line</primary>
36118 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
36119 Although the return path is normally available in the prefix line of BSD
36120 mailboxes, this is commonly not displayed by MUAs, and so the user does not
36121 have easy access to it.
36124 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
36125 the delivery SMTP server makes the final delivery</quote>. This implies that this
36126 header should not be present in incoming messages. Exim has a configuration
36127 option, <option>return_path_remove</option>, which requests removal of this header from
36128 incoming messages, so that delivered messages can safely be resent to other
36132 <indexterm role="option">
36133 <primary><option>shadow_condition</option></primary>
36136 <informaltable frame="all">
36137 <tgroup cols="4" colsep="0" rowsep="0">
36138 <colspec colwidth="8*" align="left"/>
36139 <colspec colwidth="6*" align="center"/>
36140 <colspec colwidth="6*" align="center"/>
36141 <colspec colwidth="6*" align="right"/>
36144 <entry><option>shadow_condition</option></entry>
36145 <entry>Use: <emphasis>transports</emphasis></entry>
36146 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36147 <entry>Default: <emphasis>unset</emphasis></entry>
36153 See <option>shadow_transport</option> below.
36156 <indexterm role="option">
36157 <primary><option>shadow_transport</option></primary>
36160 <informaltable frame="all">
36161 <tgroup cols="4" colsep="0" rowsep="0">
36162 <colspec colwidth="8*" align="left"/>
36163 <colspec colwidth="6*" align="center"/>
36164 <colspec colwidth="6*" align="center"/>
36165 <colspec colwidth="6*" align="right"/>
36168 <entry><option>shadow_transport</option></entry>
36169 <entry>Use: <emphasis>transports</emphasis></entry>
36170 <entry>Type: <emphasis>string</emphasis></entry>
36171 <entry>Default: <emphasis>unset</emphasis></entry>
36177 <indexterm role="concept">
36178 <primary>shadow transport</primary>
36180 <indexterm role="concept">
36181 <primary>transport</primary>
36182 <secondary>shadow</secondary>
36184 A local transport may set the <option>shadow_transport</option> option to the name of
36185 another local transport. Shadow remote transports are not supported.
36188 Whenever a delivery to the main transport succeeds, and either
36189 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
36190 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
36191 passed to the shadow transport, with the same delivery address or addresses. If
36192 expansion fails, no action is taken except that non-forced expansion failures
36193 cause a log line to be written.
36196 The result of the shadow transport is discarded and does not affect the
36197 subsequent processing of the message. Only a single level of shadowing is
36198 provided; the <option>shadow_transport</option> option is ignored on any transport when it
36199 is running as a shadow. Options concerned with output from pipes are also
36200 ignored. The log line for the successful delivery has an item added on the end,
36203 <literallayout class="monospaced">
36204 ST=<shadow transport name>
36207 If the shadow transport did not succeed, the error message is put in
36208 parentheses afterwards. Shadow transports can be used for a number of different
36209 purposes, including keeping more detailed log information than Exim normally
36210 provides, and implementing automatic acknowledgment policies based on message
36211 headers that some sites insist on.
36214 <indexterm role="option">
36215 <primary><option>transport_filter</option></primary>
36218 <informaltable frame="all">
36219 <tgroup cols="4" colsep="0" rowsep="0">
36220 <colspec colwidth="8*" align="left"/>
36221 <colspec colwidth="6*" align="center"/>
36222 <colspec colwidth="6*" align="center"/>
36223 <colspec colwidth="6*" align="right"/>
36226 <entry><option>transport_filter</option></entry>
36227 <entry>Use: <emphasis>transports</emphasis></entry>
36228 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36229 <entry>Default: <emphasis>unset</emphasis></entry>
36235 <indexterm role="concept">
36236 <primary>transport</primary>
36237 <secondary>filter</secondary>
36239 <indexterm role="concept">
36240 <primary>filter</primary>
36241 <secondary>transport filter</secondary>
36243 This option sets up a filtering (in the Unix shell sense) process for messages
36244 at transport time. It should not be confused with mail filtering as set up by
36245 individual users or via a system filter.
36248 When the message is about to be written out, the command specified by
36249 <option>transport_filter</option> is started up in a separate, parallel process, and
36250 the entire message, including the header lines, is passed to it on its standard
36251 input (this in fact is done from a third process, to avoid deadlock). The
36252 command must be specified as an absolute path.
36255 The lines of the message that are written to the transport filter are
36256 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
36257 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
36258 lines beginning with a dot, and also before any processing implied by the
36259 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
36260 <command>pipe</command> transports.
36263 The standard error for the filter process is set to the same destination as its
36264 standard output; this is read and written to the message’s ultimate
36265 destination. The process that writes the message to the filter, the
36266 filter itself, and the original process that reads the result and delivers it
36267 are all run in parallel, like a shell pipeline.
36269 <para revisionflag="changed">
36270 The filter can perform any transformations it likes, but of course should take
36271 care not to break RFC 2822 syntax. Exim does not check the result, except to
36272 test for a final newline when SMTP is in use. All messages transmitted over
36273 SMTP must end with a newline, so Exim supplies one if it is missing.
36276 <indexterm role="concept">
36277 <primary>content scanning</primary>
36278 <secondary>per user</secondary>
36280 A transport filter can be used to provide content-scanning on a per-user basis
36281 at delivery time if the only required effect of the scan is to modify the
36282 message. For example, a content scan could insert a new header line containing
36283 a spam score. This could be interpreted by a filter in the user’s MUA. It is
36284 not possible to discard a message at this stage.
36287 <indexterm role="concept">
36288 <primary>SMTP</primary>
36289 <secondary>SIZE</secondary>
36291 A problem might arise if the filter increases the size of a message that is
36292 being sent down an SMTP connection. If the receiving SMTP server has indicated
36293 support for the SIZE parameter, Exim will have sent the size of the message
36294 at the start of the SMTP session. If what is actually sent is substantially
36295 more, the server might reject the message. This can be worked round by setting
36296 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
36297 additions to the message, or to disable the use of SIZE altogether.
36300 <indexterm role="variable">
36301 <primary><varname>$pipe_addresses</varname></primary>
36303 The value of the <option>transport_filter</option> option is the command string for starting
36304 the filter, which is run directly from Exim, not under a shell. The string is
36305 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
36306 Exim breaks it up into arguments and then expands each argument separately (see
36307 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
36308 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
36309 of arguments, one for each address that applies to this delivery. (This isn’t
36310 an ideal name for this feature here, but as it was already implemented for the
36311 <command>pipe</command> transport, it seemed sensible not to change it.)
36314 <indexterm role="variable">
36315 <primary><varname>$host</varname></primary>
36317 <indexterm role="variable">
36318 <primary><varname>$host_address</varname></primary>
36320 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
36321 transport is a remote one. They contain the name and IP address of the host to
36322 which the message is being sent. For example:
36324 <literallayout class="monospaced">
36325 transport_filter = /some/directory/transport-filter.pl \
36326 $host $host_address $sender_address $pipe_addresses
36329 Two problems arise if you want to use more complicated expansion items to
36330 generate transport filter commands, both of which due to the fact that the
36331 command is split up <emphasis>before</emphasis> expansion.
36336 If an expansion item contains white space, you must quote it, so that it is all
36337 part of the same command item. If the entire option setting is one such
36338 expansion item, you have to take care what kind of quoting you use. For
36341 <literallayout class="monospaced">
36342 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
36345 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
36346 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
36347 stripped by Exim when it read the option’s value. When the value is used, if
36348 the single quotes were missing, the line would be split into two items,
36349 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
36350 Exim tried to expand the first one.
36355 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
36356 expansion cannot generate multiple arguments, or a command name followed by
36357 arguments. Consider this example:
36359 <literallayout class="monospaced">
36360 transport_filter = ${lookup{$host}lsearch{/a/file}\
36361 {$value}{/bin/cat}}
36364 The result of the lookup is interpreted as the name of the command, even
36365 if it contains white space. The simplest way round this is to use a shell:
36367 <literallayout class="monospaced">
36368 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/a/file}\
36369 {$value}{/bin/cat}}
36374 The filter process is run under the same uid and gid as the normal delivery.
36375 For remote deliveries this is the Exim uid/gid by default. The command should
36376 normally yield a zero return code. Transport filters are not supposed to fail.
36377 A non-zero code is taken to mean that the transport filter encountered some
36378 serious problem. Delivery of the message is deferred; the message remains on
36379 the queue and is tried again later. It is not possible to cause a message to be
36380 bounced from a transport filter.
36383 If a transport filter is set on an autoreply transport, the original message is
36384 passed through the filter as it is being copied into the newly generated
36385 message, which happens if the <option>return_message</option> option is set.
36388 <indexterm role="option">
36389 <primary><option>transport_filter_timeout</option></primary>
36392 <informaltable frame="all">
36393 <tgroup cols="4" colsep="0" rowsep="0">
36394 <colspec colwidth="8*" align="left"/>
36395 <colspec colwidth="6*" align="center"/>
36396 <colspec colwidth="6*" align="center"/>
36397 <colspec colwidth="6*" align="right"/>
36400 <entry><option>transport_filter_timeout</option></entry>
36401 <entry>Use: <emphasis>transports</emphasis></entry>
36402 <entry>Type: <emphasis>time</emphasis></entry>
36403 <entry>Default: <emphasis>5m</emphasis></entry>
36409 <indexterm role="concept">
36410 <primary>transport</primary>
36411 <secondary>filter, timeout</secondary>
36413 When Exim is reading the output of a transport filter, it a applies a timeout
36414 that can be set by this option. Exceeding the timeout is normally treated as a
36415 temporary delivery failure. However, if a transport filter is used with a
36416 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
36417 way as a timeout in the pipe command itself. By default, a timeout is a hard
36418 error, but if the <command>pipe</command> transport’s <option>timeout_defer</option> option is set true, it
36419 becomes a temporary error.
36422 <indexterm role="option">
36423 <primary><option>user</option></primary>
36426 <informaltable frame="all">
36427 <tgroup cols="4" colsep="0" rowsep="0">
36428 <colspec colwidth="8*" align="left"/>
36429 <colspec colwidth="6*" align="center"/>
36430 <colspec colwidth="6*" align="center"/>
36431 <colspec colwidth="6*" align="right"/>
36434 <entry><option>user</option></entry>
36435 <entry>Use: <emphasis>transports</emphasis></entry>
36436 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36437 <entry>Default: <emphasis>Exim user</emphasis></entry>
36443 <indexterm role="concept">
36444 <primary>uid (user id)</primary>
36445 <secondary>local delivery</secondary>
36447 <indexterm role="concept">
36448 <primary>transport</primary>
36449 <secondary>user, specifying</secondary>
36451 This option specifies the user under whose uid the delivery process is to be
36452 run, overriding any uid that may have been set by the router. If the user is
36453 given as a name, the uid is looked up from the password data, and the
36454 associated group is taken as the value of the gid to be used if the <option>group</option>
36458 For deliveries that use local transports, a user and group are normally
36459 specified explicitly or implicitly (for example, as a result of
36460 <option>check_local_user</option>) by the router or transport.
36463 <indexterm role="concept">
36464 <primary>hints database</primary>
36465 <secondary>access by remote transport</secondary>
36467 For remote transports, you should leave this option unset unless you really are
36468 sure you know what you are doing. When a remote transport is running, it needs
36469 to be able to access Exim’s hints databases, because each host may have its own
36471 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
36472 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
36473 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
36477 <chapter id="CHAPbatching">
36478 <title>Address batching in local transports</title>
36479 <titleabbrev>Address batching</titleabbrev>
36481 <indexterm role="concept">
36482 <primary>transport</primary>
36483 <secondary>local; address batching in</secondary>
36485 The only remote transport (<command>smtp</command>) is normally configured to handle more than
36486 one address at a time, so that when several addresses are routed to the same
36487 remote host, just one copy of the message is sent. Local transports, however,
36488 normally handle one address at a time. That is, a separate instance of the
36489 transport is run for each address that is routed to the transport. A separate
36490 copy of the message is delivered each time.
36493 <indexterm role="concept">
36494 <primary>batched local delivery</primary>
36496 <indexterm role="option">
36497 <primary><option>batch_max</option></primary>
36499 <indexterm role="option">
36500 <primary><option>batch_id</option></primary>
36502 In special cases, it may be desirable to handle several addresses at once in a
36503 local transport, for example:
36508 In an <command>appendfile</command> transport, when storing messages in files for later
36509 delivery by some other means, a single copy of the message with multiple
36510 recipients saves space.
36515 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
36516 a single copy saves time, and is the normal way LMTP is expected to work.
36521 In a <command>pipe</command> transport, when passing the message
36522 to a scanner program or
36523 to some other delivery mechanism such as UUCP, multiple recipients may be
36529 These three local transports all have the same options for controlling multiple
36530 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
36531 repeating the information for each transport, these options are described here.
36534 The <option>batch_max</option> option specifies the maximum number of addresses that can be
36535 delivered together in a single run of the transport. Its default value is one
36536 (no batching). When more than one address is routed to a transport that has a
36537 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
36538 (that is, in a single run of the transport with multiple recipients), subject
36539 to certain conditions:
36544 <indexterm role="variable">
36545 <primary><varname>$local_part</varname></primary>
36547 If any of the transport’s options contain a reference to <varname>$local_part</varname>, no
36548 batching is possible.
36553 <indexterm role="variable">
36554 <primary><varname>$domain</varname></primary>
36556 If any of the transport’s options contain a reference to <varname>$domain</varname>, only
36557 addresses with the same domain are batched.
36562 <indexterm role="concept">
36563 <primary>customizing</primary>
36564 <secondary>batching condition</secondary>
36566 If <option>batch_id</option> is set, it is expanded for each address, and only those
36567 addresses with the same expanded value are batched. This allows you to specify
36568 customized batching conditions. Failure of the expansion for any reason,
36569 including forced failure, disables batching, but it does not stop the delivery
36575 Batched addresses must also have the same errors address (where to send
36576 delivery errors), the same header additions and removals, the same user and
36577 group for the transport, and if a host list is present, the first host must
36583 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
36584 both when the file or pipe command is specified in the transport, and when it
36585 is specified by a <command>redirect</command> router, but all the batched addresses must of
36586 course be routed to the same file or pipe command. These two transports have an
36587 option called <option>use_bsmtp</option>, which causes them to deliver the message in
36588 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
36589 <option>check_string</option> and <option>escape_string</option> options are forced to the values
36591 <literallayout class="monospaced">
36593 escape_string = ".."
36596 when batched SMTP is in use. A full description of the batch SMTP mechanism is
36597 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
36598 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
36601 <indexterm role="concept">
36602 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
36604 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
36605 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
36606 that are being processed together. If you are using a batching <command>appendfile</command>
36607 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
36608 addresses is to set the <option>envelope_to_add</option> option.
36611 <indexterm role="concept">
36612 <primary><command>pipe</command> transport</primary>
36613 <secondary>with multiple addresses</secondary>
36615 <indexterm role="variable">
36616 <primary><varname>$pipe_addresses</varname></primary>
36618 If you are using a <command>pipe</command> transport without BSMTP, and setting the
36619 transport’s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
36620 the command. This is not a true variable; it is a bit of magic that causes each
36621 of the recipient addresses to be inserted into the command as a separate
36622 argument. This provides a way of accessing all the addresses that are being
36623 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
36624 are specified by a <command>redirect</command> router.
36628 <chapter id="CHAPappendfile">
36629 <title>The appendfile transport</title>
36631 <indexterm role="concept" id="IIDapptra1" class="startofrange">
36632 <primary><command>appendfile</command> transport</primary>
36634 <indexterm role="concept" id="IIDapptra2" class="startofrange">
36635 <primary>transports</primary>
36636 <secondary><command>appendfile</command></secondary>
36638 <indexterm role="concept">
36639 <primary>directory creation</primary>
36641 <indexterm role="concept">
36642 <primary>creating directories</primary>
36644 The <command>appendfile</command> transport delivers a message by appending it to an existing
36645 file, or by creating an entirely new file in a specified directory. Single
36646 files to which messages are appended can be in the traditional Unix mailbox
36647 format, or optionally in the MBX format supported by the Pine MUA and
36648 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
36649 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
36650 to give added protection against failures that happen part-way through the
36651 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
36652 supported. For all file formats, Exim attempts to create as many levels of
36653 directory as necessary, provided that <option>create_directory</option> is set.
36656 The code for the optional formats is not included in the Exim binary by
36657 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
36658 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
36662 <indexterm role="concept">
36663 <primary>quota</primary>
36664 <secondary>system</secondary>
36666 Exim recognizes system quota errors, and generates an appropriate message. Exim
36667 also supports its own quota control within the transport, for use when the
36668 system facility is unavailable or cannot be used for some reason.
36671 If there is an error while appending to a file (for example, quota exceeded or
36672 partition filled), Exim attempts to reset the file’s length and last
36673 modification time back to what they were before. If there is an error while
36674 creating an entirely new file, the new file is removed.
36677 Before appending to a file, a number of security checks are made, and the
36678 file is locked. A detailed description is given below, after the list of
36682 The <command>appendfile</command> transport is most commonly used for local deliveries to
36683 users’ mailboxes. However, it can also be used as a pseudo-remote transport for
36684 putting messages into files for remote delivery by some means other than Exim.
36685 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
36688 <section id="SECTfildiropt">
36689 <title>The file and directory options</title>
36691 The <option>file</option> option specifies a single file, to which the message is appended;
36692 the <option>directory</option> option specifies a directory, in which a new file containing
36693 the message is created. Only one of these two options can be set, and for
36694 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
36697 <indexterm role="variable">
36698 <primary><varname>$address_file</varname></primary>
36700 <indexterm role="variable">
36701 <primary><varname>$local_part</varname></primary>
36703 However, <command>appendfile</command> is also used for delivering messages to files or
36704 directories whose names (or parts of names) are obtained from alias,
36705 forwarding, or filtering operations (for example, a <option>save</option> command in a
36706 user’s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
36707 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
36708 name (or partial name) of the file or directory generated by the redirection
36709 operation. There are two cases:
36714 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
36715 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
36716 common case when users with local accounts use filtering to sort mail into
36717 different folders. See for example, the <command>address_file</command> transport in the
36718 default configuration. If the path ends with a slash, it is assumed to be the
36719 name of a directory. A delivery to a directory can also be forced by setting
36720 <option>maildir_format</option> or <option>mailstore_format</option>.
36725 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
36726 used to determine the file or directory name for the delivery. Normally, the
36727 contents of <varname>$address_file</varname> are used in some way in the string expansion.
36732 <indexterm role="concept">
36733 <primary>Sieve filter</primary>
36734 <secondary>configuring <command>appendfile</command></secondary>
36736 <indexterm role="concept">
36737 <primary>Sieve filter</primary>
36738 <secondary>relative mailbox path handling</secondary>
36740 As an example of the second case, consider an environment where users do not
36741 have home directories. They may be permitted to use Exim filter commands of the
36744 <literallayout class="monospaced">
36748 or Sieve filter commands of the form:
36750 <literallayout class="monospaced">
36751 require "fileinto";
36752 fileinto "folder23";
36755 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
36756 must transform the relative path into an appropriate absolute file name. In the
36757 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
36758 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
36759 way of handling this requirement:
36761 <literallayout class="monospaced">
36762 file = ${if eq{$address_file}{inbox} \
36763 {/var/mail/$local_part} \
36764 {${if eq{${substr_0_1:$address_file}}{/} \
36766 {$home/mail/$address_file} \
36771 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
36772 location, absolute paths are used without change, and other folders are in the
36773 <filename>mail</filename> directory within the home directory.
36776 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
36777 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
36778 the router. In particular, this is the case if <option>check_local_user</option> is set. If
36779 you want to prevent this happening at routing time, you can set
36780 <option>router_home_directory</option> empty. This forces the router to pass the relative
36781 path to the transport.
36784 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
36785 the <option>file</option> or <option>directory</option> option is still used if it is set.
36788 <section id="SECID134">
36789 <title>Private options for appendfile</title>
36791 <indexterm role="concept">
36792 <primary>options</primary>
36793 <secondary><command>appendfile</command> transport</secondary>
36797 <indexterm role="option">
36798 <primary><option>allow_fifo</option></primary>
36801 <informaltable frame="all">
36802 <tgroup cols="4" colsep="0" rowsep="0">
36803 <colspec colwidth="8*" align="left"/>
36804 <colspec colwidth="6*" align="center"/>
36805 <colspec colwidth="6*" align="center"/>
36806 <colspec colwidth="6*" align="right"/>
36809 <entry><option>allow_fifo</option></entry>
36810 <entry>Use: <emphasis>appendfile</emphasis></entry>
36811 <entry>Type: <emphasis>boolean</emphasis></entry>
36812 <entry>Default: <emphasis>false</emphasis></entry>
36818 <indexterm role="concept">
36819 <primary>fifo (named pipe)</primary>
36821 <indexterm role="concept">
36822 <primary>named pipe (fifo)</primary>
36824 <indexterm role="concept">
36825 <primary>pipe</primary>
36826 <secondary>named (fifo)</secondary>
36828 Setting this option permits delivery to named pipes (FIFOs) as well as to
36829 regular files. If no process is reading the named pipe at delivery time, the
36830 delivery is deferred.
36833 <indexterm role="option">
36834 <primary><option>allow_symlink</option></primary>
36837 <informaltable frame="all">
36838 <tgroup cols="4" colsep="0" rowsep="0">
36839 <colspec colwidth="8*" align="left"/>
36840 <colspec colwidth="6*" align="center"/>
36841 <colspec colwidth="6*" align="center"/>
36842 <colspec colwidth="6*" align="right"/>
36845 <entry><option>allow_symlink</option></entry>
36846 <entry>Use: <emphasis>appendfile</emphasis></entry>
36847 <entry>Type: <emphasis>boolean</emphasis></entry>
36848 <entry>Default: <emphasis>false</emphasis></entry>
36854 <indexterm role="concept">
36855 <primary>symbolic link</primary>
36856 <secondary>to mailbox</secondary>
36858 <indexterm role="concept">
36859 <primary>mailbox</primary>
36860 <secondary>symbolic link</secondary>
36862 By default, <command>appendfile</command> will not deliver if the path name for the file is
36863 that of a symbolic link. Setting this option relaxes that constraint, but there
36864 are security issues involved in the use of symbolic links. Be sure you know
36865 what you are doing if you set this. Details of exactly what this option affects
36866 are included in the discussion which follows this list of options.
36869 <indexterm role="option">
36870 <primary><option>batch_id</option></primary>
36873 <informaltable frame="all">
36874 <tgroup cols="4" colsep="0" rowsep="0">
36875 <colspec colwidth="8*" align="left"/>
36876 <colspec colwidth="6*" align="center"/>
36877 <colspec colwidth="6*" align="center"/>
36878 <colspec colwidth="6*" align="right"/>
36881 <entry><option>batch_id</option></entry>
36882 <entry>Use: <emphasis>appendfile</emphasis></entry>
36883 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36884 <entry>Default: <emphasis>unset</emphasis></entry>
36890 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
36891 However, batching is automatically disabled for <command>appendfile</command> deliveries that
36892 happen as a result of forwarding or aliasing or other redirection directly to a
36896 <indexterm role="option">
36897 <primary><option>batch_max</option></primary>
36900 <informaltable frame="all">
36901 <tgroup cols="4" colsep="0" rowsep="0">
36902 <colspec colwidth="8*" align="left"/>
36903 <colspec colwidth="6*" align="center"/>
36904 <colspec colwidth="6*" align="center"/>
36905 <colspec colwidth="6*" align="right"/>
36908 <entry><option>batch_max</option></entry>
36909 <entry>Use: <emphasis>appendfile</emphasis></entry>
36910 <entry>Type: <emphasis>integer</emphasis></entry>
36911 <entry>Default: <emphasis>1</emphasis></entry>
36917 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
36920 <indexterm role="option">
36921 <primary><option>check_group</option></primary>
36924 <informaltable frame="all">
36925 <tgroup cols="4" colsep="0" rowsep="0">
36926 <colspec colwidth="8*" align="left"/>
36927 <colspec colwidth="6*" align="center"/>
36928 <colspec colwidth="6*" align="center"/>
36929 <colspec colwidth="6*" align="right"/>
36932 <entry><option>check_group</option></entry>
36933 <entry>Use: <emphasis>appendfile</emphasis></entry>
36934 <entry>Type: <emphasis>boolean</emphasis></entry>
36935 <entry>Default: <emphasis>false</emphasis></entry>
36941 When this option is set, the group owner of the file defined by the <option>file</option>
36942 option is checked to see that it is the same as the group under which the
36943 delivery process is running. The default setting is false because the default
36944 file mode is 0600, which means that the group is irrelevant.
36947 <indexterm role="option">
36948 <primary><option>check_owner</option></primary>
36951 <informaltable frame="all">
36952 <tgroup cols="4" colsep="0" rowsep="0">
36953 <colspec colwidth="8*" align="left"/>
36954 <colspec colwidth="6*" align="center"/>
36955 <colspec colwidth="6*" align="center"/>
36956 <colspec colwidth="6*" align="right"/>
36959 <entry><option>check_owner</option></entry>
36960 <entry>Use: <emphasis>appendfile</emphasis></entry>
36961 <entry>Type: <emphasis>boolean</emphasis></entry>
36962 <entry>Default: <emphasis>true</emphasis></entry>
36968 When this option is set, the owner of the file defined by the <option>file</option> option
36969 is checked to ensure that it is the same as the user under which the delivery
36970 process is running.
36973 <indexterm role="option">
36974 <primary><option>check_string</option></primary>
36977 <informaltable frame="all">
36978 <tgroup cols="4" colsep="0" rowsep="0">
36979 <colspec colwidth="8*" align="left"/>
36980 <colspec colwidth="6*" align="center"/>
36981 <colspec colwidth="6*" align="center"/>
36982 <colspec colwidth="6*" align="right"/>
36985 <entry><option>check_string</option></entry>
36986 <entry>Use: <emphasis>appendfile</emphasis></entry>
36987 <entry>Type: <emphasis>string</emphasis></entry>
36988 <entry>Default: <emphasis>see below</emphasis></entry>
36994 <indexterm role="concept">
36995 <primary><quote>From</quote> line</primary>
36997 As <command>appendfile</command> writes the message, the start of each line is tested for
36998 matching <option>check_string</option>, and if it does, the initial matching characters are
36999 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
37000 a literal string, not a regular expression, and the case of any letters it
37001 contains is significant.
37004 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
37005 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
37006 configuration are ignored. Otherwise, they default to <quote>From </quote> and
37007 <quote>>From </quote> when the <option>file</option> option is set, and unset when any of the
37008 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
37011 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
37012 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
37013 <quote>From </quote> indicates the start of a new message. All four options need changing
37014 if another format is used. For example, to deliver to mailboxes in MMDF format:
37015 <indexterm role="concept">
37016 <primary>MMDF format mailbox</primary>
37018 <indexterm role="concept">
37019 <primary>mailbox</primary>
37020 <secondary>MMDF format</secondary>
37023 <literallayout class="monospaced">
37024 check_string = "\1\1\1\1\n"
37025 escape_string = "\1\1\1\1 \n"
37026 message_prefix = "\1\1\1\1\n"
37027 message_suffix = "\1\1\1\1\n"
37030 <indexterm role="option">
37031 <primary><option>create_directory</option></primary>
37034 <informaltable frame="all">
37035 <tgroup cols="4" colsep="0" rowsep="0">
37036 <colspec colwidth="8*" align="left"/>
37037 <colspec colwidth="6*" align="center"/>
37038 <colspec colwidth="6*" align="center"/>
37039 <colspec colwidth="6*" align="right"/>
37042 <entry><option>create_directory</option></entry>
37043 <entry>Use: <emphasis>appendfile</emphasis></entry>
37044 <entry>Type: <emphasis>boolean</emphasis></entry>
37045 <entry>Default: <emphasis>true</emphasis></entry>
37051 <indexterm role="concept">
37052 <primary>directory creation</primary>
37054 When this option is true, Exim attempts to create any missing superior
37055 directories for the file that it is about to write. A created directory’s mode
37056 is given by the <option>directory_mode</option> option.
37059 The group ownership of a newly created directory is highly dependent on the
37060 operating system (and possibly the file system) that is being used. For
37061 example, in Solaris, if the parent directory has the setgid bit set, its group
37062 is propagated to the child; if not, the currently set group is used. However,
37063 in FreeBSD, the parent’s group is always used.
37066 <indexterm role="option">
37067 <primary><option>create_file</option></primary>
37070 <informaltable frame="all">
37071 <tgroup cols="4" colsep="0" rowsep="0">
37072 <colspec colwidth="8*" align="left"/>
37073 <colspec colwidth="6*" align="center"/>
37074 <colspec colwidth="6*" align="center"/>
37075 <colspec colwidth="6*" align="right"/>
37078 <entry><option>create_file</option></entry>
37079 <entry>Use: <emphasis>appendfile</emphasis></entry>
37080 <entry>Type: <emphasis>string</emphasis></entry>
37081 <entry>Default: <emphasis>anywhere</emphasis></entry>
37087 This option constrains the location of files and directories that are created
37088 by this transport. It applies to files defined by the <option>file</option> option and
37089 directories defined by the <option>directory</option> option. In the case of maildir
37090 delivery, it applies to the top level directory, not the maildir directories
37094 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
37095 <quote>belowhome</quote>. In the second and third cases, a home directory must have been
37096 set for the transport. This option is not useful when an explicit file name is
37097 given for normal mailbox deliveries. It is intended for the case when file
37098 names are generated from users’ <filename>.forward</filename> files. These are usually handled
37099 by an <command>appendfile</command> transport called <option>address_file</option>. See also
37100 <option>file_must_exist</option>.
37103 <indexterm role="option">
37104 <primary><option>directory</option></primary>
37107 <informaltable frame="all">
37108 <tgroup cols="4" colsep="0" rowsep="0">
37109 <colspec colwidth="8*" align="left"/>
37110 <colspec colwidth="6*" align="center"/>
37111 <colspec colwidth="6*" align="center"/>
37112 <colspec colwidth="6*" align="right"/>
37115 <entry><option>directory</option></entry>
37116 <entry>Use: <emphasis>appendfile</emphasis></entry>
37117 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37118 <entry>Default: <emphasis>unset</emphasis></entry>
37124 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
37125 or <option>directory</option> must be set, unless the delivery is the direct result of a
37126 redirection (see section <xref linkend="SECTfildiropt"/>).
37129 When <option>directory</option> is set, the string is expanded, and the message is delivered
37130 into a new file or files in or below the given directory, instead of being
37131 appended to a single mailbox file. A number of different formats are provided
37132 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
37133 <xref linkend="SECTopdir"/> for further details of this form of delivery.
37136 <indexterm role="option">
37137 <primary><option>directory_file</option></primary>
37140 <informaltable frame="all">
37141 <tgroup cols="4" colsep="0" rowsep="0">
37142 <colspec colwidth="8*" align="left"/>
37143 <colspec colwidth="6*" align="center"/>
37144 <colspec colwidth="6*" align="center"/>
37145 <colspec colwidth="6*" align="right"/>
37148 <entry><option>directory_file</option></entry>
37149 <entry>Use: <emphasis>appendfile</emphasis></entry>
37150 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37151 <entry>Default: <emphasis>see below</emphasis></entry>
37157 <indexterm role="concept">
37158 <primary>base62</primary>
37160 <indexterm role="variable">
37161 <primary><varname>$inode</varname></primary>
37163 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
37164 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
37165 whose name is obtained by expanding this string. The default value is:
37167 <literallayout class="monospaced">
37168 q${base62:$tod_epoch}-$inode
37171 This generates a unique name from the current time, in base 62 form, and the
37172 inode of the file. The variable <varname>$inode</varname> is available only when expanding this
37176 <indexterm role="option">
37177 <primary><option>directory_mode</option></primary>
37180 <informaltable frame="all">
37181 <tgroup cols="4" colsep="0" rowsep="0">
37182 <colspec colwidth="8*" align="left"/>
37183 <colspec colwidth="6*" align="center"/>
37184 <colspec colwidth="6*" align="center"/>
37185 <colspec colwidth="6*" align="right"/>
37188 <entry><option>directory_mode</option></entry>
37189 <entry>Use: <emphasis>appendfile</emphasis></entry>
37190 <entry>Type: <emphasis>octal integer</emphasis></entry>
37191 <entry>Default: <emphasis>0700</emphasis></entry>
37197 If <command>appendfile</command> creates any directories as a result of the
37198 <option>create_directory</option> option, their mode is specified by this option.
37201 <indexterm role="option">
37202 <primary><option>escape_string</option></primary>
37205 <informaltable frame="all">
37206 <tgroup cols="4" colsep="0" rowsep="0">
37207 <colspec colwidth="8*" align="left"/>
37208 <colspec colwidth="6*" align="center"/>
37209 <colspec colwidth="6*" align="center"/>
37210 <colspec colwidth="6*" align="right"/>
37213 <entry><option>escape_string</option></entry>
37214 <entry>Use: <emphasis>appendfile</emphasis></entry>
37215 <entry>Type: <emphasis>string</emphasis></entry>
37216 <entry>Default: <emphasis>see description</emphasis></entry>
37222 See <option>check_string</option> above.
37225 <indexterm role="option">
37226 <primary><option>file</option></primary>
37229 <informaltable frame="all">
37230 <tgroup cols="4" colsep="0" rowsep="0">
37231 <colspec colwidth="8*" align="left"/>
37232 <colspec colwidth="6*" align="center"/>
37233 <colspec colwidth="6*" align="center"/>
37234 <colspec colwidth="6*" align="right"/>
37237 <entry><option>file</option></entry>
37238 <entry>Use: <emphasis>appendfile</emphasis></entry>
37239 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37240 <entry>Default: <emphasis>unset</emphasis></entry>
37246 This option is mutually exclusive with the <option>directory</option> option, but one of
37247 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
37248 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
37249 specifies a single file, to which the message is appended. One or more of
37250 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
37251 <option>file</option>.
37254 <indexterm role="concept">
37255 <primary>NFS</primary>
37256 <secondary>lock file</secondary>
37258 <indexterm role="concept">
37259 <primary>locking files</primary>
37261 <indexterm role="concept">
37262 <primary>lock files</primary>
37264 If you are using more than one host to deliver over NFS into the same
37265 mailboxes, you should always use lock files.
37268 The string value is expanded for each delivery, and must yield an absolute
37269 path. The most common settings of this option are variations on one of these
37272 <literallayout class="monospaced">
37273 file = /var/spool/mail/$local_part
37274 file = /home/$local_part/inbox
37278 <indexterm role="concept">
37279 <primary><quote>sticky</quote> bit</primary>
37281 In the first example, all deliveries are done into the same directory. If Exim
37282 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
37283 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
37284 deliveries to be possible, or alternatively the <option>group</option> option can be used to
37285 run the delivery under a group id which has write access to the directory.
37288 <indexterm role="option">
37289 <primary><option>file_format</option></primary>
37292 <informaltable frame="all">
37293 <tgroup cols="4" colsep="0" rowsep="0">
37294 <colspec colwidth="8*" align="left"/>
37295 <colspec colwidth="6*" align="center"/>
37296 <colspec colwidth="6*" align="center"/>
37297 <colspec colwidth="6*" align="right"/>
37300 <entry><option>file_format</option></entry>
37301 <entry>Use: <emphasis>appendfile</emphasis></entry>
37302 <entry>Type: <emphasis>string</emphasis></entry>
37303 <entry>Default: <emphasis>unset</emphasis></entry>
37309 <indexterm role="concept">
37310 <primary>file</primary>
37311 <secondary>mailbox; checking existing format</secondary>
37313 This option requests the transport to check the format of an existing file
37314 before adding to it. The check consists of matching a specific string at the
37315 start of the file. The value of the option consists of an even number of
37316 colon-separated strings. The first of each pair is the test string, and the
37317 second is the name of a transport. If the transport associated with a matched
37318 string is not the current transport, control is passed over to the other
37319 transport. For example, suppose the standard <command>local_delivery</command> transport has
37322 <literallayout class="monospaced">
37323 file_format = "From : local_delivery :\
37324 \1\1\1\1\n : local_mmdf_delivery"
37327 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
37328 a mailbox begins with four binary ones followed by a newline, control is passed
37329 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
37330 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
37331 is assumed to match the current transport. If the start of a mailbox doesn’t
37332 match any string, or if the transport named for a given string is not defined,
37333 delivery is deferred.
37336 <indexterm role="option">
37337 <primary><option>file_must_exist</option></primary>
37340 <informaltable frame="all">
37341 <tgroup cols="4" colsep="0" rowsep="0">
37342 <colspec colwidth="8*" align="left"/>
37343 <colspec colwidth="6*" align="center"/>
37344 <colspec colwidth="6*" align="center"/>
37345 <colspec colwidth="6*" align="right"/>
37348 <entry><option>file_must_exist</option></entry>
37349 <entry>Use: <emphasis>appendfile</emphasis></entry>
37350 <entry>Type: <emphasis>boolean</emphasis></entry>
37351 <entry>Default: <emphasis>false</emphasis></entry>
37357 If this option is true, the file specified by the <option>file</option> option must exist.
37358 A temporary error occurs if it does not, causing delivery to be deferred.
37359 If this option is false, the file is created if it does not exist.
37362 <indexterm role="option">
37363 <primary><option>lock_fcntl_timeout</option></primary>
37366 <informaltable frame="all">
37367 <tgroup cols="4" colsep="0" rowsep="0">
37368 <colspec colwidth="8*" align="left"/>
37369 <colspec colwidth="6*" align="center"/>
37370 <colspec colwidth="6*" align="center"/>
37371 <colspec colwidth="6*" align="right"/>
37374 <entry><option>lock_fcntl_timeout</option></entry>
37375 <entry>Use: <emphasis>appendfile</emphasis></entry>
37376 <entry>Type: <emphasis>time</emphasis></entry>
37377 <entry>Default: <emphasis>0s</emphasis></entry>
37383 <indexterm role="concept">
37384 <primary>timeout</primary>
37385 <secondary>mailbox locking</secondary>
37387 <indexterm role="concept">
37388 <primary>mailbox</primary>
37389 <secondary>locking, blocking and non-blocking</secondary>
37391 <indexterm role="concept">
37392 <primary>locking files</primary>
37394 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
37395 when locking an open mailbox file. If the call fails, the delivery process
37396 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
37397 Non-blocking calls are used so that the file is not kept open during the wait
37398 for the lock; the reason for this is to make it as safe as possible for
37399 deliveries over NFS in the case when processes might be accessing an NFS
37400 mailbox without using a lock file. This should not be done, but
37401 misunderstandings and hence misconfigurations are not unknown.
37404 On a busy system, however, the performance of a non-blocking lock approach is
37405 not as good as using a blocking lock with a timeout. In this case, the waiting
37406 is done inside the system call, and Exim’s delivery process acquires the lock
37407 and can proceed as soon as the previous lock holder releases it.
37410 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
37411 timeout, are used. There may still be some retrying: the maximum number of
37414 <literallayout class="monospaced">
37415 (lock_retries * lock_interval) / lock_fcntl_timeout
37418 rounded up to the next whole number. In other words, the total time during
37419 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
37420 <option>lock_fcntl_timeout</option> is set very large.
37423 You should consider setting this option if you are getting a lot of delayed
37424 local deliveries because of errors of the form
37426 <literallayout class="monospaced">
37427 failed to lock mailbox /some/file (fcntl)
37430 <indexterm role="option">
37431 <primary><option>lock_flock_timeout</option></primary>
37434 <informaltable frame="all">
37435 <tgroup cols="4" colsep="0" rowsep="0">
37436 <colspec colwidth="8*" align="left"/>
37437 <colspec colwidth="6*" align="center"/>
37438 <colspec colwidth="6*" align="center"/>
37439 <colspec colwidth="6*" align="right"/>
37442 <entry><option>lock_flock_timeout</option></entry>
37443 <entry>Use: <emphasis>appendfile</emphasis></entry>
37444 <entry>Type: <emphasis>time</emphasis></entry>
37445 <entry>Default: <emphasis>0s</emphasis></entry>
37451 This timeout applies to file locking when using <function>flock()</function> (see
37452 <option>use_flock</option>); the timeout operates in a similar manner to
37453 <option>lock_fcntl_timeout</option>.
37456 <indexterm role="option">
37457 <primary><option>lock_interval</option></primary>
37460 <informaltable frame="all">
37461 <tgroup cols="4" colsep="0" rowsep="0">
37462 <colspec colwidth="8*" align="left"/>
37463 <colspec colwidth="6*" align="center"/>
37464 <colspec colwidth="6*" align="center"/>
37465 <colspec colwidth="6*" align="right"/>
37468 <entry><option>lock_interval</option></entry>
37469 <entry>Use: <emphasis>appendfile</emphasis></entry>
37470 <entry>Type: <emphasis>time</emphasis></entry>
37471 <entry>Default: <emphasis>3s</emphasis></entry>
37477 This specifies the time to wait between attempts to lock the file. See below
37478 for details of locking.
37481 <indexterm role="option">
37482 <primary><option>lock_retries</option></primary>
37485 <informaltable frame="all">
37486 <tgroup cols="4" colsep="0" rowsep="0">
37487 <colspec colwidth="8*" align="left"/>
37488 <colspec colwidth="6*" align="center"/>
37489 <colspec colwidth="6*" align="center"/>
37490 <colspec colwidth="6*" align="right"/>
37493 <entry><option>lock_retries</option></entry>
37494 <entry>Use: <emphasis>appendfile</emphasis></entry>
37495 <entry>Type: <emphasis>integer</emphasis></entry>
37496 <entry>Default: <emphasis>10</emphasis></entry>
37502 This specifies the maximum number of attempts to lock the file. A value of zero
37503 is treated as 1. See below for details of locking.
37506 <indexterm role="option">
37507 <primary><option>lockfile_mode</option></primary>
37510 <informaltable frame="all">
37511 <tgroup cols="4" colsep="0" rowsep="0">
37512 <colspec colwidth="8*" align="left"/>
37513 <colspec colwidth="6*" align="center"/>
37514 <colspec colwidth="6*" align="center"/>
37515 <colspec colwidth="6*" align="right"/>
37518 <entry><option>lockfile_mode</option></entry>
37519 <entry>Use: <emphasis>appendfile</emphasis></entry>
37520 <entry>Type: <emphasis>octal integer</emphasis></entry>
37521 <entry>Default: <emphasis>0600</emphasis></entry>
37527 This specifies the mode of the created lock file, when a lock file is being
37528 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
37531 <indexterm role="option">
37532 <primary><option>lockfile_timeout</option></primary>
37535 <informaltable frame="all">
37536 <tgroup cols="4" colsep="0" rowsep="0">
37537 <colspec colwidth="8*" align="left"/>
37538 <colspec colwidth="6*" align="center"/>
37539 <colspec colwidth="6*" align="center"/>
37540 <colspec colwidth="6*" align="right"/>
37543 <entry><option>lockfile_timeout</option></entry>
37544 <entry>Use: <emphasis>appendfile</emphasis></entry>
37545 <entry>Type: <emphasis>time</emphasis></entry>
37546 <entry>Default: <emphasis>30m</emphasis></entry>
37552 <indexterm role="concept">
37553 <primary>timeout</primary>
37554 <secondary>mailbox locking</secondary>
37556 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
37557 exists and is older than this value, it is assumed to have been left behind by
37558 accident, and Exim attempts to remove it.
37561 <indexterm role="option">
37562 <primary><option>mailbox_filecount</option></primary>
37565 <informaltable frame="all">
37566 <tgroup cols="4" colsep="0" rowsep="0">
37567 <colspec colwidth="8*" align="left"/>
37568 <colspec colwidth="6*" align="center"/>
37569 <colspec colwidth="6*" align="center"/>
37570 <colspec colwidth="6*" align="right"/>
37573 <entry><option>mailbox_filecount</option></entry>
37574 <entry>Use: <emphasis>appendfile</emphasis></entry>
37575 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37576 <entry>Default: <emphasis>unset</emphasis></entry>
37582 <indexterm role="concept">
37583 <primary>mailbox</primary>
37584 <secondary>specifying size of</secondary>
37586 <indexterm role="concept">
37587 <primary>size</primary>
37588 <secondary>of mailbox</secondary>
37590 If this option is set, it is expanded, and the result is taken as the current
37591 number of files in the mailbox. It must be a decimal number, optionally
37592 followed by K or M. This provides a way of obtaining this information from an
37593 external source that maintains the data.
37596 <indexterm role="option">
37597 <primary><option>mailbox_size</option></primary>
37600 <informaltable frame="all">
37601 <tgroup cols="4" colsep="0" rowsep="0">
37602 <colspec colwidth="8*" align="left"/>
37603 <colspec colwidth="6*" align="center"/>
37604 <colspec colwidth="6*" align="center"/>
37605 <colspec colwidth="6*" align="right"/>
37608 <entry><option>mailbox_size</option></entry>
37609 <entry>Use: <emphasis>appendfile</emphasis></entry>
37610 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37611 <entry>Default: <emphasis>unset</emphasis></entry>
37617 <indexterm role="concept">
37618 <primary>mailbox</primary>
37619 <secondary>specifying size of</secondary>
37621 <indexterm role="concept">
37622 <primary>size</primary>
37623 <secondary>of mailbox</secondary>
37625 If this option is set, it is expanded, and the result is taken as the current
37626 size the mailbox. It must be a decimal number, optionally followed by K or M.
37627 This provides a way of obtaining this information from an external source that
37628 maintains the data. This is likely to be helpful for maildir deliveries where
37629 it is computationally expensive to compute the size of a mailbox.
37632 <indexterm role="option">
37633 <primary><option>maildir_format</option></primary>
37636 <informaltable frame="all">
37637 <tgroup cols="4" colsep="0" rowsep="0">
37638 <colspec colwidth="8*" align="left"/>
37639 <colspec colwidth="6*" align="center"/>
37640 <colspec colwidth="6*" align="center"/>
37641 <colspec colwidth="6*" align="right"/>
37644 <entry><option>maildir_format</option></entry>
37645 <entry>Use: <emphasis>appendfile</emphasis></entry>
37646 <entry>Type: <emphasis>boolean</emphasis></entry>
37647 <entry>Default: <emphasis>false</emphasis></entry>
37653 <indexterm role="concept">
37654 <primary>maildir format</primary>
37655 <secondary>specifying</secondary>
37657 If this option is set with the <option>directory</option> option, the delivery is into a new
37658 file, in the <quote>maildir</quote> format that is used by other mail software. When the
37659 transport is activated directly from a <command>redirect</command> router (for example, the
37660 <command>address_file</command> transport in the default configuration), setting
37661 <option>maildir_format</option> causes the path received from the router to be treated as a
37662 directory, whether or not it ends with <literal>/</literal>. This option is available only if
37663 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
37664 <xref linkend="SECTmaildirdelivery"/> below for further details.
37667 <indexterm role="option">
37668 <primary><option>maildir_quota_directory_regex</option></primary>
37671 <informaltable frame="all">
37672 <tgroup cols="4" colsep="0" rowsep="0">
37673 <colspec colwidth="8*" align="left"/>
37674 <colspec colwidth="6*" align="center"/>
37675 <colspec colwidth="6*" align="center"/>
37676 <colspec colwidth="6*" align="right"/>
37679 <entry><option>maildir_quota_directory_regex</option></entry>
37680 <entry>Use: <emphasis>appendfile</emphasis></entry>
37681 <entry>Type: <emphasis>string</emphasis></entry>
37682 <entry>Default: <emphasis>See below</emphasis></entry>
37688 <indexterm role="concept">
37689 <primary>maildir format</primary>
37690 <secondary>quota; directories included in</secondary>
37692 <indexterm role="concept">
37693 <primary>quota</primary>
37694 <secondary>maildir; directories included in</secondary>
37696 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
37697 a regular expression for specifying directories, relative to the quota
37698 directory (see <option>quota_directory</option>), that should be included in the quota
37699 calculation. The default value is:
37701 <literallayout class="monospaced">
37702 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
37705 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
37706 (directories whose names begin with a dot). If you want to exclude the
37707 <filename>Trash</filename>
37708 folder from the count (as some sites do), you need to change this setting to
37710 <literallayout class="monospaced">
37711 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
37714 This uses a negative lookahead in the regular expression to exclude the
37715 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
37716 calculations, quota processing is bypassed for any messages that are delivered
37717 directly into that directory.
37720 <indexterm role="option">
37721 <primary><option>maildir_retries</option></primary>
37724 <informaltable frame="all">
37725 <tgroup cols="4" colsep="0" rowsep="0">
37726 <colspec colwidth="8*" align="left"/>
37727 <colspec colwidth="6*" align="center"/>
37728 <colspec colwidth="6*" align="center"/>
37729 <colspec colwidth="6*" align="right"/>
37732 <entry><option>maildir_retries</option></entry>
37733 <entry>Use: <emphasis>appendfile</emphasis></entry>
37734 <entry>Type: <emphasis>integer</emphasis></entry>
37735 <entry>Default: <emphasis>10</emphasis></entry>
37741 This option specifies the number of times to retry when writing a file in
37742 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
37745 <indexterm role="option">
37746 <primary><option>maildir_tag</option></primary>
37749 <informaltable frame="all">
37750 <tgroup cols="4" colsep="0" rowsep="0">
37751 <colspec colwidth="8*" align="left"/>
37752 <colspec colwidth="6*" align="center"/>
37753 <colspec colwidth="6*" align="center"/>
37754 <colspec colwidth="6*" align="right"/>
37757 <entry><option>maildir_tag</option></entry>
37758 <entry>Use: <emphasis>appendfile</emphasis></entry>
37759 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37760 <entry>Default: <emphasis>unset</emphasis></entry>
37766 This option applies only to deliveries in maildir format, and is described in
37767 section <xref linkend="SECTmaildirdelivery"/> below.
37770 <indexterm role="option">
37771 <primary><option>maildir_use_size_file</option></primary>
37774 <informaltable frame="all">
37775 <tgroup cols="4" colsep="0" rowsep="0">
37776 <colspec colwidth="8*" align="left"/>
37777 <colspec colwidth="6*" align="center"/>
37778 <colspec colwidth="6*" align="center"/>
37779 <colspec colwidth="6*" align="right"/>
37782 <entry><option>maildir_use_size_file</option></entry>
37783 <entry>Use: <emphasis>appendfile</emphasis></entry>
37784 <entry>Type: <emphasis>boolean</emphasis></entry>
37785 <entry>Default: <emphasis>false</emphasis></entry>
37791 <indexterm role="concept">
37792 <primary>maildir format</primary>
37793 <secondary><filename>maildirsize</filename> file</secondary>
37795 Setting this option true enables support for <filename>maildirsize</filename> files. Exim
37796 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
37797 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
37798 value is zero. See <option>maildir_quota_directory_regex</option> above and section
37799 <xref linkend="SECTmaildirdelivery"/> below for further details.
37802 <indexterm role="option">
37803 <primary><option>maildirfolder_create_regex</option></primary>
37806 <informaltable frame="all">
37807 <tgroup cols="4" colsep="0" rowsep="0">
37808 <colspec colwidth="8*" align="left"/>
37809 <colspec colwidth="6*" align="center"/>
37810 <colspec colwidth="6*" align="center"/>
37811 <colspec colwidth="6*" align="right"/>
37814 <entry><option>maildirfolder_create_regex</option></entry>
37815 <entry>Use: <emphasis>appendfile</emphasis></entry>
37816 <entry>Type: <emphasis>string</emphasis></entry>
37817 <entry>Default: <emphasis>unset</emphasis></entry>
37823 <indexterm role="concept">
37824 <primary>maildir format</primary>
37825 <secondary><filename>maildirfolder</filename> file</secondary>
37827 <indexterm role="concept">
37828 <primary><filename>maildirfolder</filename>, creating</primary>
37830 The value of this option is a regular expression. If it is unset, it has no
37831 effect. Otherwise, before a maildir delivery takes place, the pattern is
37832 matched against the name of the maildir directory, that is, the directory
37833 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
37834 delivery. If there is a match, Exim checks for the existence of a file called
37835 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
37836 See section <xref linkend="SECTmaildirdelivery"/> for more details.
37839 <indexterm role="option">
37840 <primary><option>mailstore_format</option></primary>
37843 <informaltable frame="all">
37844 <tgroup cols="4" colsep="0" rowsep="0">
37845 <colspec colwidth="8*" align="left"/>
37846 <colspec colwidth="6*" align="center"/>
37847 <colspec colwidth="6*" align="center"/>
37848 <colspec colwidth="6*" align="right"/>
37851 <entry><option>mailstore_format</option></entry>
37852 <entry>Use: <emphasis>appendfile</emphasis></entry>
37853 <entry>Type: <emphasis>boolean</emphasis></entry>
37854 <entry>Default: <emphasis>false</emphasis></entry>
37860 <indexterm role="concept">
37861 <primary>mailstore format</primary>
37862 <secondary>specifying</secondary>
37864 If this option is set with the <option>directory</option> option, the delivery is into two
37865 new files in <quote>mailstore</quote> format. The option is available only if
37866 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
37867 below for further details.
37870 <indexterm role="option">
37871 <primary><option>mailstore_prefix</option></primary>
37874 <informaltable frame="all">
37875 <tgroup cols="4" colsep="0" rowsep="0">
37876 <colspec colwidth="8*" align="left"/>
37877 <colspec colwidth="6*" align="center"/>
37878 <colspec colwidth="6*" align="center"/>
37879 <colspec colwidth="6*" align="right"/>
37882 <entry><option>mailstore_prefix</option></entry>
37883 <entry>Use: <emphasis>appendfile</emphasis></entry>
37884 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37885 <entry>Default: <emphasis>unset</emphasis></entry>
37891 This option applies only to deliveries in mailstore format, and is described in
37892 section <xref linkend="SECTopdir"/> below.
37895 <indexterm role="option">
37896 <primary><option>mailstore_suffix</option></primary>
37899 <informaltable frame="all">
37900 <tgroup cols="4" colsep="0" rowsep="0">
37901 <colspec colwidth="8*" align="left"/>
37902 <colspec colwidth="6*" align="center"/>
37903 <colspec colwidth="6*" align="center"/>
37904 <colspec colwidth="6*" align="right"/>
37907 <entry><option>mailstore_suffix</option></entry>
37908 <entry>Use: <emphasis>appendfile</emphasis></entry>
37909 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37910 <entry>Default: <emphasis>unset</emphasis></entry>
37916 This option applies only to deliveries in mailstore format, and is described in
37917 section <xref linkend="SECTopdir"/> below.
37920 <indexterm role="option">
37921 <primary><option>mbx_format</option></primary>
37924 <informaltable frame="all">
37925 <tgroup cols="4" colsep="0" rowsep="0">
37926 <colspec colwidth="8*" align="left"/>
37927 <colspec colwidth="6*" align="center"/>
37928 <colspec colwidth="6*" align="center"/>
37929 <colspec colwidth="6*" align="right"/>
37932 <entry><option>mbx_format</option></entry>
37933 <entry>Use: <emphasis>appendfile</emphasis></entry>
37934 <entry>Type: <emphasis>boolean</emphasis></entry>
37935 <entry>Default: <emphasis>false</emphasis></entry>
37941 <indexterm role="concept">
37942 <primary>locking files</primary>
37944 <indexterm role="concept">
37945 <primary>file</primary>
37946 <secondary>locking</secondary>
37948 <indexterm role="concept">
37949 <primary>file</primary>
37950 <secondary>MBX format</secondary>
37952 <indexterm role="concept">
37953 <primary>MBX format, specifying</primary>
37955 This option is available only if Exim has been compiled with SUPPORT_MBX
37956 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
37957 the message is appended to the mailbox file in MBX format instead of
37958 traditional Unix format. This format is supported by Pine4 and its associated
37959 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
37962 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
37963 automatically changed by the use of <option>mbx_format</option>. They should normally be set
37964 empty when using MBX format, so this option almost always appears in this
37967 <literallayout class="monospaced">
37973 If none of the locking options are mentioned in the configuration,
37974 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
37975 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
37976 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
37977 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
37978 should not be used if any program that does not use this form of locking is
37979 going to access the mailbox, nor should it be used if the mailbox file is NFS
37980 mounted, because it works only when the mailbox is accessed from a single host.
37983 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
37984 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
37985 (this means for the whole of a Pine or IMAP session), Exim will not be able to
37986 append messages to it.
37989 <indexterm role="option">
37990 <primary><option>message_prefix</option></primary>
37993 <informaltable frame="all">
37994 <tgroup cols="4" colsep="0" rowsep="0">
37995 <colspec colwidth="8*" align="left"/>
37996 <colspec colwidth="6*" align="center"/>
37997 <colspec colwidth="6*" align="center"/>
37998 <colspec colwidth="6*" align="right"/>
38001 <entry><option>message_prefix</option></entry>
38002 <entry>Use: <emphasis>appendfile</emphasis></entry>
38003 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38004 <entry>Default: <emphasis>see below</emphasis></entry>
38010 <indexterm role="concept">
38011 <primary><quote>From</quote> line</primary>
38013 The string specified here is expanded and output at the start of every message.
38014 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
38015 in which case it is:
38017 <literallayout class="monospaced">
38018 message_prefix = "From ${if def:return_path{$return_path}\
38019 {MAILER-DAEMON}} $tod_bsdinbox\n"
38022 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
38023 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
38026 <indexterm role="option">
38027 <primary><option>message_suffix</option></primary>
38030 <informaltable frame="all">
38031 <tgroup cols="4" colsep="0" rowsep="0">
38032 <colspec colwidth="8*" align="left"/>
38033 <colspec colwidth="6*" align="center"/>
38034 <colspec colwidth="6*" align="center"/>
38035 <colspec colwidth="6*" align="right"/>
38038 <entry><option>message_suffix</option></entry>
38039 <entry>Use: <emphasis>appendfile</emphasis></entry>
38040 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38041 <entry>Default: <emphasis>see below</emphasis></entry>
38047 The string specified here is expanded and output at the end of every message.
38048 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
38049 in which case it is a single newline character. The suffix can be suppressed by
38052 <literallayout class="monospaced">
38056 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
38057 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
38060 <indexterm role="option">
38061 <primary><option>mode</option></primary>
38064 <informaltable frame="all">
38065 <tgroup cols="4" colsep="0" rowsep="0">
38066 <colspec colwidth="8*" align="left"/>
38067 <colspec colwidth="6*" align="center"/>
38068 <colspec colwidth="6*" align="center"/>
38069 <colspec colwidth="6*" align="right"/>
38072 <entry><option>mode</option></entry>
38073 <entry>Use: <emphasis>appendfile</emphasis></entry>
38074 <entry>Type: <emphasis>octal integer</emphasis></entry>
38075 <entry>Default: <emphasis>0600</emphasis></entry>
38081 If the output file is created, it is given this mode. If it already exists and
38082 has wider permissions, they are reduced to this mode. If it has narrower
38083 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
38084 if the delivery is the result of a <option>save</option> command in a filter file specifying
38085 a particular mode, the mode of the output file is always forced to take that
38086 value, and this option is ignored.
38089 <indexterm role="option">
38090 <primary><option>mode_fail_narrower</option></primary>
38093 <informaltable frame="all">
38094 <tgroup cols="4" colsep="0" rowsep="0">
38095 <colspec colwidth="8*" align="left"/>
38096 <colspec colwidth="6*" align="center"/>
38097 <colspec colwidth="6*" align="center"/>
38098 <colspec colwidth="6*" align="right"/>
38101 <entry><option>mode_fail_narrower</option></entry>
38102 <entry>Use: <emphasis>appendfile</emphasis></entry>
38103 <entry>Type: <emphasis>boolean</emphasis></entry>
38104 <entry>Default: <emphasis>true</emphasis></entry>
38110 This option applies in the case when an existing mailbox file has a narrower
38111 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
38112 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
38113 continues with the delivery attempt, using the existing mode of the file.
38116 <indexterm role="option">
38117 <primary><option>notify_comsat</option></primary>
38120 <informaltable frame="all">
38121 <tgroup cols="4" colsep="0" rowsep="0">
38122 <colspec colwidth="8*" align="left"/>
38123 <colspec colwidth="6*" align="center"/>
38124 <colspec colwidth="6*" align="center"/>
38125 <colspec colwidth="6*" align="right"/>
38128 <entry><option>notify_comsat</option></entry>
38129 <entry>Use: <emphasis>appendfile</emphasis></entry>
38130 <entry>Type: <emphasis>boolean</emphasis></entry>
38131 <entry>Default: <emphasis>false</emphasis></entry>
38137 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
38138 successful delivery to a user mailbox. This is the daemon that notifies logged
38139 on users about incoming mail.
38142 <indexterm role="option">
38143 <primary><option>quota</option></primary>
38146 <informaltable frame="all">
38147 <tgroup cols="4" colsep="0" rowsep="0">
38148 <colspec colwidth="8*" align="left"/>
38149 <colspec colwidth="6*" align="center"/>
38150 <colspec colwidth="6*" align="center"/>
38151 <colspec colwidth="6*" align="right"/>
38154 <entry><option>quota</option></entry>
38155 <entry>Use: <emphasis>appendfile</emphasis></entry>
38156 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38157 <entry>Default: <emphasis>unset</emphasis></entry>
38163 <indexterm role="concept">
38164 <primary>quota</primary>
38165 <secondary>imposed by Exim</secondary>
38167 This option imposes a limit on the size of the file to which Exim is appending,
38168 or to the total space used in the directory tree when the <option>directory</option> option
38169 is set. In the latter case, computation of the space used is expensive, because
38170 all the files in the directory (and any sub-directories) have to be
38171 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
38172 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
38173 have no shell access to their mailboxes).
38176 As there is no interlock against two simultaneous deliveries into a
38177 multi-file mailbox, it is possible for the quota to be overrun in this case.
38178 For single-file mailboxes, of course, an interlock is a necessity.
38181 A file’s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
38182 may be a lot less than the actual amount of disk space allocated to the file.
38183 If the sizes of a number of files are being added up, the rounding effect can
38184 become quite noticeable, especially on systems that have large block sizes.
38185 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
38186 the obvious value which users understand most easily.
38189 The value of the option is expanded, and must then be a numerical value
38190 (decimal point allowed), optionally followed by one of the letters K, M, or G,
38191 for kilobytes, megabytes, or gigabytes. If Exim is running on a system with
38192 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
38196 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
38199 The expansion happens while Exim is running as root, before it changes uid for
38200 the delivery. This means that files that are inaccessible to the end user can
38201 be used to hold quota values that are looked up in the expansion. When delivery
38202 fails because this quota is exceeded, the handling of the error is as for
38203 system quota failures.
38206 By default, Exim’s quota checking mimics system quotas, and restricts the
38207 mailbox to the specified maximum size, though the value is not accurate to the
38208 last byte, owing to separator lines and additional headers that may get added
38209 during message delivery. When a mailbox is nearly full, large messages may get
38210 refused even though small ones are accepted, because the size of the current
38211 message is added to the quota when the check is made. This behaviour can be
38212 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
38213 for exceeding the quota does not include the current message. Thus, deliveries
38214 continue until the quota has been exceeded; thereafter, no further messages are
38215 delivered. See also <option>quota_warn_threshold</option>.
38218 <indexterm role="option">
38219 <primary><option>quota_directory</option></primary>
38222 <informaltable frame="all">
38223 <tgroup cols="4" colsep="0" rowsep="0">
38224 <colspec colwidth="8*" align="left"/>
38225 <colspec colwidth="6*" align="center"/>
38226 <colspec colwidth="6*" align="center"/>
38227 <colspec colwidth="6*" align="right"/>
38230 <entry><option>quota_directory</option></entry>
38231 <entry>Use: <emphasis>appendfile</emphasis></entry>
38232 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38233 <entry>Default: <emphasis>unset</emphasis></entry>
38239 This option defines the directory to check for quota purposes when delivering
38240 into individual files. The default is the delivery directory, or, if a file
38241 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
38242 delivery directory.
38245 <indexterm role="option">
38246 <primary><option>quota_filecount</option></primary>
38249 <informaltable frame="all">
38250 <tgroup cols="4" colsep="0" rowsep="0">
38251 <colspec colwidth="8*" align="left"/>
38252 <colspec colwidth="6*" align="center"/>
38253 <colspec colwidth="6*" align="center"/>
38254 <colspec colwidth="6*" align="right"/>
38257 <entry><option>quota_filecount</option></entry>
38258 <entry>Use: <emphasis>appendfile</emphasis></entry>
38259 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38260 <entry>Default: <emphasis>0</emphasis></entry>
38266 This option applies when the <option>directory</option> option is set. It limits the total
38267 number of files in the directory (compare the inode limit in system quotas). It
38268 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
38269 failure causes delivery to be deferred. A value of zero is interpreted as
38270 <quote>no quota</quote>.
38273 <indexterm role="option">
38274 <primary><option>quota_is_inclusive</option></primary>
38277 <informaltable frame="all">
38278 <tgroup cols="4" colsep="0" rowsep="0">
38279 <colspec colwidth="8*" align="left"/>
38280 <colspec colwidth="6*" align="center"/>
38281 <colspec colwidth="6*" align="center"/>
38282 <colspec colwidth="6*" align="right"/>
38285 <entry><option>quota_is_inclusive</option></entry>
38286 <entry>Use: <emphasis>appendfile</emphasis></entry>
38287 <entry>Type: <emphasis>boolean</emphasis></entry>
38288 <entry>Default: <emphasis>true</emphasis></entry>
38294 See <option>quota</option> above.
38297 <indexterm role="option">
38298 <primary><option>quota_size_regex</option></primary>
38301 <informaltable frame="all">
38302 <tgroup cols="4" colsep="0" rowsep="0">
38303 <colspec colwidth="8*" align="left"/>
38304 <colspec colwidth="6*" align="center"/>
38305 <colspec colwidth="6*" align="center"/>
38306 <colspec colwidth="6*" align="right"/>
38309 <entry><option>quota_size_regex</option></entry>
38310 <entry>Use: <emphasis>appendfile</emphasis></entry>
38311 <entry>Type: <emphasis>string</emphasis></entry>
38312 <entry>Default: <emphasis>unset</emphasis></entry>
38318 This option applies when one of the delivery modes that writes a separate file
38319 for each message is being used. When Exim wants to find the size of one of
38320 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
38321 If this is set to a regular expression that matches the file name, and it
38322 captures one string, that string is interpreted as a representation of the
38323 file’s size. The value of <option>quota_size_regex</option> is not expanded.
38326 This feature is useful only when users have no shell access to their mailboxes
38327 – otherwise they could defeat the quota simply by renaming the files. This
38328 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
38329 the file length to the file name. For example:
38331 <literallayout class="monospaced">
38332 maildir_tag = ,S=$message_size
38333 quota_size_regex = ,S=(\d+)
38336 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
38337 number of lines in the message.
38340 The regular expression should not assume that the length is at the end of the
38341 file name (even though <option>maildir_tag</option> puts it there) because maildir MUAs
38342 sometimes add other information onto the ends of message file names.
38345 <indexterm role="option">
38346 <primary><option>quota_warn_message</option></primary>
38349 <informaltable frame="all">
38350 <tgroup cols="4" colsep="0" rowsep="0">
38351 <colspec colwidth="8*" align="left"/>
38352 <colspec colwidth="6*" align="center"/>
38353 <colspec colwidth="6*" align="center"/>
38354 <colspec colwidth="6*" align="right"/>
38357 <entry><option>quota_warn_message</option></entry>
38358 <entry>Use: <emphasis>appendfile</emphasis></entry>
38359 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38360 <entry>Default: <emphasis>see below</emphasis></entry>
38366 See below for the use of this option. If it is not set when
38367 <option>quota_warn_threshold</option> is set, it defaults to
38369 <literallayout class="monospaced">
38370 quota_warn_message = "\
38371 To: $local_part@$domain\n\
38372 Subject: Your mailbox\n\n\
38373 This message is automatically created \
38374 by mail delivery software.\n\n\
38375 The size of your mailbox has exceeded \
38376 a warning threshold that is\n\
38377 set by the system administrator.\n"
38380 <indexterm role="option">
38381 <primary><option>quota_warn_threshold</option></primary>
38384 <informaltable frame="all">
38385 <tgroup cols="4" colsep="0" rowsep="0">
38386 <colspec colwidth="8*" align="left"/>
38387 <colspec colwidth="6*" align="center"/>
38388 <colspec colwidth="6*" align="center"/>
38389 <colspec colwidth="6*" align="right"/>
38392 <entry><option>quota_warn_threshold</option></entry>
38393 <entry>Use: <emphasis>appendfile</emphasis></entry>
38394 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38395 <entry>Default: <emphasis>0</emphasis></entry>
38401 <indexterm role="concept">
38402 <primary>quota</primary>
38403 <secondary>warning threshold</secondary>
38405 <indexterm role="concept">
38406 <primary>mailbox</primary>
38407 <secondary>size warning</secondary>
38409 <indexterm role="concept">
38410 <primary>size</primary>
38411 <secondary>of mailbox</secondary>
38413 This option is expanded in the same way as <option>quota</option> (see above). If the
38414 resulting value is greater than zero, and delivery of the message causes the
38415 size of the file or total space in the directory tree to cross the given
38416 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
38417 may be specified as a percentage of it by following the value with a percent
38420 <literallayout class="monospaced">
38422 quota_warn_threshold = 75%
38425 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
38426 percent sign is ignored.
38429 The warning message itself is specified by the <option>quota_warn_message</option> option,
38430 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
38431 warning message. These do not necessarily have to include the recipient(s) of
38432 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
38433 can include any other header lines that you want. If you do not include a
38434 <emphasis>From:</emphasis> line, the default is:
38436 <literallayout class="monospaced">
38437 From: Mail Delivery System <mailer-daemon@$qualify_domain_sender>
38440 <indexterm role="option">
38441 <primary><option>errors_reply_to</option></primary>
38443 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
38447 The <option>quota</option> option does not have to be set in order to use this option; they
38448 are independent of one another except when the threshold is specified as a
38452 <indexterm role="option">
38453 <primary><option>use_bsmtp</option></primary>
38456 <informaltable frame="all">
38457 <tgroup cols="4" colsep="0" rowsep="0">
38458 <colspec colwidth="8*" align="left"/>
38459 <colspec colwidth="6*" align="center"/>
38460 <colspec colwidth="6*" align="center"/>
38461 <colspec colwidth="6*" align="right"/>
38464 <entry><option>use_bsmtp</option></entry>
38465 <entry>Use: <emphasis>appendfile</emphasis></entry>
38466 <entry>Type: <emphasis>boolean</emphasis></entry>
38467 <entry>Default: <emphasis>false</emphasis></entry>
38473 <indexterm role="concept">
38474 <primary>envelope sender</primary>
38476 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
38477 format, with the envelope sender and recipient(s) included as SMTP commands. If
38478 you want to include a leading HELO command with such messages, you can do
38479 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
38480 for details of batch SMTP.
38483 <indexterm role="option">
38484 <primary><option>use_crlf</option></primary>
38487 <informaltable frame="all">
38488 <tgroup cols="4" colsep="0" rowsep="0">
38489 <colspec colwidth="8*" align="left"/>
38490 <colspec colwidth="6*" align="center"/>
38491 <colspec colwidth="6*" align="center"/>
38492 <colspec colwidth="6*" align="right"/>
38495 <entry><option>use_crlf</option></entry>
38496 <entry>Use: <emphasis>appendfile</emphasis></entry>
38497 <entry>Type: <emphasis>boolean</emphasis></entry>
38498 <entry>Default: <emphasis>false</emphasis></entry>
38504 <indexterm role="concept">
38505 <primary>carriage return</primary>
38507 <indexterm role="concept">
38508 <primary>linefeed</primary>
38510 This option causes lines to be terminated with the two-character CRLF sequence
38511 (carriage return, linefeed) instead of just a linefeed character. In the case
38512 of batched SMTP, the byte sequence written to the file is then an exact image
38513 of what would be sent down a real SMTP connection.
38516 <emphasis role="bold">Note:</emphasis> The contents of the <option>message_prefix</option> and <option>message_suffix</option> options
38517 (which are used to supply the traditional <quote>From </quote> and blank line separators
38518 in Berkeley-style mailboxes) are written verbatim, so must contain their own
38519 carriage return characters if these are needed. In cases where these options
38520 have non-empty defaults, the values end with a single linefeed, so they must be
38521 changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
38524 <indexterm role="option">
38525 <primary><option>use_fcntl_lock</option></primary>
38528 <informaltable frame="all">
38529 <tgroup cols="4" colsep="0" rowsep="0">
38530 <colspec colwidth="8*" align="left"/>
38531 <colspec colwidth="6*" align="center"/>
38532 <colspec colwidth="6*" align="center"/>
38533 <colspec colwidth="6*" align="right"/>
38536 <entry><option>use_fcntl_lock</option></entry>
38537 <entry>Use: <emphasis>appendfile</emphasis></entry>
38538 <entry>Type: <emphasis>boolean</emphasis></entry>
38539 <entry>Default: <emphasis>see below</emphasis></entry>
38545 This option controls the use of the <function>fcntl()</function> function to lock a file for
38546 exclusive use when a message is being appended. It is set by default unless
38547 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
38548 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
38549 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
38552 <indexterm role="option">
38553 <primary><option>use_flock_lock</option></primary>
38556 <informaltable frame="all">
38557 <tgroup cols="4" colsep="0" rowsep="0">
38558 <colspec colwidth="8*" align="left"/>
38559 <colspec colwidth="6*" align="center"/>
38560 <colspec colwidth="6*" align="center"/>
38561 <colspec colwidth="6*" align="right"/>
38564 <entry><option>use_flock_lock</option></entry>
38565 <entry>Use: <emphasis>appendfile</emphasis></entry>
38566 <entry>Type: <emphasis>boolean</emphasis></entry>
38567 <entry>Default: <emphasis>false</emphasis></entry>
38573 This option is provided to support the use of <function>flock()</function> for file locking, for
38574 the few situations where it is needed. Most modern operating systems support
38575 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
38576 each other. Exim uses <function>fcntl()</function> locking by default.
38579 This option is required only if you are using an operating system where
38580 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
38581 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
38582 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
38585 <indexterm role="concept">
38586 <primary>Solaris</primary>
38587 <secondary><function>flock()</function> support</secondary>
38589 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
38590 have it (and some, I think, provide a not quite right version built on top of
38591 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
38592 the ability to use it, and any attempt to do so will cause a configuration
38596 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
38597 is just being mapped onto <function>fcntl()</function> by the OS).
38600 <indexterm role="option">
38601 <primary><option>use_lockfile</option></primary>
38604 <informaltable frame="all">
38605 <tgroup cols="4" colsep="0" rowsep="0">
38606 <colspec colwidth="8*" align="left"/>
38607 <colspec colwidth="6*" align="center"/>
38608 <colspec colwidth="6*" align="center"/>
38609 <colspec colwidth="6*" align="right"/>
38612 <entry><option>use_lockfile</option></entry>
38613 <entry>Use: <emphasis>appendfile</emphasis></entry>
38614 <entry>Type: <emphasis>boolean</emphasis></entry>
38615 <entry>Default: <emphasis>see below</emphasis></entry>
38621 If this option is turned off, Exim does not attempt to create a lock file when
38622 appending to a mailbox file. In this situation, the only locking is by
38623 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
38624 sure that every MUA that is ever going to look at your users’ mailboxes uses
38625 <function>fcntl()</function> rather than a lock file, and even then only when you are not
38626 delivering over NFS from more than one host.
38629 <indexterm role="concept">
38630 <primary>NFS</primary>
38631 <secondary>lock file</secondary>
38633 In order to append to an NFS file safely from more than one host, it is
38634 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
38635 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
38639 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
38640 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
38641 except when <option>mbx_format</option> is set.
38644 <indexterm role="option">
38645 <primary><option>use_mbx_lock</option></primary>
38648 <informaltable frame="all">
38649 <tgroup cols="4" colsep="0" rowsep="0">
38650 <colspec colwidth="8*" align="left"/>
38651 <colspec colwidth="6*" align="center"/>
38652 <colspec colwidth="6*" align="center"/>
38653 <colspec colwidth="6*" align="right"/>
38656 <entry><option>use_mbx_lock</option></entry>
38657 <entry>Use: <emphasis>appendfile</emphasis></entry>
38658 <entry>Type: <emphasis>boolean</emphasis></entry>
38659 <entry>Default: <emphasis>see below</emphasis></entry>
38665 This option is available only if Exim has been compiled with SUPPORT_MBX
38666 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
38667 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
38668 of the locking options are mentioned in the configuration. The locking rules
38669 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
38670 the IMAP4 and POP daemons that come with it (see the discussion below). The
38671 rules allow for shared access to the mailbox. However, this kind of locking
38672 does not work when the mailbox is NFS mounted.
38675 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
38676 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
38677 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
38678 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
38681 <section id="SECTopappend">
38682 <title>Operational details for appending</title>
38684 <indexterm role="concept">
38685 <primary>appending to a file</primary>
38687 <indexterm role="concept">
38688 <primary>file</primary>
38689 <secondary>appending</secondary>
38691 Before appending to a file, the following preparations are made:
38696 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
38702 <indexterm role="concept">
38703 <primary>directory creation</primary>
38705 If any directories on the file’s path are missing, Exim creates them if the
38706 <option>create_directory</option> option is set. A created directory’s mode is given by the
38707 <option>directory_mode</option> option.
38712 If <option>file_format</option> is set, the format of an existing file is checked. If this
38713 indicates that a different transport should be used, control is passed to that
38719 <indexterm role="concept">
38720 <primary>file</primary>
38721 <secondary>locking</secondary>
38723 <indexterm role="concept">
38724 <primary>locking files</primary>
38726 <indexterm role="concept">
38727 <primary>NFS</primary>
38728 <secondary>lock file</secondary>
38730 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
38731 reliably over NFS, as follows:
38733 <orderedlist numeration="arabic">
38736 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
38737 current time, primary host name, and process id added, by opening for writing
38738 as a new file. If this fails with an access error, delivery is deferred.
38743 Close the hitching post file, and hard link it to the lock file name.
38748 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
38749 Unlink the hitching post name.
38754 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
38755 then unlink hitching post name. If the number of links is exactly two, creation
38756 of the lock file succeeded but something (for example, an NFS server crash and
38757 restart) caused this fact not to be communicated to the <function>link()</function> call.
38762 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
38763 up to <option>lock_retries</option> times. However, since any program that writes to a
38764 mailbox should complete its task very quickly, it is reasonable to time out old
38765 lock files that are normally the result of user agent and system crashes. If an
38766 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
38767 it before trying again.
38774 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
38775 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
38776 than non-existence, delivery is deferred.
38781 <indexterm role="concept">
38782 <primary>symbolic link</primary>
38783 <secondary>to mailbox</secondary>
38785 <indexterm role="concept">
38786 <primary>mailbox</primary>
38787 <secondary>symbolic link</secondary>
38789 If the file does exist and is a symbolic link, delivery is deferred, unless the
38790 <option>allow_symlink</option> option is set, in which case the ownership of the link is
38791 checked, and then <function>stat()</function> is called to find out about the real file, which
38792 is then subjected to the checks below. The check on the top-level link
38793 ownership prevents one user creating a link for another’s mailbox in a sticky
38794 directory, though allowing symbolic links in this case is definitely not a good
38795 idea. If there is a chain of symbolic links, the intermediate ones are not
38801 If the file already exists but is not a regular file, or if the file’s owner
38802 and group (if the group is being checked – see <option>check_group</option> above) are
38803 different from the user and group under which the delivery is running,
38804 delivery is deferred.
38809 If the file’s permissions are more generous than specified, they are reduced.
38810 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
38811 is set false, in which case the delivery is tried using the existing
38817 The file’s inode number is saved, and the file is then opened for appending.
38818 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
38819 hadn’t existed (see below). For any other failures, delivery is deferred.
38824 If the file is opened successfully, check that the inode number hasn’t
38825 changed, that it is still a regular file, and that the owner and permissions
38826 have not changed. If anything is wrong, defer delivery and freeze the message.
38831 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
38832 option is set. Otherwise, check that the file is being created in a permitted
38833 directory if the <option>create_file</option> option is set (deferring on failure), and then
38834 open for writing as a new file, with the O_EXCL and O_CREAT options,
38835 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
38836 set). In this case, which can happen if the link points to a non-existent file,
38837 the file is opened for writing using O_CREAT but not O_EXCL, because
38838 that prevents link following.
38843 <indexterm role="concept">
38844 <primary>loop</primary>
38845 <secondary>while file testing</secondary>
38847 If opening fails because the file exists, obey the tests given above for
38848 existing files. However, to avoid looping in a situation where the file is
38849 being continuously created and destroyed, the exists/not-exists loop is broken
38850 after 10 repetitions, and the message is then frozen.
38855 If opening fails with any other error, defer delivery.
38860 <indexterm role="concept">
38861 <primary>file</primary>
38862 <secondary>locking</secondary>
38864 <indexterm role="concept">
38865 <primary>locking files</primary>
38867 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
38868 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
38869 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
38870 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
38871 file, and an exclusive lock on the file whose name is
38873 <literallayout class="monospaced">
38874 /tmp/.<device-number>.<inode-number>
38877 using the device and inode numbers of the open mailbox file, in accordance with
38878 the MBX locking rules. This file is created with a mode that is specified by
38879 the <option>lockfile_mode</option> option.
38882 If Exim fails to lock the file, there are two possible courses of action,
38883 depending on the value of the locking timeout. This is obtained from
38884 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
38887 If the timeout value is zero, the file is closed, Exim waits for
38888 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
38889 to lock it again. This happens up to <option>lock_retries</option> times, after which the
38890 delivery is deferred.
38893 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
38894 <function>flock()</function> are used (with the given timeout), so there has already been some
38895 waiting involved by the time locking fails. Nevertheless, Exim does not give up
38896 immediately. It retries up to
38898 <literallayout class="monospaced">
38899 (lock_retries * lock_interval) / <timeout>
38902 times (rounded up).
38907 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
38908 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
38911 <section id="SECTopdir">
38912 <title>Operational details for delivery to a new file</title>
38914 <indexterm role="concept">
38915 <primary>delivery</primary>
38916 <secondary>to single file</secondary>
38918 <indexterm role="concept">
38919 <primary><quote>From</quote> line</primary>
38921 When the <option>directory</option> option is set instead of <option>file</option>, each message is
38922 delivered into a newly-created file or set of files. When <command>appendfile</command> is
38923 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
38924 <option>directory</option> is normally set, because the path for delivery is supplied by the
38925 router. (See for example, the <command>address_file</command> transport in the default
38926 configuration.) In this case, delivery is to a new file if either the path name
38927 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
38930 No locking is required while writing the message to a new file, so the various
38931 locking options of the transport are ignored. The <quote>From</quote> line that by default
38932 separates messages in a single file is not normally needed, nor is the escaping
38933 of message lines that start with <quote>From</quote>, and there is no need to ensure a
38934 newline at the end of each message. Consequently, the default values for
38935 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
38936 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
38939 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
38940 the files in the delivery directory by default. However, you can specify a
38941 different directory by setting <option>quota_directory</option>. Also, for maildir
38942 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
38945 <indexterm role="concept">
38946 <primary>maildir format</primary>
38948 <indexterm role="concept">
38949 <primary>mailstore format</primary>
38951 There are three different ways in which delivery to individual files can be
38952 done, controlled by the settings of the <option>maildir_format</option> and
38953 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
38954 formats is not included in the binary unless SUPPORT_MAILDIR or
38955 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
38958 <indexterm role="concept">
38959 <primary>directory creation</primary>
38961 In all three cases an attempt is made to create the directory and any necessary
38962 sub-directories if they do not exist, provided that the <option>create_directory</option>
38963 option is set (the default). The location of a created directory can be
38964 constrained by setting <option>create_file</option>. A created directory’s mode is given by
38965 the <option>directory_mode</option> option. If creation fails, or if the
38966 <option>create_directory</option> option is not set when creation is required, delivery is
38970 <section id="SECTmaildirdelivery">
38971 <title>Maildir delivery</title>
38973 <indexterm role="concept">
38974 <primary>maildir format</primary>
38975 <secondary>description of</secondary>
38977 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
38978 it to a file whose name is <filename>tmp/<stime>.H<mtime>P<pid>.<host></filename> in the
38979 directory that is defined by the <option>directory</option> option (the <quote>delivery
38980 directory</quote>). If the delivery is successful, the file is renamed into the
38981 <filename>new</filename> subdirectory.
38984 In the file name, <<emphasis>stime</emphasis>> is the current time of day in seconds, and
38985 <<emphasis>mtime</emphasis>> is the microsecond fraction of the time. After a maildir delivery,
38986 Exim checks that the time-of-day clock has moved on by at least one microsecond
38987 before terminating the delivery process. This guarantees uniqueness for the
38988 file name. However, as a precaution, Exim calls <function>stat()</function> for the file before
38989 opening it. If any response other than ENOENT (does not exist) is given,
38990 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
38993 Before Exim carries out a maildir delivery, it ensures that subdirectories
38994 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
38995 do not exist, Exim tries to create them and any superior directories in their
38996 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
38997 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
38998 contains matches the delivery directory, Exim also ensures that a file called
38999 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
39000 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
39003 These features make it possible to use Exim to create all the necessary files
39004 and directories in a maildir mailbox, including subdirectories for maildir++
39005 folders. Consider this example:
39007 <literallayout class="monospaced">
39008 maildir_format = true
39009 directory = /var/mail/$local_part\
39010 ${if eq{$local_part_suffix}{}{}\
39011 {/.${substr_1:$local_part_suffix}}}
39012 maildirfolder_create_regex = /\.[^/]+$
39015 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
39016 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
39017 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
39018 not match this name, so Exim will not look for or create the file
39019 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
39020 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
39023 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
39024 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
39025 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
39026 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
39027 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
39030 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
39031 not inadvertently match the toplevel maildir directory, because a
39032 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
39035 <indexterm role="concept">
39036 <primary>quota</primary>
39037 <secondary>in maildir delivery</secondary>
39039 <indexterm role="concept">
39040 <primary>maildir++</primary>
39042 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
39043 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
39044 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
39045 Exim assumes the directory is a maildir++ folder directory, which is one level
39046 down from the user’s top level mailbox directory. This causes it to start at
39047 the parent directory instead of the current directory when calculating the
39048 amount of space used.
39051 One problem with delivering into a multi-file mailbox is that it is
39052 computationally expensive to compute the size of the mailbox for quota
39053 checking. Various approaches have been taken to reduce the amount of work
39054 needed. The next two sections describe two of them. A third alternative is to
39055 use some external process for maintaining the size data, and use the expansion
39056 of the <option>mailbox_size</option> option as a way of importing it into Exim.
39059 <section id="SECID135">
39060 <title>Using tags to record message sizes</title>
39062 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
39063 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
39064 tag is added to its name. However, if adding the tag takes the length of the
39065 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
39066 the tag is dropped and the maildir file is created with no tag.
39069 <indexterm role="variable">
39070 <primary><varname>$message_size</varname></primary>
39072 Tags can be used to encode the size of files in their names; see
39073 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
39074 happens after the message has been written. The value of the <varname>$message_size</varname>
39075 variable is set to the number of bytes actually written. If the expansion is
39076 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
39077 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
39078 Non-printing characters in the string are ignored; if the resulting string is
39079 empty, it is ignored. If it starts with an alphanumeric character, a leading
39083 <section id="SECID136">
39084 <title>Using a maildirsize file</title>
39086 <indexterm role="concept">
39087 <primary>quota</primary>
39088 <secondary>in maildir delivery</secondary>
39090 <indexterm role="concept">
39091 <primary>maildir format</primary>
39092 <secondary><filename>maildirsize</filename> file</secondary>
39094 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
39095 storing quota and message size information in a file called <filename>maildirsize</filename>
39096 within the toplevel maildir directory. If this file does not exist, Exim
39097 creates it, setting the quota from the <option>quota</option> option of the transport. If
39098 the maildir directory itself does not exist, it is created before any attempt
39099 to write a <filename>maildirsize</filename> file.
39102 The <filename>maildirsize</filename> file is used to hold information about the sizes of
39103 messages in the maildir, thus speeding up quota calculations. The quota value
39104 in the file is just a cache; if the quota is changed in the transport, the new
39105 value overrides the cached value when the next message is delivered. The cache
39106 is maintained for the benefit of other programs that access the maildir and
39107 need to know the quota.
39110 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
39111 file is maintained (with a zero quota setting), but no quota is imposed.
39114 A regular expression is available for controlling which directories in the
39115 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
39116 See the description of the <option>maildir_quota_directory_regex</option> option above for
39120 <section id="SECID137">
39121 <title>Mailstore delivery</title>
39123 <indexterm role="concept">
39124 <primary>mailstore format</primary>
39125 <secondary>description of</secondary>
39127 If the <option>mailstore_format</option> option is true, each message is written as two
39128 files in the given directory. A unique base name is constructed from the
39129 message id and the current delivery process, and the files that are written use
39130 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
39131 contains the message’s envelope, and the <filename>.msg</filename> file contains the message
39132 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
39135 During delivery, the envelope is first written to a file with the suffix
39136 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
39137 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
39138 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
39139 file before accessing either of them. An alternative approach is to wait for
39140 the absence of a <filename>.tmp</filename> file.
39143 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
39144 option, expanded and terminated by a newline if there isn’t one. Then follows
39145 the sender address on one line, then all the recipient addresses, one per line.
39146 There can be more than one recipient only if the <option>batch_max</option> option is set
39147 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
39148 appended to the file, followed by a newline if it does not end with one.
39151 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
39152 failure, it is ignored. Other expansion errors are treated as serious
39153 configuration errors, and delivery is deferred. The variable
39154 <varname>$mailstore_basename</varname> is available for use during these expansions.
39157 <section id="SECID138">
39158 <title>Non-special new file delivery</title>
39160 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
39161 file is created directly in the named directory. For example, when delivering
39162 messages into files in batched SMTP format for later delivery to some host (see
39163 section <xref linkend="SECTbatchSMTP"/>), a setting such as
39165 <literallayout class="monospaced">
39166 directory = /var/bsmtp/$host
39169 might be used. A message is written to a file with a temporary name, which is
39170 then renamed when the delivery is complete. The final name is obtained by
39171 expanding the contents of the <option>directory_file</option> option.
39172 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
39173 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
39178 <chapter id="CHID8">
39179 <title>The autoreply transport</title>
39181 <indexterm role="concept" id="IIDauttra1" class="startofrange">
39182 <primary>transports</primary>
39183 <secondary><command>autoreply</command></secondary>
39185 <indexterm role="concept" id="IIDauttra2" class="startofrange">
39186 <primary><command>autoreply</command> transport</primary>
39188 The <command>autoreply</command> transport is not a true transport in that it does not cause
39189 the message to be transmitted. Instead, it generates a new mail message as an
39190 automatic reply to the incoming message. <emphasis>References:</emphasis> and
39191 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
39192 to the rules in RFCs 2822 and 3834, respectively.
39195 If the router that passes the message to this transport does not have the
39196 <option>unseen</option> option set, the original message (for the current recipient) is not
39197 delivered anywhere. However, when the <option>unseen</option> option is set on the router
39198 that passes the message to this transport, routing of the address continues, so
39199 another router can set up a normal message delivery.
39202 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
39203 <quote>vacation</quote> message being the standard example. However, it can also be run
39204 directly from a router like any other transport. To reduce the possibility of
39205 message cascades, messages created by the <command>autoreply</command> transport always have
39206 empty envelope sender addresses, like bounce messages.
39209 The parameters of the message to be sent can be specified in the configuration
39210 by options described below. However, these are used only when the address
39211 passed to the transport does not contain its own reply information. When the
39212 transport is run as a consequence of a
39213 <option>mail</option>
39214 or <option>vacation</option> command in a filter file, the parameters of the message are
39215 supplied by the filter, and passed with the address. The transport’s options
39216 that define the message are then ignored (so they are not usually set in this
39217 case). The message is specified entirely by the filter or by the transport; it
39218 is never built from a mixture of options. However, the <option>file_optional</option>,
39219 <option>mode</option>, and <option>return_message</option> options apply in all cases.
39222 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
39223 command in a user’s filter file, <command>autoreply</command> normally runs under the uid and
39224 gid of the user, and with appropriate current and home directories (see chapter
39225 <xref linkend="CHAPenvironment"/>).
39228 There is a subtle difference between routing a message to a <command>pipe</command> transport
39229 that generates some text to be returned to the sender, and routing it to an
39230 <command>autoreply</command> transport. This difference is noticeable only if more than one
39231 address from the same message is so handled. In the case of a pipe, the
39232 separate outputs from the different addresses are gathered up and returned to
39233 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
39234 message is generated for each address that is passed to it.
39237 Non-printing characters are not permitted in the header lines generated for the
39238 message that <command>autoreply</command> creates, with the exception of newlines that are
39239 immediately followed by white space. If any non-printing characters are found,
39240 the transport defers.
39241 Whether characters with the top bit set count as printing characters or not is
39242 controlled by the <option>print_topbitchars</option> global option.
39245 If any of the generic options for manipulating headers (for example,
39246 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
39247 of the original message that is included in the generated message when
39248 <option>return_message</option> is set. They do not apply to the generated message itself.
39251 <indexterm role="variable">
39252 <primary><varname>$sender_address</varname></primary>
39254 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
39255 the message, indicating that there were no recipients, it does not treat this
39256 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
39257 is empty (because the incoming message is a bounce message) do not cause
39258 problems. They are just discarded.
39260 <section id="SECID139">
39261 <title>Private options for autoreply</title>
39263 <indexterm role="concept">
39264 <primary>options</primary>
39265 <secondary><command>autoreply</command> transport</secondary>
39269 <indexterm role="option">
39270 <primary><option>bcc</option></primary>
39273 <informaltable frame="all">
39274 <tgroup cols="4" colsep="0" rowsep="0">
39275 <colspec colwidth="8*" align="left"/>
39276 <colspec colwidth="6*" align="center"/>
39277 <colspec colwidth="6*" align="center"/>
39278 <colspec colwidth="6*" align="right"/>
39281 <entry><option>bcc</option></entry>
39282 <entry>Use: <emphasis>autoreply</emphasis></entry>
39283 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39284 <entry>Default: <emphasis>unset</emphasis></entry>
39290 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
39291 message when the message is specified by the transport.
39294 <indexterm role="option">
39295 <primary><option>cc</option></primary>
39298 <informaltable frame="all">
39299 <tgroup cols="4" colsep="0" rowsep="0">
39300 <colspec colwidth="8*" align="left"/>
39301 <colspec colwidth="6*" align="center"/>
39302 <colspec colwidth="6*" align="center"/>
39303 <colspec colwidth="6*" align="right"/>
39306 <entry><option>cc</option></entry>
39307 <entry>Use: <emphasis>autoreply</emphasis></entry>
39308 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39309 <entry>Default: <emphasis>unset</emphasis></entry>
39315 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
39316 when the message is specified by the transport.
39319 <indexterm role="option">
39320 <primary><option>file</option></primary>
39323 <informaltable frame="all">
39324 <tgroup cols="4" colsep="0" rowsep="0">
39325 <colspec colwidth="8*" align="left"/>
39326 <colspec colwidth="6*" align="center"/>
39327 <colspec colwidth="6*" align="center"/>
39328 <colspec colwidth="6*" align="right"/>
39331 <entry><option>file</option></entry>
39332 <entry>Use: <emphasis>autoreply</emphasis></entry>
39333 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39334 <entry>Default: <emphasis>unset</emphasis></entry>
39340 The contents of the file are sent as the body of the message when the message
39341 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
39342 string comes first.
39345 <indexterm role="option">
39346 <primary><option>file_expand</option></primary>
39349 <informaltable frame="all">
39350 <tgroup cols="4" colsep="0" rowsep="0">
39351 <colspec colwidth="8*" align="left"/>
39352 <colspec colwidth="6*" align="center"/>
39353 <colspec colwidth="6*" align="center"/>
39354 <colspec colwidth="6*" align="right"/>
39357 <entry><option>file_expand</option></entry>
39358 <entry>Use: <emphasis>autoreply</emphasis></entry>
39359 <entry>Type: <emphasis>boolean</emphasis></entry>
39360 <entry>Default: <emphasis>false</emphasis></entry>
39366 If this is set, the contents of the file named by the <option>file</option> option are
39367 subjected to string expansion as they are added to the message.
39370 <indexterm role="option">
39371 <primary><option>file_optional</option></primary>
39374 <informaltable frame="all">
39375 <tgroup cols="4" colsep="0" rowsep="0">
39376 <colspec colwidth="8*" align="left"/>
39377 <colspec colwidth="6*" align="center"/>
39378 <colspec colwidth="6*" align="center"/>
39379 <colspec colwidth="6*" align="right"/>
39382 <entry><option>file_optional</option></entry>
39383 <entry>Use: <emphasis>autoreply</emphasis></entry>
39384 <entry>Type: <emphasis>boolean</emphasis></entry>
39385 <entry>Default: <emphasis>false</emphasis></entry>
39391 If this option is true, no error is generated if the file named by the <option>file</option>
39392 option or passed with the address does not exist or cannot be read.
39395 <indexterm role="option">
39396 <primary><option>from</option></primary>
39399 <informaltable frame="all">
39400 <tgroup cols="4" colsep="0" rowsep="0">
39401 <colspec colwidth="8*" align="left"/>
39402 <colspec colwidth="6*" align="center"/>
39403 <colspec colwidth="6*" align="center"/>
39404 <colspec colwidth="6*" align="right"/>
39407 <entry><option>from</option></entry>
39408 <entry>Use: <emphasis>autoreply</emphasis></entry>
39409 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39410 <entry>Default: <emphasis>unset</emphasis></entry>
39416 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
39417 specified by the transport.
39420 <indexterm role="option">
39421 <primary><option>headers</option></primary>
39424 <informaltable frame="all">
39425 <tgroup cols="4" colsep="0" rowsep="0">
39426 <colspec colwidth="8*" align="left"/>
39427 <colspec colwidth="6*" align="center"/>
39428 <colspec colwidth="6*" align="center"/>
39429 <colspec colwidth="6*" align="right"/>
39432 <entry><option>headers</option></entry>
39433 <entry>Use: <emphasis>autoreply</emphasis></entry>
39434 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39435 <entry>Default: <emphasis>unset</emphasis></entry>
39441 This specifies additional RFC 2822 headers that are to be added to the message
39442 when the message is specified by the transport. Several can be given by using
39443 <quote>\n</quote> to separate them. There is no check on the format.
39446 <indexterm role="option">
39447 <primary><option>log</option></primary>
39450 <informaltable frame="all">
39451 <tgroup cols="4" colsep="0" rowsep="0">
39452 <colspec colwidth="8*" align="left"/>
39453 <colspec colwidth="6*" align="center"/>
39454 <colspec colwidth="6*" align="center"/>
39455 <colspec colwidth="6*" align="right"/>
39458 <entry><option>log</option></entry>
39459 <entry>Use: <emphasis>autoreply</emphasis></entry>
39460 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39461 <entry>Default: <emphasis>unset</emphasis></entry>
39467 This option names a file in which a record of every message sent is logged when
39468 the message is specified by the transport.
39471 <indexterm role="option">
39472 <primary><option>mode</option></primary>
39475 <informaltable frame="all">
39476 <tgroup cols="4" colsep="0" rowsep="0">
39477 <colspec colwidth="8*" align="left"/>
39478 <colspec colwidth="6*" align="center"/>
39479 <colspec colwidth="6*" align="center"/>
39480 <colspec colwidth="6*" align="right"/>
39483 <entry><option>mode</option></entry>
39484 <entry>Use: <emphasis>autoreply</emphasis></entry>
39485 <entry>Type: <emphasis>octal integer</emphasis></entry>
39486 <entry>Default: <emphasis>0600</emphasis></entry>
39492 If either the log file or the <quote>once</quote> file has to be created, this mode is
39496 <indexterm role="option">
39497 <primary><option>never_mail</option></primary>
39500 <informaltable frame="all">
39501 <tgroup cols="4" colsep="0" rowsep="0">
39502 <colspec colwidth="8*" align="left"/>
39503 <colspec colwidth="6*" align="center"/>
39504 <colspec colwidth="6*" align="center"/>
39505 <colspec colwidth="6*" align="right"/>
39508 <entry><option>never_mail</option></entry>
39509 <entry>Use: <emphasis>autoreply</emphasis></entry>
39510 <entry>Type: <emphasis>address list</emphasis>†<emphasis></emphasis></entry>
39511 <entry>Default: <emphasis>unset</emphasis></entry>
39517 If any run of the transport creates a message with a recipient that matches any
39518 item in the list, that recipient is quietly discarded. If all recipients are
39519 discarded, no message is created. This applies both when the recipients are
39520 generated by a filter and when they are specified in the transport.
39523 <indexterm role="option">
39524 <primary><option>once</option></primary>
39527 <informaltable frame="all">
39528 <tgroup cols="4" colsep="0" rowsep="0">
39529 <colspec colwidth="8*" align="left"/>
39530 <colspec colwidth="6*" align="center"/>
39531 <colspec colwidth="6*" align="center"/>
39532 <colspec colwidth="6*" align="right"/>
39535 <entry><option>once</option></entry>
39536 <entry>Use: <emphasis>autoreply</emphasis></entry>
39537 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39538 <entry>Default: <emphasis>unset</emphasis></entry>
39544 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
39545 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
39546 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
39549 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
39550 By default, if <option>once</option> is set to a non-empty file name, the message
39551 is not sent if a potential recipient is already listed in the database.
39552 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
39553 message is sent if that much time has elapsed since a message was last sent to
39554 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
39555 prevents a message from being sent a second time – in this case, zero means
39559 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
39560 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
39561 greater than zero, it changes the way Exim implements the <option>once</option> option.
39562 Instead of using a DBM file to record every recipient it sends to, it uses a
39563 regular file, whose size will never get larger than the given value.
39566 In the file, Exim keeps a linear list of recipient addresses and the times at
39567 which they were sent messages. If the file is full when a new address needs to
39568 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
39569 means that a given recipient may receive multiple messages, but at
39570 unpredictable intervals that depend on the rate of turnover of addresses in the
39571 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
39574 <indexterm role="option">
39575 <primary><option>once_file_size</option></primary>
39578 <informaltable frame="all">
39579 <tgroup cols="4" colsep="0" rowsep="0">
39580 <colspec colwidth="8*" align="left"/>
39581 <colspec colwidth="6*" align="center"/>
39582 <colspec colwidth="6*" align="center"/>
39583 <colspec colwidth="6*" align="right"/>
39586 <entry><option>once_file_size</option></entry>
39587 <entry>Use: <emphasis>autoreply</emphasis></entry>
39588 <entry>Type: <emphasis>integer</emphasis></entry>
39589 <entry>Default: <emphasis>0</emphasis></entry>
39595 See <option>once</option> above.
39598 <indexterm role="option">
39599 <primary><option>once_repeat</option></primary>
39602 <informaltable frame="all">
39603 <tgroup cols="4" colsep="0" rowsep="0">
39604 <colspec colwidth="8*" align="left"/>
39605 <colspec colwidth="6*" align="center"/>
39606 <colspec colwidth="6*" align="center"/>
39607 <colspec colwidth="6*" align="right"/>
39610 <entry><option>once_repeat</option></entry>
39611 <entry>Use: <emphasis>autoreply</emphasis></entry>
39612 <entry>Type: <emphasis>time</emphasis>†<emphasis></emphasis></entry>
39613 <entry>Default: <emphasis>0s</emphasis></entry>
39619 See <option>once</option> above.
39620 After expansion, the value of this option must be a valid time value.
39623 <indexterm role="option">
39624 <primary><option>reply_to</option></primary>
39627 <informaltable frame="all">
39628 <tgroup cols="4" colsep="0" rowsep="0">
39629 <colspec colwidth="8*" align="left"/>
39630 <colspec colwidth="6*" align="center"/>
39631 <colspec colwidth="6*" align="center"/>
39632 <colspec colwidth="6*" align="right"/>
39635 <entry><option>reply_to</option></entry>
39636 <entry>Use: <emphasis>autoreply</emphasis></entry>
39637 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39638 <entry>Default: <emphasis>unset</emphasis></entry>
39644 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
39645 specified by the transport.
39648 <indexterm role="option">
39649 <primary><option>return_message</option></primary>
39652 <informaltable frame="all">
39653 <tgroup cols="4" colsep="0" rowsep="0">
39654 <colspec colwidth="8*" align="left"/>
39655 <colspec colwidth="6*" align="center"/>
39656 <colspec colwidth="6*" align="center"/>
39657 <colspec colwidth="6*" align="right"/>
39660 <entry><option>return_message</option></entry>
39661 <entry>Use: <emphasis>autoreply</emphasis></entry>
39662 <entry>Type: <emphasis>boolean</emphasis></entry>
39663 <entry>Default: <emphasis>false</emphasis></entry>
39669 If this is set, a copy of the original message is returned with the new
39670 message, subject to the maximum size set in the <option>return_size_limit</option> global
39671 configuration option.
39674 <indexterm role="option">
39675 <primary><option>subject</option></primary>
39678 <informaltable frame="all">
39679 <tgroup cols="4" colsep="0" rowsep="0">
39680 <colspec colwidth="8*" align="left"/>
39681 <colspec colwidth="6*" align="center"/>
39682 <colspec colwidth="6*" align="center"/>
39683 <colspec colwidth="6*" align="right"/>
39686 <entry><option>subject</option></entry>
39687 <entry>Use: <emphasis>autoreply</emphasis></entry>
39688 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39689 <entry>Default: <emphasis>unset</emphasis></entry>
39695 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
39696 specified by the transport. It is tempting to quote the original subject in
39697 automatic responses. For example:
39699 <literallayout class="monospaced">
39700 subject = Re: $h_subject:
39703 There is a danger in doing this, however. It may allow a third party to
39704 subscribe your users to an opt-in mailing list, provided that the list accepts
39705 bounce messages as subscription confirmations. Well-managed lists require a
39706 non-bounce message to confirm a subscription, so the danger is relatively
39710 <indexterm role="option">
39711 <primary><option>text</option></primary>
39714 <informaltable frame="all">
39715 <tgroup cols="4" colsep="0" rowsep="0">
39716 <colspec colwidth="8*" align="left"/>
39717 <colspec colwidth="6*" align="center"/>
39718 <colspec colwidth="6*" align="center"/>
39719 <colspec colwidth="6*" align="right"/>
39722 <entry><option>text</option></entry>
39723 <entry>Use: <emphasis>autoreply</emphasis></entry>
39724 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39725 <entry>Default: <emphasis>unset</emphasis></entry>
39731 This specifies a single string to be used as the body of the message when the
39732 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
39733 the text comes first.
39736 <indexterm role="option">
39737 <primary><option>to</option></primary>
39740 <informaltable frame="all">
39741 <tgroup cols="4" colsep="0" rowsep="0">
39742 <colspec colwidth="8*" align="left"/>
39743 <colspec colwidth="6*" align="center"/>
39744 <colspec colwidth="6*" align="center"/>
39745 <colspec colwidth="6*" align="right"/>
39748 <entry><option>to</option></entry>
39749 <entry>Use: <emphasis>autoreply</emphasis></entry>
39750 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39751 <entry>Default: <emphasis>unset</emphasis></entry>
39757 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
39758 when the message is specified by the transport.
39759 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
39760 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
39765 <chapter id="CHAPLMTP">
39766 <title>The lmtp transport</title>
39768 <indexterm role="concept">
39769 <primary>transports</primary>
39770 <secondary><command>lmtp</command></secondary>
39772 <indexterm role="concept">
39773 <primary><command>lmtp</command> transport</primary>
39775 <indexterm role="concept">
39776 <primary>LMTP</primary>
39777 <secondary>over a pipe</secondary>
39779 <indexterm role="concept">
39780 <primary>LMTP</primary>
39781 <secondary>over a socket</secondary>
39783 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
39785 or by interacting with a Unix domain socket.
39786 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
39787 transports. Exim also has support for using LMTP over TCP/IP; this is
39788 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
39789 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
39790 has it commented out. You need to ensure that
39792 <literallayout class="monospaced">
39796 <indexterm role="concept">
39797 <primary>options</primary>
39798 <secondary><command>lmtp</command> transport</secondary>
39800 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
39801 included in the Exim binary. The private options of the <command>lmtp</command> transport are
39805 <indexterm role="option">
39806 <primary><option>batch_id</option></primary>
39809 <informaltable frame="all">
39810 <tgroup cols="4" colsep="0" rowsep="0">
39811 <colspec colwidth="8*" align="left"/>
39812 <colspec colwidth="6*" align="center"/>
39813 <colspec colwidth="6*" align="center"/>
39814 <colspec colwidth="6*" align="right"/>
39817 <entry><option>batch_id</option></entry>
39818 <entry>Use: <emphasis>lmtp</emphasis></entry>
39819 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39820 <entry>Default: <emphasis>unset</emphasis></entry>
39826 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
39829 <indexterm role="option">
39830 <primary><option>batch_max</option></primary>
39833 <informaltable frame="all">
39834 <tgroup cols="4" colsep="0" rowsep="0">
39835 <colspec colwidth="8*" align="left"/>
39836 <colspec colwidth="6*" align="center"/>
39837 <colspec colwidth="6*" align="center"/>
39838 <colspec colwidth="6*" align="right"/>
39841 <entry><option>batch_max</option></entry>
39842 <entry>Use: <emphasis>lmtp</emphasis></entry>
39843 <entry>Type: <emphasis>integer</emphasis></entry>
39844 <entry>Default: <emphasis>1</emphasis></entry>
39850 This limits the number of addresses that can be handled in a single delivery.
39851 Most LMTP servers can handle several addresses at once, so it is normally a
39852 good idea to increase this value. See the description of local delivery
39853 batching in chapter <xref linkend="CHAPbatching"/>.
39856 <indexterm role="option">
39857 <primary><option>command</option></primary>
39860 <informaltable frame="all">
39861 <tgroup cols="4" colsep="0" rowsep="0">
39862 <colspec colwidth="8*" align="left"/>
39863 <colspec colwidth="6*" align="center"/>
39864 <colspec colwidth="6*" align="center"/>
39865 <colspec colwidth="6*" align="right"/>
39868 <entry><option>command</option></entry>
39869 <entry>Use: <emphasis>lmtp</emphasis></entry>
39870 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39871 <entry>Default: <emphasis>unset</emphasis></entry>
39877 This option must be set if <option>socket</option> is not set. The string is a command which
39878 is run in a separate process. It is split up into a command name and list of
39879 arguments, each of which is separately expanded (so expansion cannot change the
39880 number of arguments). The command is run directly, not via a shell. The message
39881 is passed to the new process using the standard input and output to operate the
39885 <indexterm role="option">
39886 <primary><option>ignore_quota</option></primary>
39889 <informaltable frame="all">
39890 <tgroup cols="4" colsep="0" rowsep="0">
39891 <colspec colwidth="8*" align="left"/>
39892 <colspec colwidth="6*" align="center"/>
39893 <colspec colwidth="6*" align="center"/>
39894 <colspec colwidth="6*" align="right"/>
39897 <entry><option>ignore_quota</option></entry>
39898 <entry>Use: <emphasis>lmtp</emphasis></entry>
39899 <entry>Type: <emphasis>boolean</emphasis></entry>
39900 <entry>Default: <emphasis>false</emphasis></entry>
39906 <indexterm role="concept">
39907 <primary>LMTP</primary>
39908 <secondary>ignoring quota errors</secondary>
39910 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
39911 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
39912 in its response to the LHLO command.
39915 <indexterm role="option">
39916 <primary><option>socket</option></primary>
39919 <informaltable frame="all">
39920 <tgroup cols="4" colsep="0" rowsep="0">
39921 <colspec colwidth="8*" align="left"/>
39922 <colspec colwidth="6*" align="center"/>
39923 <colspec colwidth="6*" align="center"/>
39924 <colspec colwidth="6*" align="right"/>
39927 <entry><option>socket</option></entry>
39928 <entry>Use: <emphasis>lmtp</emphasis></entry>
39929 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39930 <entry>Default: <emphasis>unset</emphasis></entry>
39936 This option must be set if <option>command</option> is not set. The result of expansion must
39937 be the name of a Unix domain socket. The transport connects to the socket and
39938 delivers the message to it using the LMTP protocol.
39941 <indexterm role="option">
39942 <primary><option>timeout</option></primary>
39945 <informaltable frame="all">
39946 <tgroup cols="4" colsep="0" rowsep="0">
39947 <colspec colwidth="8*" align="left"/>
39948 <colspec colwidth="6*" align="center"/>
39949 <colspec colwidth="6*" align="center"/>
39950 <colspec colwidth="6*" align="right"/>
39953 <entry><option>timeout</option></entry>
39954 <entry>Use: <emphasis>lmtp</emphasis></entry>
39955 <entry>Type: <emphasis>time</emphasis></entry>
39956 <entry>Default: <emphasis>5m</emphasis></entry>
39962 The transport is aborted if the created process or Unix domain socket does not
39963 respond to LMTP commands or message input within this timeout. Delivery
39964 is deferred, and will be tried again later. Here is an example of a typical
39967 <literallayout class="monospaced">
39970 command = /some/local/lmtp/delivery/program
39975 This delivers up to 20 addresses at a time, in a mixture of domains if
39976 necessary, running as the user <emphasis>exim</emphasis>.
39980 <chapter id="CHAPpipetransport">
39981 <title>The pipe transport</title>
39983 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
39984 <primary>transports</primary>
39985 <secondary><command>pipe</command></secondary>
39987 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
39988 <primary><command>pipe</command> transport</primary>
39990 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
39991 running in another process. One example is the use of <command>pipe</command> as a
39992 pseudo-remote transport for passing messages to some other delivery mechanism
39993 (such as UUCP). Another is the use by individual users to automatically process
39994 their incoming messages. The <command>pipe</command> transport can be used in one of the
40000 <indexterm role="variable">
40001 <primary><varname>$local_part</varname></primary>
40003 A router routes one address to a transport in the normal way, and the
40004 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
40005 contains the local part of the address (as usual), and the command that is run
40006 is specified by the <option>command</option> option on the transport.
40011 <indexterm role="variable">
40012 <primary><varname>$pipe_addresses</varname></primary>
40014 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
40015 transport can handle more than one address in a single run. In this case, when
40016 more than one address is routed to the transport, <varname>$local_part</varname> is not set
40017 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
40018 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
40019 that are routed to the transport.
40024 <indexterm role="variable">
40025 <primary><varname>$address_pipe</varname></primary>
40027 A router redirects an address directly to a pipe command (for example, from an
40028 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
40029 pipe command, and the <option>command</option> option on the transport is ignored. If only
40030 one address is being transported (<option>batch_max</option> is not greater than one, or
40031 only one address was redirected to this pipe command), <varname>$local_part</varname> contains
40032 the local part that was redirected.
40037 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
40038 deliver messages over pipes using the LMTP interactive protocol. This is
40039 implemented by the <command>lmtp</command> transport.
40042 In the case when <command>pipe</command> is run as a consequence of an entry in a local user’s
40043 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
40044 other cases, the uid and gid have to be specified explicitly, either on the
40045 transport or on the router that handles the address. Current and <quote>home</quote>
40046 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
40047 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
40048 for a discussion of local delivery batching.
40050 <section id="SECID140">
40051 <title>Concurrent delivery</title>
40053 If two messages arrive at almost the same time, and both are routed to a pipe
40054 delivery, the two pipe transports may be run concurrently. You must ensure that
40055 any pipe commands you set up are robust against this happening. If the commands
40056 write to a file, the <option>exim_lock</option> utility might be of use.
40059 <section id="SECID141">
40060 <title>Returned status and data</title>
40062 <indexterm role="concept">
40063 <primary><command>pipe</command> transport</primary>
40064 <secondary>returned data</secondary>
40066 If the command exits with a non-zero return code, the delivery is deemed to
40067 have failed, unless either the <option>ignore_status</option> option is set (in which case
40068 the return code is treated as zero), or the return code is one of those listed
40069 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
40070 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
40071 logged, but are not included in the bounce message, which merely contains
40072 <quote>local delivery failed</quote>.
40075 If the return code is greater than 128 and the command being run is a shell
40076 script, it normally means that the script was terminated by a signal whose
40077 value is the return code minus 128.
40080 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
40081 return code is set to 127. This is the value that a shell returns if it is
40082 asked to run a non-existent command. The wording for the log line suggests that
40083 a non-existent command may be the problem.
40086 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
40087 set and the command produces any output on its standard output or standard
40088 error streams, the command is considered to have failed, even if it gave a zero
40089 return code or if <option>ignore_status</option> is set. The output from the command is
40090 included as part of the bounce message. The <option>return_fail_output</option> option is
40091 similar, except that output is returned only when the command exits with a
40092 failure return code, that is, a value other than zero or a code that matches
40093 <option>temp_errors</option>.
40096 <section id="SECThowcommandrun">
40097 <title>How the command is run</title>
40099 <indexterm role="concept">
40100 <primary><command>pipe</command> transport</primary>
40101 <secondary>path for command</secondary>
40103 The command line is (by default) broken down into a command name and arguments
40104 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
40105 <option>restrict_to_path</option> options can be used to restrict the commands that may be
40109 <indexterm role="concept">
40110 <primary>quoting</primary>
40111 <secondary>in pipe command</secondary>
40113 Unquoted arguments are delimited by white space. If an argument appears in
40114 double quotes, backslash is interpreted as an escape character in the usual
40115 way. If an argument appears in single quotes, no escaping is done.
40118 String expansion is applied to the command line except when it comes from a
40119 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
40120 expansion is applied to each argument in turn rather than to the whole line.
40121 For this reason, any string expansion item that contains white space must be
40122 quoted so as to be contained within a single argument. A setting such as
40124 <literallayout class="monospaced">
40125 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
40128 will not work, because the expansion item gets split between several
40129 arguments. You have to write
40131 <literallayout class="monospaced">
40132 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
40135 to ensure that it is all in one argument. The expansion is done in this way,
40136 argument by argument, so that the number of arguments cannot be changed as a
40137 result of expansion, and quotes or backslashes in inserted variables do not
40138 interact with external quoting. However, this leads to problems if you want to
40139 generate multiple arguments (or the command name plus arguments) from a single
40140 expansion. In this situation, the simplest solution is to use a shell. For
40143 <literallayout class="monospaced">
40144 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
40147 <indexterm role="concept">
40148 <primary>transport</primary>
40149 <secondary>filter</secondary>
40151 <indexterm role="concept">
40152 <primary>filter</primary>
40153 <secondary>transport filter</secondary>
40155 <indexterm role="variable">
40156 <primary><varname>$pipe_addresses</varname></primary>
40158 Special handling takes place when an argument consists of precisely the text
40159 <literal>$pipe_addresses</literal>. This is not a general expansion variable; the only
40160 place this string is recognized is when it appears as an argument for a pipe or
40161 transport filter command. It causes each address that is being handled to be
40162 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
40163 avoids any problems with spaces or shell metacharacters, and is of use when a
40164 <command>pipe</command> transport is handling groups of addresses in a batch.
40167 After splitting up into arguments and expansion, the resulting command is run
40168 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
40169 message that is being delivered is supplied on the standard input, and the
40170 standard output and standard error are both connected to a single pipe that is
40171 read by Exim. The <option>max_output</option> option controls how much output the command
40172 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
40173 control what is done with it.
40176 Not running the command under a shell (by default) lessens the security risks
40177 in cases when a command from a user’s filter file is built out of data that was
40178 taken from an incoming message. If a shell is required, it can of course be
40179 explicitly specified as the command to be run. However, there are circumstances
40180 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
40181 under a shell and cannot easily be modified. To allow for these cases, there is
40182 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
40183 works. Instead of breaking up the command line as just described, it expands it
40184 as a single string and passes the result to <filename>/bin/sh</filename>. The
40185 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
40186 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
40189 <section id="SECTpipeenv">
40190 <title>Environment variables</title>
40192 <indexterm role="concept">
40193 <primary><command>pipe</command> transport</primary>
40194 <secondary>environment for command</secondary>
40196 <indexterm role="concept">
40197 <primary>environment for pipe transport</primary>
40199 The environment variables listed below are set up when the command is invoked.
40200 This list is a compromise for maximum compatibility with other MTAs. Note that
40201 the <option>environment</option> option can be used to add additional variables to this
40205 <literal>DOMAIN </literal> the domain of the address
40206 <literal>HOME </literal> the home directory, if set
40207 <literal>HOST </literal> the host name when called from a router (see below)
40208 <literal>LOCAL_PART </literal> see below
40209 <literal>LOCAL_PART_PREFIX </literal> see below
40210 <literal>LOCAL_PART_SUFFIX </literal> see below
40211 <literal>LOGNAME </literal> see below
40212 <literal>MESSAGE_ID </literal> Exim’s local ID for the message
40213 <literal>PATH </literal> as specified by the <option>path</option> option below
40214 <literal>QUALIFY_DOMAIN </literal> the sender qualification domain
40215 <literal>RECIPIENT </literal> the complete recipient address
40216 <literal>SENDER </literal> the sender of the message (empty if a bounce)
40217 <literal>SHELL </literal> <literal>/bin/sh</literal>
40218 <literal>TZ </literal> the value of the <option>timezone</option> option, if set
40219 <literal>USER </literal> see below
40222 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
40223 router, LOCAL_PART is set to the local part of the address. When it is
40224 called as a result of a forward or alias expansion, LOCAL_PART is set to
40225 the local part of the address that was expanded. In both cases, any affixes are
40226 removed from the local part, and made available in LOCAL_PART_PREFIX and
40227 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
40228 same value as LOCAL_PART for compatibility with other MTAs.
40231 <indexterm role="concept">
40232 <primary>HOST</primary>
40234 HOST is set only when a <command>pipe</command> transport is called from a router that
40235 associates hosts with an address, typically when using <command>pipe</command> as a
40236 pseudo-remote transport. HOST is set to the first host name specified by
40240 <indexterm role="concept">
40241 <primary>HOME</primary>
40243 If the transport’s generic <option>home_directory</option> option is set, its value is used
40244 for the HOME environment variable. Otherwise, a home directory may be set
40245 by the router’s <option>transport_home_directory</option> option, which defaults to the
40246 user’s home directory if <option>check_local_user</option> is set.
40249 <section id="SECID142">
40250 <title>Private options for pipe</title>
40252 <indexterm role="concept">
40253 <primary>options</primary>
40254 <secondary><command>pipe</command> transport</secondary>
40258 <indexterm role="option">
40259 <primary><option>allow_commands</option></primary>
40262 <informaltable frame="all">
40263 <tgroup cols="4" colsep="0" rowsep="0">
40264 <colspec colwidth="8*" align="left"/>
40265 <colspec colwidth="6*" align="center"/>
40266 <colspec colwidth="6*" align="center"/>
40267 <colspec colwidth="6*" align="right"/>
40270 <entry><option>allow_commands</option></entry>
40271 <entry>Use: <emphasis>pipe</emphasis></entry>
40272 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
40273 <entry>Default: <emphasis>unset</emphasis></entry>
40279 <indexterm role="concept">
40280 <primary><command>pipe</command> transport</primary>
40281 <secondary>permitted commands</secondary>
40283 The string is expanded, and is then interpreted as a colon-separated list of
40284 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
40285 permitted are those in the <option>allow_commands</option> list. They need not be absolute
40286 paths; the <option>path</option> option is still used for relative paths. If
40287 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
40288 in the <option>allow_commands</option> list, or a name without any slashes that is found on
40289 the path. In other words, if neither <option>allow_commands</option> nor
40290 <option>restrict_to_path</option> is set, there is no restriction on the command, but
40291 otherwise only commands that are permitted by one or the other are allowed. For
40294 <literallayout class="monospaced">
40295 allow_commands = /usr/bin/vacation
40298 and <option>restrict_to_path</option> is not set, the only permitted command is
40299 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
40300 <option>use_shell</option> is set.
40303 <indexterm role="option">
40304 <primary><option>batch_id</option></primary>
40307 <informaltable frame="all">
40308 <tgroup cols="4" colsep="0" rowsep="0">
40309 <colspec colwidth="8*" align="left"/>
40310 <colspec colwidth="6*" align="center"/>
40311 <colspec colwidth="6*" align="center"/>
40312 <colspec colwidth="6*" align="right"/>
40315 <entry><option>batch_id</option></entry>
40316 <entry>Use: <emphasis>pipe</emphasis></entry>
40317 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
40318 <entry>Default: <emphasis>unset</emphasis></entry>
40324 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
40327 <indexterm role="option">
40328 <primary><option>batch_max</option></primary>
40331 <informaltable frame="all">
40332 <tgroup cols="4" colsep="0" rowsep="0">
40333 <colspec colwidth="8*" align="left"/>
40334 <colspec colwidth="6*" align="center"/>
40335 <colspec colwidth="6*" align="center"/>
40336 <colspec colwidth="6*" align="right"/>
40339 <entry><option>batch_max</option></entry>
40340 <entry>Use: <emphasis>pipe</emphasis></entry>
40341 <entry>Type: <emphasis>integer</emphasis></entry>
40342 <entry>Default: <emphasis>1</emphasis></entry>
40348 This limits the number of addresses that can be handled in a single delivery.
40349 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
40352 <indexterm role="option">
40353 <primary><option>check_string</option></primary>
40356 <informaltable frame="all">
40357 <tgroup cols="4" colsep="0" rowsep="0">
40358 <colspec colwidth="8*" align="left"/>
40359 <colspec colwidth="6*" align="center"/>
40360 <colspec colwidth="6*" align="center"/>
40361 <colspec colwidth="6*" align="right"/>
40364 <entry><option>check_string</option></entry>
40365 <entry>Use: <emphasis>pipe</emphasis></entry>
40366 <entry>Type: <emphasis>string</emphasis></entry>
40367 <entry>Default: <emphasis>unset</emphasis></entry>
40373 As <command>pipe</command> writes the message, the start of each line is tested for matching
40374 <option>check_string</option>, and if it does, the initial matching characters are replaced
40375 by the contents of <option>escape_string</option>, provided both are set. The value of
40376 <option>check_string</option> is a literal string, not a regular expression, and the case of
40377 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
40378 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
40379 the SMTP escaping protocol. Any settings made in the configuration file are
40383 <indexterm role="option">
40384 <primary><option>command</option></primary>
40387 <informaltable frame="all">
40388 <tgroup cols="4" colsep="0" rowsep="0">
40389 <colspec colwidth="8*" align="left"/>
40390 <colspec colwidth="6*" align="center"/>
40391 <colspec colwidth="6*" align="center"/>
40392 <colspec colwidth="6*" align="right"/>
40395 <entry><option>command</option></entry>
40396 <entry>Use: <emphasis>pipe</emphasis></entry>
40397 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
40398 <entry>Default: <emphasis>unset</emphasis></entry>
40404 This option need not be set when <command>pipe</command> is being used to deliver to pipes
40405 obtained directly from address redirections. In other cases, the option must be
40406 set, to provide a command to be run. It need not yield an absolute path (see
40407 the <option>path</option> option below). The command is split up into separate arguments by
40408 Exim, and each argument is separately expanded, as described in section
40409 <xref linkend="SECThowcommandrun"/> above.
40412 <indexterm role="option">
40413 <primary><option>environment</option></primary>
40416 <informaltable frame="all">
40417 <tgroup cols="4" colsep="0" rowsep="0">
40418 <colspec colwidth="8*" align="left"/>
40419 <colspec colwidth="6*" align="center"/>
40420 <colspec colwidth="6*" align="center"/>
40421 <colspec colwidth="6*" align="right"/>
40424 <entry><option>environment</option></entry>
40425 <entry>Use: <emphasis>pipe</emphasis></entry>
40426 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
40427 <entry>Default: <emphasis>unset</emphasis></entry>
40433 <indexterm role="concept">
40434 <primary><command>pipe</command> transport</primary>
40435 <secondary>environment for command</secondary>
40437 <indexterm role="concept">
40438 <primary>environment for <command>pipe</command> transport</primary>
40440 This option is used to add additional variables to the environment in which the
40441 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
40442 a string which is expanded, and then interpreted as a colon-separated list of
40443 environment settings of the form <<emphasis>name</emphasis>>=<<emphasis>value</emphasis>>.
40446 <indexterm role="option">
40447 <primary><option>escape_string</option></primary>
40450 <informaltable frame="all">
40451 <tgroup cols="4" colsep="0" rowsep="0">
40452 <colspec colwidth="8*" align="left"/>
40453 <colspec colwidth="6*" align="center"/>
40454 <colspec colwidth="6*" align="center"/>
40455 <colspec colwidth="6*" align="right"/>
40458 <entry><option>escape_string</option></entry>
40459 <entry>Use: <emphasis>pipe</emphasis></entry>
40460 <entry>Type: <emphasis>string</emphasis></entry>
40461 <entry>Default: <emphasis>unset</emphasis></entry>
40467 See <option>check_string</option> above.
40470 <indexterm role="option">
40471 <primary><option>freeze_exec_fail</option></primary>
40474 <informaltable frame="all">
40475 <tgroup cols="4" colsep="0" rowsep="0">
40476 <colspec colwidth="8*" align="left"/>
40477 <colspec colwidth="6*" align="center"/>
40478 <colspec colwidth="6*" align="center"/>
40479 <colspec colwidth="6*" align="right"/>
40482 <entry><option>freeze_exec_fail</option></entry>
40483 <entry>Use: <emphasis>pipe</emphasis></entry>
40484 <entry>Type: <emphasis>boolean</emphasis></entry>
40485 <entry>Default: <emphasis>false</emphasis></entry>
40491 <indexterm role="concept">
40492 <primary>exec failure</primary>
40494 <indexterm role="concept">
40495 <primary>failure of exec</primary>
40497 <indexterm role="concept">
40498 <primary><command>pipe</command> transport</primary>
40499 <secondary>failure of exec</secondary>
40501 Failure to exec the command in a pipe transport is by default treated like
40502 any other failure while running the command. However, if <option>freeze_exec_fail</option>
40503 is set, failure to exec is treated specially, and causes the message to be
40504 frozen, whatever the setting of <option>ignore_status</option>.
40507 <indexterm role="option">
40508 <primary><option>ignore_status</option></primary>
40511 <informaltable frame="all">
40512 <tgroup cols="4" colsep="0" rowsep="0">
40513 <colspec colwidth="8*" align="left"/>
40514 <colspec colwidth="6*" align="center"/>
40515 <colspec colwidth="6*" align="center"/>
40516 <colspec colwidth="6*" align="right"/>
40519 <entry><option>ignore_status</option></entry>
40520 <entry>Use: <emphasis>pipe</emphasis></entry>
40521 <entry>Type: <emphasis>boolean</emphasis></entry>
40522 <entry>Default: <emphasis>false</emphasis></entry>
40528 If this option is true, the status returned by the subprocess that is set up to
40529 run the command is ignored, and Exim behaves as if zero had been returned.
40530 Otherwise, a non-zero status or termination by signal causes an error return
40531 from the transport unless the status value is one of those listed in
40532 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
40535 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
40536 See the <option>timeout_defer</option> option for how timeouts are handled.
40539 <indexterm role="option">
40540 <primary><option>log_defer_output</option></primary>
40543 <informaltable frame="all">
40544 <tgroup cols="4" colsep="0" rowsep="0">
40545 <colspec colwidth="8*" align="left"/>
40546 <colspec colwidth="6*" align="center"/>
40547 <colspec colwidth="6*" align="center"/>
40548 <colspec colwidth="6*" align="right"/>
40551 <entry><option>log_defer_output</option></entry>
40552 <entry>Use: <emphasis>pipe</emphasis></entry>
40553 <entry>Type: <emphasis>boolean</emphasis></entry>
40554 <entry>Default: <emphasis>false</emphasis></entry>
40560 <indexterm role="concept">
40561 <primary><command>pipe</command> transport</primary>
40562 <secondary>logging output</secondary>
40564 If this option is set, and the status returned by the command is
40565 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
40566 and any output was produced, the first line of it is written to the main log.
40569 <indexterm role="option">
40570 <primary><option>log_fail_output</option></primary>
40573 <informaltable frame="all">
40574 <tgroup cols="4" colsep="0" rowsep="0">
40575 <colspec colwidth="8*" align="left"/>
40576 <colspec colwidth="6*" align="center"/>
40577 <colspec colwidth="6*" align="center"/>
40578 <colspec colwidth="6*" align="right"/>
40581 <entry><option>log_fail_output</option></entry>
40582 <entry>Use: <emphasis>pipe</emphasis></entry>
40583 <entry>Type: <emphasis>boolean</emphasis></entry>
40584 <entry>Default: <emphasis>false</emphasis></entry>
40590 If this option is set, and the command returns any output, and also ends with a
40591 return code that is neither zero nor one of the return codes listed in
40592 <option>temp_errors</option> (that is, the delivery failed), the first line of output is
40593 written to the main log. This option and <option>log_output</option> are mutually exclusive.
40594 Only one of them may be set.
40597 <indexterm role="option">
40598 <primary><option>log_output</option></primary>
40601 <informaltable frame="all">
40602 <tgroup cols="4" colsep="0" rowsep="0">
40603 <colspec colwidth="8*" align="left"/>
40604 <colspec colwidth="6*" align="center"/>
40605 <colspec colwidth="6*" align="center"/>
40606 <colspec colwidth="6*" align="right"/>
40609 <entry><option>log_output</option></entry>
40610 <entry>Use: <emphasis>pipe</emphasis></entry>
40611 <entry>Type: <emphasis>boolean</emphasis></entry>
40612 <entry>Default: <emphasis>false</emphasis></entry>
40618 If this option is set and the command returns any output, the first line of
40619 output is written to the main log, whatever the return code. This option and
40620 <option>log_fail_output</option> are mutually exclusive. Only one of them may be set.
40623 <indexterm role="option">
40624 <primary><option>max_output</option></primary>
40627 <informaltable frame="all">
40628 <tgroup cols="4" colsep="0" rowsep="0">
40629 <colspec colwidth="8*" align="left"/>
40630 <colspec colwidth="6*" align="center"/>
40631 <colspec colwidth="6*" align="center"/>
40632 <colspec colwidth="6*" align="right"/>
40635 <entry><option>max_output</option></entry>
40636 <entry>Use: <emphasis>pipe</emphasis></entry>
40637 <entry>Type: <emphasis>integer</emphasis></entry>
40638 <entry>Default: <emphasis>20K</emphasis></entry>
40644 This specifies the maximum amount of output that the command may produce on its
40645 standard output and standard error file combined. If the limit is exceeded, the
40646 process running the command is killed. This is intended as a safety measure to
40647 catch runaway processes. The limit is applied independently of the settings of
40648 the options that control what is done with such output (for example,
40649 <option>return_output</option>). Because of buffering effects, the amount of output may
40650 exceed the limit by a small amount before Exim notices.
40653 <indexterm role="option">
40654 <primary><option>message_prefix</option></primary>
40657 <informaltable frame="all">
40658 <tgroup cols="4" colsep="0" rowsep="0">
40659 <colspec colwidth="8*" align="left"/>
40660 <colspec colwidth="6*" align="center"/>
40661 <colspec colwidth="6*" align="center"/>
40662 <colspec colwidth="6*" align="right"/>
40665 <entry><option>message_prefix</option></entry>
40666 <entry>Use: <emphasis>pipe</emphasis></entry>
40667 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
40668 <entry>Default: <emphasis>see below</emphasis></entry>
40674 The string specified here is expanded and output at the start of every message.
40675 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
40677 <literallayout class="monospaced">
40679 From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
40683 <indexterm role="concept">
40684 <primary>Cyrus</primary>
40686 <indexterm role="concept">
40687 <primary><option>tmail</option></primary>
40689 <indexterm role="concept">
40690 <primary><quote>From</quote> line</primary>
40692 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
40693 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
40694 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
40697 <literallayout class="monospaced">
40701 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
40702 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
40705 <indexterm role="option">
40706 <primary><option>message_suffix</option></primary>
40709 <informaltable frame="all">
40710 <tgroup cols="4" colsep="0" rowsep="0">
40711 <colspec colwidth="8*" align="left"/>
40712 <colspec colwidth="6*" align="center"/>
40713 <colspec colwidth="6*" align="center"/>
40714 <colspec colwidth="6*" align="right"/>
40717 <entry><option>message_suffix</option></entry>
40718 <entry>Use: <emphasis>pipe</emphasis></entry>
40719 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
40720 <entry>Default: <emphasis>see below</emphasis></entry>
40726 The string specified here is expanded and output at the end of every message.
40727 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
40728 The suffix can be suppressed by setting
40730 <literallayout class="monospaced">
40734 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
40735 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
40738 <indexterm role="option">
40739 <primary><option>path</option></primary>
40742 <informaltable frame="all">
40743 <tgroup cols="4" colsep="0" rowsep="0">
40744 <colspec colwidth="8*" align="left"/>
40745 <colspec colwidth="6*" align="center"/>
40746 <colspec colwidth="6*" align="center"/>
40747 <colspec colwidth="6*" align="right"/>
40750 <entry><option>path</option></entry>
40751 <entry>Use: <emphasis>pipe</emphasis></entry>
40752 <entry>Type: <emphasis>string</emphasis></entry>
40753 <entry>Default: <emphasis>see below</emphasis></entry>
40759 This option specifies the string that is set up in the PATH environment
40760 variable of the subprocess. The default is:
40762 <literallayout class="monospaced">
40766 If the <option>command</option> option does not yield an absolute path name, the command is
40767 sought in the PATH directories, in the usual way. <emphasis role="bold">Warning</emphasis>: This does not
40768 apply to a command specified as a transport filter.
40771 <indexterm role="option">
40772 <primary><option>pipe_as_creator</option></primary>
40775 <informaltable frame="all">
40776 <tgroup cols="4" colsep="0" rowsep="0">
40777 <colspec colwidth="8*" align="left"/>
40778 <colspec colwidth="6*" align="center"/>
40779 <colspec colwidth="6*" align="center"/>
40780 <colspec colwidth="6*" align="right"/>
40783 <entry><option>pipe_as_creator</option></entry>
40784 <entry>Use: <emphasis>pipe</emphasis></entry>
40785 <entry>Type: <emphasis>boolean</emphasis></entry>
40786 <entry>Default: <emphasis>false</emphasis></entry>
40792 <indexterm role="concept">
40793 <primary>uid (user id)</primary>
40794 <secondary>local delivery</secondary>
40796 If the generic <option>user</option> option is not set and this option is true, the delivery
40797 process is run under the uid that was in force when Exim was originally called
40798 to accept the message. If the group id is not otherwise set (via the generic
40799 <option>group</option> option), the gid that was in force when Exim was originally called to
40800 accept the message is used.
40803 <indexterm role="option">
40804 <primary><option>restrict_to_path</option></primary>
40807 <informaltable frame="all">
40808 <tgroup cols="4" colsep="0" rowsep="0">
40809 <colspec colwidth="8*" align="left"/>
40810 <colspec colwidth="6*" align="center"/>
40811 <colspec colwidth="6*" align="center"/>
40812 <colspec colwidth="6*" align="right"/>
40815 <entry><option>restrict_to_path</option></entry>
40816 <entry>Use: <emphasis>pipe</emphasis></entry>
40817 <entry>Type: <emphasis>boolean</emphasis></entry>
40818 <entry>Default: <emphasis>false</emphasis></entry>
40824 When this option is set, any command name not listed in <option>allow_commands</option> must
40825 contain no slashes. The command is searched for only in the directories listed
40826 in the <option>path</option> option. This option is intended for use in the case when a pipe
40827 command has been generated from a user’s <filename>.forward</filename> file. This is usually
40828 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
40831 <indexterm role="option">
40832 <primary><option>return_fail_output</option></primary>
40835 <informaltable frame="all">
40836 <tgroup cols="4" colsep="0" rowsep="0">
40837 <colspec colwidth="8*" align="left"/>
40838 <colspec colwidth="6*" align="center"/>
40839 <colspec colwidth="6*" align="center"/>
40840 <colspec colwidth="6*" align="right"/>
40843 <entry><option>return_fail_output</option></entry>
40844 <entry>Use: <emphasis>pipe</emphasis></entry>
40845 <entry>Type: <emphasis>boolean</emphasis></entry>
40846 <entry>Default: <emphasis>false</emphasis></entry>
40852 If this option is true, and the command produced any output and ended with a
40853 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
40854 is, the delivery failed), the output is returned in the bounce message.
40855 However, if the message has a null sender (that is, it is itself a bounce
40856 message), output from the command is discarded. This option and
40857 <option>return_output</option> are mutually exclusive. Only one of them may be set.
40860 <indexterm role="option">
40861 <primary><option>return_output</option></primary>
40864 <informaltable frame="all">
40865 <tgroup cols="4" colsep="0" rowsep="0">
40866 <colspec colwidth="8*" align="left"/>
40867 <colspec colwidth="6*" align="center"/>
40868 <colspec colwidth="6*" align="center"/>
40869 <colspec colwidth="6*" align="right"/>
40872 <entry><option>return_output</option></entry>
40873 <entry>Use: <emphasis>pipe</emphasis></entry>
40874 <entry>Type: <emphasis>boolean</emphasis></entry>
40875 <entry>Default: <emphasis>false</emphasis></entry>
40881 If this option is true, and the command produced any output, the delivery is
40882 deemed to have failed whatever the return code from the command, and the output
40883 is returned in the bounce message. Otherwise, the output is just discarded.
40884 However, if the message has a null sender (that is, it is a bounce message),
40885 output from the command is always discarded, whatever the setting of this
40886 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
40887 of them may be set.
40890 <indexterm role="option">
40891 <primary><option>temp_errors</option></primary>
40894 <informaltable frame="all">
40895 <tgroup cols="4" colsep="0" rowsep="0">
40896 <colspec colwidth="8*" align="left"/>
40897 <colspec colwidth="6*" align="center"/>
40898 <colspec colwidth="6*" align="center"/>
40899 <colspec colwidth="6*" align="right"/>
40902 <entry><option>temp_errors</option></entry>
40903 <entry>Use: <emphasis>pipe</emphasis></entry>
40904 <entry>Type: <emphasis>string list</emphasis></entry>
40905 <entry>Default: <emphasis>see below</emphasis></entry>
40911 <indexterm role="concept">
40912 <primary><command>pipe</command> transport</primary>
40913 <secondary>temporary failure</secondary>
40915 This option contains either a colon-separated list of numbers, or a single
40916 asterisk. If <option>ignore_status</option> is false
40917 and <option>return_output</option> is not set,
40918 and the command exits with a non-zero return code, the failure is treated as
40919 temporary and the delivery is deferred if the return code matches one of the
40920 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
40921 codes are treated as permanent errors. The default setting contains the codes
40922 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
40923 compiled on a system that does not define these macros, it assumes values of 75
40924 and 73, respectively.
40927 <indexterm role="option">
40928 <primary><option>timeout</option></primary>
40931 <informaltable frame="all">
40932 <tgroup cols="4" colsep="0" rowsep="0">
40933 <colspec colwidth="8*" align="left"/>
40934 <colspec colwidth="6*" align="center"/>
40935 <colspec colwidth="6*" align="center"/>
40936 <colspec colwidth="6*" align="right"/>
40939 <entry><option>timeout</option></entry>
40940 <entry>Use: <emphasis>pipe</emphasis></entry>
40941 <entry>Type: <emphasis>time</emphasis></entry>
40942 <entry>Default: <emphasis>1h</emphasis></entry>
40948 If the command fails to complete within this time, it is killed. This normally
40949 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
40950 specifies no timeout. In order to ensure that any subprocesses created by the
40951 command are also killed, Exim makes the initial process a process group leader,
40952 and kills the whole process group on a timeout. However, this can be defeated
40953 if one of the processes starts a new process group.
40956 <indexterm role="option">
40957 <primary><option>timeout_defer</option></primary>
40960 <informaltable frame="all">
40961 <tgroup cols="4" colsep="0" rowsep="0">
40962 <colspec colwidth="8*" align="left"/>
40963 <colspec colwidth="6*" align="center"/>
40964 <colspec colwidth="6*" align="center"/>
40965 <colspec colwidth="6*" align="right"/>
40968 <entry><option>timeout_defer</option></entry>
40969 <entry>Use: <emphasis>pipe</emphasis></entry>
40970 <entry>Type: <emphasis>boolean</emphasis></entry>
40971 <entry>Default: <emphasis>false</emphasis></entry>
40977 A timeout in a <command>pipe</command> transport, either in the command that the transport
40978 runs, or in a transport filter that is associated with it, is by default
40979 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
40980 is set true, both kinds of timeout become temporary errors, causing the
40981 delivery to be deferred.
40984 <indexterm role="option">
40985 <primary><option>umask</option></primary>
40988 <informaltable frame="all">
40989 <tgroup cols="4" colsep="0" rowsep="0">
40990 <colspec colwidth="8*" align="left"/>
40991 <colspec colwidth="6*" align="center"/>
40992 <colspec colwidth="6*" align="center"/>
40993 <colspec colwidth="6*" align="right"/>
40996 <entry><option>umask</option></entry>
40997 <entry>Use: <emphasis>pipe</emphasis></entry>
40998 <entry>Type: <emphasis>octal integer</emphasis></entry>
40999 <entry>Default: <emphasis>022</emphasis></entry>
41005 This specifies the umask setting for the subprocess that runs the command.
41008 <indexterm role="option">
41009 <primary><option>use_bsmtp</option></primary>
41012 <informaltable frame="all">
41013 <tgroup cols="4" colsep="0" rowsep="0">
41014 <colspec colwidth="8*" align="left"/>
41015 <colspec colwidth="6*" align="center"/>
41016 <colspec colwidth="6*" align="center"/>
41017 <colspec colwidth="6*" align="right"/>
41020 <entry><option>use_bsmtp</option></entry>
41021 <entry>Use: <emphasis>pipe</emphasis></entry>
41022 <entry>Type: <emphasis>boolean</emphasis></entry>
41023 <entry>Default: <emphasis>false</emphasis></entry>
41029 <indexterm role="concept">
41030 <primary>envelope sender</primary>
41032 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
41033 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
41034 commands. If you want to include a leading HELO command with such messages,
41035 you can do so by setting the <option>message_prefix</option> option. See section
41036 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
41039 <indexterm role="option">
41040 <primary><option>use_classresources</option></primary>
41043 <informaltable frame="all">
41044 <tgroup cols="4" colsep="0" rowsep="0">
41045 <colspec colwidth="8*" align="left"/>
41046 <colspec colwidth="6*" align="center"/>
41047 <colspec colwidth="6*" align="center"/>
41048 <colspec colwidth="6*" align="right"/>
41051 <entry><option>use_classresources</option></entry>
41052 <entry>Use: <emphasis>pipe</emphasis></entry>
41053 <entry>Type: <emphasis>boolean</emphasis></entry>
41054 <entry>Default: <emphasis>false</emphasis></entry>
41060 <indexterm role="concept">
41061 <primary>class resources (BSD)</primary>
41063 This option is available only when Exim is running on FreeBSD, NetBSD, or
41064 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
41065 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
41066 limits for the uid under which the pipe is to run are obtained from the login
41070 <indexterm role="option">
41071 <primary><option>use_crlf</option></primary>
41074 <informaltable frame="all">
41075 <tgroup cols="4" colsep="0" rowsep="0">
41076 <colspec colwidth="8*" align="left"/>
41077 <colspec colwidth="6*" align="center"/>
41078 <colspec colwidth="6*" align="center"/>
41079 <colspec colwidth="6*" align="right"/>
41082 <entry><option>use_crlf</option></entry>
41083 <entry>Use: <emphasis>pipe</emphasis></entry>
41084 <entry>Type: <emphasis>boolean</emphasis></entry>
41085 <entry>Default: <emphasis>false</emphasis></entry>
41091 <indexterm role="concept">
41092 <primary>carriage return</primary>
41094 <indexterm role="concept">
41095 <primary>linefeed</primary>
41097 This option causes lines to be terminated with the two-character CRLF sequence
41098 (carriage return, linefeed) instead of just a linefeed character. In the case
41099 of batched SMTP, the byte sequence written to the pipe is then an exact image
41100 of what would be sent down a real SMTP connection.
41103 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
41104 written verbatim, so must contain their own carriage return characters if these
41105 are needed. When <option>use_bsmtp</option> is not set, the default values for both
41106 <option>message_prefix</option> and <option>message_suffix</option> end with a single linefeed, so their
41107 values must be changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
41110 <indexterm role="option">
41111 <primary><option>use_shell</option></primary>
41114 <informaltable frame="all">
41115 <tgroup cols="4" colsep="0" rowsep="0">
41116 <colspec colwidth="8*" align="left"/>
41117 <colspec colwidth="6*" align="center"/>
41118 <colspec colwidth="6*" align="center"/>
41119 <colspec colwidth="6*" align="right"/>
41122 <entry><option>use_shell</option></entry>
41123 <entry>Use: <emphasis>pipe</emphasis></entry>
41124 <entry>Type: <emphasis>boolean</emphasis></entry>
41125 <entry>Default: <emphasis>false</emphasis></entry>
41131 <indexterm role="variable">
41132 <primary><varname>$pipe_addresses</varname></primary>
41134 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
41135 instead of being run directly from the transport, as described in section
41136 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
41137 where the command is expected to be run under a shell and cannot easily be
41138 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
41139 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
41140 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
41141 its <option>-c</option> option.
41144 <section id="SECID143">
41145 <title>Using an external local delivery agent</title>
41147 <indexterm role="concept">
41148 <primary>local delivery</primary>
41149 <secondary>using an external agent</secondary>
41151 <indexterm role="concept">
41152 <primary><emphasis>procmail</emphasis></primary>
41154 <indexterm role="concept">
41155 <primary>external local delivery</primary>
41157 <indexterm role="concept">
41158 <primary>delivery</primary>
41159 <secondary><emphasis>procmail</emphasis></secondary>
41161 <indexterm role="concept">
41162 <primary>delivery</primary>
41163 <secondary>by external agent</secondary>
41165 The <command>pipe</command> transport can be used to pass all messages that require local
41166 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
41167 this, care must be taken to ensure that the pipe is run under an appropriate
41168 uid and gid. In some configurations one wants this to be a uid that is trusted
41169 by the delivery agent to supply the correct sender of the message. It may be
41170 necessary to recompile or reconfigure the delivery agent so that it trusts an
41171 appropriate user. The following is an example transport and router
41172 configuration for <option>procmail</option>:
41174 <literallayout class="monospaced">
41178 command = /usr/local/bin/procmail -d $local_part
41182 check_string = "From "
41183 escape_string = ">From "
41191 transport = procmail_pipe
41194 In this example, the pipe is run as the local user, but with the group set to
41195 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
41196 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
41197 user to supply a correct sender address. If you do not specify either a
41198 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
41199 home directory is the user’s home directory by default.
41202 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
41204 <literallayout class="monospaced">
41208 as shown in some <option>procmail</option> documentation, because Exim does not by default
41209 use a shell to run pipe commands.
41212 <indexterm role="concept">
41213 <primary>Cyrus</primary>
41215 The next example shows a transport and a router for a system where local
41216 deliveries are handled by the Cyrus IMAP server.
41218 <literallayout class="monospaced">
41220 local_delivery_cyrus:
41222 command = /usr/cyrus/bin/deliver \
41223 -m ${substr_1:$local_part_suffix} -- $local_part
41235 local_part_suffix = .*
41236 transport = local_delivery_cyrus
41239 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
41240 <option>return_output</option> to cause any text written by Cyrus to be returned to the
41242 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
41243 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
41248 <chapter id="CHAPsmtptrans">
41249 <title>The smtp transport</title>
41251 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
41252 <primary>transports</primary>
41253 <secondary><command>smtp</command></secondary>
41255 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
41256 <primary><command>smtp</command> transport</primary>
41258 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
41259 or LMTP protocol. The list of hosts to try can either be taken from the address
41260 that is being processed (having been set up by the router), or specified
41261 explicitly for the transport. Timeout and retry processing (see chapter
41262 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
41264 <section id="SECID144">
41265 <title>Multiple messages on a single connection</title>
41267 The sending of multiple messages over a single TCP/IP connection can arise in
41273 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
41274 routed to the same host, more than one copy of the message has to be sent to
41275 that host. In this situation, multiple copies may be sent in a single run of
41276 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
41277 does when it has too many addresses to send in one message also depends on the
41278 value of the global <option>remote_max_parallel</option> option. Details are given in
41279 section <xref linkend="SECToutSMTPTCP"/>.)
41284 <indexterm role="concept">
41285 <primary>hints database</primary>
41286 <secondary>remembering routing</secondary>
41288 When a message has been successfully delivered over a TCP/IP connection, Exim
41289 looks in its hints database to see if there are any other messages awaiting a
41290 connection to the same host. If there are, a new delivery process is started
41291 for one of them, and the current TCP/IP connection is passed on to it. The new
41292 process may in turn send multiple copies and possibly create yet another
41298 For each copy sent over the same TCP/IP connection, a sequence counter is
41299 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
41300 no further messages are sent over that connection.
41303 <section id="SECID145">
41304 <title>Use of the $host and $host_address variables</title>
41306 <indexterm role="variable">
41307 <primary><varname>$host</varname></primary>
41309 <indexterm role="variable">
41310 <primary><varname>$host_address</varname></primary>
41312 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
41313 <varname>$host_address</varname> are the name and IP address of the first host on the host list
41314 passed by the router. However, when the transport is about to connect to a
41315 specific host, and while it is connected to that host, <varname>$host</varname> and
41316 <varname>$host_address</varname> are set to the values for that host. These are the values
41317 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
41318 <option>serialize_hosts</option>, and the various TLS options are expanded.
41321 <section id="usecippeer">
41322 <title>Use of $tls_cipher and $tls_peerdn</title>
41324 <indexterm role="variable">
41325 <primary><varname>$tls_cipher</varname></primary>
41327 <indexterm role="variable">
41328 <primary><varname>$tls_peerdn</varname></primary>
41330 At the start of a run of the <command>smtp</command> transport, the values of <varname>$tls_cipher</varname>
41331 and <varname>$tls_peerdn</varname> are the values that were set when the message was received.
41332 These are the values that are used for options that are expanded before any
41333 SMTP connections are made. Just before each connection is made, these two
41334 variables are emptied. If TLS is subsequently started, they are set to the
41335 appropriate values for the outgoing connection, and these are the values that
41336 are in force when any authenticators are run and when the
41337 <option>authenticated_sender</option> option is expanded.
41340 <section id="SECID146">
41341 <title>Private options for smtp</title>
41343 <indexterm role="concept">
41344 <primary>options</primary>
41345 <secondary><command>smtp</command> transport</secondary>
41347 The private options of the <command>smtp</command> transport are as follows:
41350 <indexterm role="option">
41351 <primary><option>address_retry_include_sender</option></primary>
41354 <informaltable frame="all">
41355 <tgroup cols="4" colsep="0" rowsep="0">
41356 <colspec colwidth="8*" align="left"/>
41357 <colspec colwidth="6*" align="center"/>
41358 <colspec colwidth="6*" align="center"/>
41359 <colspec colwidth="6*" align="right"/>
41362 <entry><option>address_retry_include_sender</option></entry>
41363 <entry>Use: <emphasis>smtp</emphasis></entry>
41364 <entry>Type: <emphasis>boolean</emphasis></entry>
41365 <entry>Default: <emphasis>true</emphasis></entry>
41371 <indexterm role="concept">
41372 <primary>4<emphasis>xx</emphasis> responses</primary>
41373 <secondary>retrying after</secondary>
41375 When an address is delayed because of a 4<emphasis>xx</emphasis> response to a RCPT command, it
41376 is the combination of sender and recipient that is delayed in subsequent queue
41377 runs until the retry time is reached. You can delay the recipient without
41378 reference to the sender (which is what earlier versions of Exim did), by
41379 setting <option>address_retry_include_sender</option> false. However, this can lead to
41380 problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT commands.
41383 <indexterm role="option">
41384 <primary><option>allow_localhost</option></primary>
41387 <informaltable frame="all">
41388 <tgroup cols="4" colsep="0" rowsep="0">
41389 <colspec colwidth="8*" align="left"/>
41390 <colspec colwidth="6*" align="center"/>
41391 <colspec colwidth="6*" align="center"/>
41392 <colspec colwidth="6*" align="right"/>
41395 <entry><option>allow_localhost</option></entry>
41396 <entry>Use: <emphasis>smtp</emphasis></entry>
41397 <entry>Type: <emphasis>boolean</emphasis></entry>
41398 <entry>Default: <emphasis>false</emphasis></entry>
41404 <indexterm role="concept">
41405 <primary>local host</primary>
41406 <secondary>sending to</secondary>
41408 <indexterm role="concept">
41409 <primary>fallback</primary>
41410 <secondary>hosts specified on transport</secondary>
41412 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
41413 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
41414 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
41415 the delivery anyway. This should be used only in special cases when the
41416 configuration ensures that no looping will result (for example, a differently
41417 configured Exim is listening on the port to which the message is sent).
41420 <indexterm role="option">
41421 <primary><option>authenticated_sender</option></primary>
41424 <informaltable frame="all">
41425 <tgroup cols="4" colsep="0" rowsep="0">
41426 <colspec colwidth="8*" align="left"/>
41427 <colspec colwidth="6*" align="center"/>
41428 <colspec colwidth="6*" align="center"/>
41429 <colspec colwidth="6*" align="right"/>
41432 <entry><option>authenticated_sender</option></entry>
41433 <entry>Use: <emphasis>smtp</emphasis></entry>
41434 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
41435 <entry>Default: <emphasis>unset</emphasis></entry>
41441 <indexterm role="concept">
41442 <primary>Cyrus</primary>
41444 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
41445 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
41446 overriding any existing authenticated sender value. If the string expansion is
41447 forced to fail, the option is ignored. Other expansion failures cause delivery
41448 to be deferred. If the result of expansion is an empty string, that is also
41452 The expansion happens after the outgoing connection has been made and TLS
41453 started, if required. This means that the <varname>$host</varname>, <varname>$host_address</varname>,
41454 <varname>$tls_cipher</varname>, and <varname>$tls_peerdn</varname> variables are set according to the
41455 particular connection.
41458 If the SMTP session is not authenticated, the expansion of
41459 <option>authenticated_sender</option> still happens (and can cause the delivery to be
41460 deferred if it fails), but no AUTH= item is added to MAIL commands
41461 unless <option>authenticated_sender_force</option> is true.
41464 This option allows you to use the <command>smtp</command> transport in LMTP mode to
41465 deliver mail to Cyrus IMAP and provide the proper local part as the
41466 <quote>authenticated sender</quote>, via a setting such as:
41468 <literallayout class="monospaced">
41469 authenticated_sender = $local_part
41472 This removes the need for IMAP subfolders to be assigned special ACLs to
41473 allow direct delivery to those subfolders.
41476 Because of expected uses such as that just described for Cyrus (when no
41477 domain is involved), there is no checking on the syntax of the provided
41481 <indexterm role="option">
41482 <primary><option>authenticated_sender_force</option></primary>
41485 <informaltable frame="all">
41486 <tgroup cols="4" colsep="0" rowsep="0">
41487 <colspec colwidth="8*" align="left"/>
41488 <colspec colwidth="6*" align="center"/>
41489 <colspec colwidth="6*" align="center"/>
41490 <colspec colwidth="6*" align="right"/>
41493 <entry><option>authenticated_sender_force</option></entry>
41494 <entry>Use: <emphasis>smtp</emphasis></entry>
41495 <entry>Type: <emphasis>boolean</emphasis></entry>
41496 <entry>Default: <emphasis>false</emphasis></entry>
41502 If this option is set true, the <option>authenticated_sender</option> option’s value
41503 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
41504 authenticated as a client.
41507 <indexterm role="option">
41508 <primary><option>command_timeout</option></primary>
41511 <informaltable frame="all">
41512 <tgroup cols="4" colsep="0" rowsep="0">
41513 <colspec colwidth="8*" align="left"/>
41514 <colspec colwidth="6*" align="center"/>
41515 <colspec colwidth="6*" align="center"/>
41516 <colspec colwidth="6*" align="right"/>
41519 <entry><option>command_timeout</option></entry>
41520 <entry>Use: <emphasis>smtp</emphasis></entry>
41521 <entry>Type: <emphasis>time</emphasis></entry>
41522 <entry>Default: <emphasis>5m</emphasis></entry>
41528 This sets a timeout for receiving a response to an SMTP command that has been
41529 sent out. It is also used when waiting for the initial banner line from the
41530 remote host. Its value must not be zero.
41533 <indexterm role="option">
41534 <primary><option>connect_timeout</option></primary>
41537 <informaltable frame="all">
41538 <tgroup cols="4" colsep="0" rowsep="0">
41539 <colspec colwidth="8*" align="left"/>
41540 <colspec colwidth="6*" align="center"/>
41541 <colspec colwidth="6*" align="center"/>
41542 <colspec colwidth="6*" align="right"/>
41545 <entry><option>connect_timeout</option></entry>
41546 <entry>Use: <emphasis>smtp</emphasis></entry>
41547 <entry>Type: <emphasis>time</emphasis></entry>
41548 <entry>Default: <emphasis>5m</emphasis></entry>
41554 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
41555 to a remote host. A setting of zero allows the system timeout (typically
41556 several minutes) to act. To have any effect, the value of this option must be
41557 less than the system timeout. However, it has been observed that on some
41558 systems there is no system timeout, which is why the default value for this
41559 option is 5 minutes, a value recommended by RFC 1123.
41562 <indexterm role="option">
41563 <primary><option>connection_max_messages</option></primary>
41566 <informaltable frame="all">
41567 <tgroup cols="4" colsep="0" rowsep="0">
41568 <colspec colwidth="8*" align="left"/>
41569 <colspec colwidth="6*" align="center"/>
41570 <colspec colwidth="6*" align="center"/>
41571 <colspec colwidth="6*" align="right"/>
41574 <entry><option>connection_max_messages</option></entry>
41575 <entry>Use: <emphasis>smtp</emphasis></entry>
41576 <entry>Type: <emphasis>integer</emphasis></entry>
41577 <entry>Default: <emphasis>500</emphasis></entry>
41583 <indexterm role="concept">
41584 <primary>SMTP</primary>
41585 <secondary>passed connection</secondary>
41587 <indexterm role="concept">
41588 <primary>SMTP</primary>
41589 <secondary>multiple deliveries</secondary>
41591 <indexterm role="concept">
41592 <primary>multiple SMTP deliveries</primary>
41594 This controls the maximum number of separate message deliveries that are sent
41595 over a single TCP/IP connection. If the value is zero, there is no limit.
41596 For testing purposes, this value can be overridden by the <option>-oB</option> command line
41600 <indexterm role="option">
41601 <primary><option>data_timeout</option></primary>
41604 <informaltable frame="all">
41605 <tgroup cols="4" colsep="0" rowsep="0">
41606 <colspec colwidth="8*" align="left"/>
41607 <colspec colwidth="6*" align="center"/>
41608 <colspec colwidth="6*" align="center"/>
41609 <colspec colwidth="6*" align="right"/>
41612 <entry><option>data_timeout</option></entry>
41613 <entry>Use: <emphasis>smtp</emphasis></entry>
41614 <entry>Type: <emphasis>time</emphasis></entry>
41615 <entry>Default: <emphasis>5m</emphasis></entry>
41621 This sets a timeout for the transmission of each block in the data portion of
41622 the message. As a result, the overall timeout for a message depends on the size
41623 of the message. Its value must not be zero. See also <option>final_timeout</option>.
41626 <indexterm role="option">
41627 <primary><option>delay_after_cutoff</option></primary>
41630 <informaltable frame="all">
41631 <tgroup cols="4" colsep="0" rowsep="0">
41632 <colspec colwidth="8*" align="left"/>
41633 <colspec colwidth="6*" align="center"/>
41634 <colspec colwidth="6*" align="center"/>
41635 <colspec colwidth="6*" align="right"/>
41638 <entry><option>delay_after_cutoff</option></entry>
41639 <entry>Use: <emphasis>smtp</emphasis></entry>
41640 <entry>Type: <emphasis>boolean</emphasis></entry>
41641 <entry>Default: <emphasis>true</emphasis></entry>
41647 This option controls what happens when all remote IP addresses for a given
41648 domain have been inaccessible for so long that they have passed their retry
41652 In the default state, if the next retry time has not been reached for any of
41653 them, the address is bounced without trying any deliveries. In other words,
41654 Exim delays retrying an IP address after the final cutoff time until a new
41655 retry time is reached, and can therefore bounce an address without ever trying
41656 a delivery, when machines have been down for a long time. Some people are
41657 unhappy at this prospect, so...
41660 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
41661 addresses are past their final cutoff time, Exim tries to deliver to those
41662 IP addresses that have not been tried since the message arrived. If there are
41663 none, of if they all fail, the address is bounced. In other words, it does not
41664 delay when a new message arrives, but immediately tries those expired IP
41665 addresses that haven’t been tried since the message arrived. If there is a
41666 continuous stream of messages for the dead hosts, unsetting
41667 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
41671 <indexterm role="option">
41672 <primary><option>dns_qualify_single</option></primary>
41675 <informaltable frame="all">
41676 <tgroup cols="4" colsep="0" rowsep="0">
41677 <colspec colwidth="8*" align="left"/>
41678 <colspec colwidth="6*" align="center"/>
41679 <colspec colwidth="6*" align="center"/>
41680 <colspec colwidth="6*" align="right"/>
41683 <entry><option>dns_qualify_single</option></entry>
41684 <entry>Use: <emphasis>smtp</emphasis></entry>
41685 <entry>Type: <emphasis>boolean</emphasis></entry>
41686 <entry>Default: <emphasis>true</emphasis></entry>
41692 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
41693 and the <option>gethostbyname</option> option is false,
41694 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
41695 in chapter <xref linkend="CHAPdnslookup"/> for more details.
41698 <indexterm role="option">
41699 <primary><option>dns_search_parents</option></primary>
41702 <informaltable frame="all">
41703 <tgroup cols="4" colsep="0" rowsep="0">
41704 <colspec colwidth="8*" align="left"/>
41705 <colspec colwidth="6*" align="center"/>
41706 <colspec colwidth="6*" align="center"/>
41707 <colspec colwidth="6*" align="right"/>
41710 <entry><option>dns_search_parents</option></entry>
41711 <entry>Use: <emphasis>smtp</emphasis></entry>
41712 <entry>Type: <emphasis>boolean</emphasis></entry>
41713 <entry>Default: <emphasis>false</emphasis></entry>
41719 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
41720 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
41721 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
41725 <indexterm role="option">
41726 <primary><option>fallback_hosts</option></primary>
41729 <informaltable frame="all">
41730 <tgroup cols="4" colsep="0" rowsep="0">
41731 <colspec colwidth="8*" align="left"/>
41732 <colspec colwidth="6*" align="center"/>
41733 <colspec colwidth="6*" align="center"/>
41734 <colspec colwidth="6*" align="right"/>
41737 <entry><option>fallback_hosts</option></entry>
41738 <entry>Use: <emphasis>smtp</emphasis></entry>
41739 <entry>Type: <emphasis>string list</emphasis></entry>
41740 <entry>Default: <emphasis>unset</emphasis></entry>
41746 <indexterm role="concept">
41747 <primary>fallback</primary>
41748 <secondary>hosts specified on transport</secondary>
41750 String expansion is not applied to this option. The argument must be a
41751 colon-separated list of host names or IP addresses, optionally also including
41752 port numbers, though the separator can be changed, as described in section
41753 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
41754 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
41755 in section <xref linkend="SECTformatonehostitem"/>.
41758 Fallback hosts can also be specified on routers, which associate them with the
41759 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
41760 <option>fallback_hosts</option> specified on the transport is used only if the address does
41761 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
41762 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
41763 However, <option>hosts_randomize</option> does apply to fallback host lists.
41766 If Exim is unable to deliver to any of the hosts for a particular address, and
41767 the errors are not permanent rejections, the address is put on a separate
41768 transport queue with its host list replaced by the fallback hosts, unless the
41769 address was routed via MX records and the current host was in the original MX
41770 list. In that situation, the fallback host list is not used.
41773 Once normal deliveries are complete, the fallback queue is delivered by
41774 re-running the same transports with the new host lists. If several failing
41775 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
41776 copy of the message is sent.
41779 The resolution of the host names on the fallback list is controlled by the
41780 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
41781 both to cases when the host list comes with the address and when it is taken
41782 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
41783 fails</quote> facility.
41786 <indexterm role="option">
41787 <primary><option>final_timeout</option></primary>
41790 <informaltable frame="all">
41791 <tgroup cols="4" colsep="0" rowsep="0">
41792 <colspec colwidth="8*" align="left"/>
41793 <colspec colwidth="6*" align="center"/>
41794 <colspec colwidth="6*" align="center"/>
41795 <colspec colwidth="6*" align="right"/>
41798 <entry><option>final_timeout</option></entry>
41799 <entry>Use: <emphasis>smtp</emphasis></entry>
41800 <entry>Type: <emphasis>time</emphasis></entry>
41801 <entry>Default: <emphasis>10m</emphasis></entry>
41807 This is the timeout that applies while waiting for the response to the final
41808 line containing just <quote>.</quote> that terminates a message. Its value must not be
41812 <indexterm role="option">
41813 <primary><option>gethostbyname</option></primary>
41816 <informaltable frame="all">
41817 <tgroup cols="4" colsep="0" rowsep="0">
41818 <colspec colwidth="8*" align="left"/>
41819 <colspec colwidth="6*" align="center"/>
41820 <colspec colwidth="6*" align="center"/>
41821 <colspec colwidth="6*" align="right"/>
41824 <entry><option>gethostbyname</option></entry>
41825 <entry>Use: <emphasis>smtp</emphasis></entry>
41826 <entry>Type: <emphasis>boolean</emphasis></entry>
41827 <entry>Default: <emphasis>false</emphasis></entry>
41833 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
41834 being used, names are looked up using <function>gethostbyname()</function>
41835 (or <function>getipnodebyname()</function> when available)
41836 instead of using the DNS. Of course, that function may in fact use the DNS, but
41837 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
41840 <indexterm role="option">
41841 <primary><option>gnutls_require_kx</option></primary>
41844 <informaltable frame="all">
41845 <tgroup cols="4" colsep="0" rowsep="0">
41846 <colspec colwidth="8*" align="left"/>
41847 <colspec colwidth="6*" align="center"/>
41848 <colspec colwidth="6*" align="center"/>
41849 <colspec colwidth="6*" align="right"/>
41852 <entry><option>gnutls_require_kx</option></entry>
41853 <entry>Use: <emphasis>smtp</emphasis></entry>
41854 <entry>Type: <emphasis>string</emphasis></entry>
41855 <entry>Default: <emphasis>unset</emphasis></entry>
41861 This option controls the key exchange mechanisms when GnuTLS is used in an Exim
41862 client. For details, see section <xref linkend="SECTreqciphgnu"/>.
41865 <indexterm role="option">
41866 <primary><option>gnutls_require_mac</option></primary>
41869 <informaltable frame="all">
41870 <tgroup cols="4" colsep="0" rowsep="0">
41871 <colspec colwidth="8*" align="left"/>
41872 <colspec colwidth="6*" align="center"/>
41873 <colspec colwidth="6*" align="center"/>
41874 <colspec colwidth="6*" align="right"/>
41877 <entry><option>gnutls_require_mac</option></entry>
41878 <entry>Use: <emphasis>smtp</emphasis></entry>
41879 <entry>Type: <emphasis>string</emphasis></entry>
41880 <entry>Default: <emphasis>unset</emphasis></entry>
41886 This option controls the MAC algorithms when GnuTLS is used in an Exim
41887 client. For details, see section <xref linkend="SECTreqciphgnu"/>.
41890 <indexterm role="option">
41891 <primary><option>gnutls_require_protocols</option></primary>
41894 <informaltable frame="all">
41895 <tgroup cols="4" colsep="0" rowsep="0">
41896 <colspec colwidth="8*" align="left"/>
41897 <colspec colwidth="6*" align="center"/>
41898 <colspec colwidth="6*" align="center"/>
41899 <colspec colwidth="6*" align="right"/>
41902 <entry><option>gnutls_require_protocols</option></entry>
41903 <entry>Use: <emphasis>smtp</emphasis></entry>
41904 <entry>Type: <emphasis>string</emphasis></entry>
41905 <entry>Default: <emphasis>unset</emphasis></entry>
41911 This option controls the protocols when GnuTLS is used in an Exim
41912 client. For details, see section <xref linkend="SECTreqciphgnu"/>.
41914 <para revisionflag="changed">
41915 <indexterm role="option">
41916 <primary><option>gnutls_compat_mode</option></primary>
41919 <informaltable frame="all" revisionflag="changed">
41920 <tgroup cols="4" colsep="0" rowsep="0">
41921 <colspec colwidth="8*" align="left"/>
41922 <colspec colwidth="6*" align="center"/>
41923 <colspec colwidth="6*" align="center"/>
41924 <colspec colwidth="6*" align="right"/>
41927 <entry><option>gnutls_compat_mode</option></entry>
41928 <entry>Use: <emphasis>smtp</emphasis></entry>
41929 <entry>Type: <emphasis>boolean</emphasis></entry>
41930 <entry>Default: <emphasis>unset</emphasis></entry>
41935 <para revisionflag="changed">
41936 This option controls whether GnuTLS is used in compatibility mode in an Exim
41937 server. This reduces security slightly, but improves interworking with older
41938 implementations of TLS.
41941 <indexterm role="option">
41942 <primary><option>helo_data</option></primary>
41945 <informaltable frame="all">
41946 <tgroup cols="4" colsep="0" rowsep="0">
41947 <colspec colwidth="8*" align="left"/>
41948 <colspec colwidth="6*" align="center"/>
41949 <colspec colwidth="6*" align="center"/>
41950 <colspec colwidth="6*" align="right"/>
41953 <entry><option>helo_data</option></entry>
41954 <entry>Use: <emphasis>smtp</emphasis></entry>
41955 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
41956 <entry>Default: <emphasis>see below</emphasis></entry>
41962 <indexterm role="concept">
41963 <primary>HELO</primary>
41964 <secondary>argument, setting</secondary>
41966 <indexterm role="concept">
41967 <primary>EHLO</primary>
41968 <secondary>argument, setting</secondary>
41970 <indexterm role="concept">
41971 <primary>LHLO argument setting</primary>
41973 The value of this option is expanded after a connection to a another host has
41974 been set up. The result is used as the argument for the EHLO, HELO, or LHLO
41975 command that starts the outgoing SMTP or LMTP session. The default value of the
41978 <literallayout class="monospaced">
41982 During the expansion, the variables <varname>$host</varname> and <varname>$host_address</varname> are set to
41983 the identity of the remote host, and the variables <varname>$sending_ip_address</varname> and
41984 <varname>$sending_port</varname> are set to the local IP address and port number that are being
41985 used. These variables can be used to generate different values for different
41986 servers or different local IP addresses. For example, if you want the string
41987 that is used for <option>helo_data</option> to be obtained by a DNS lookup of the outgoing
41988 interface address, you could use this:
41990 <literallayout class="monospaced">
41991 helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}\
41992 {$primary_hostname}}
41995 The use of <option>helo_data</option> applies both to sending messages and when doing
41999 <indexterm role="option">
42000 <primary><option>hosts</option></primary>
42003 <informaltable frame="all">
42004 <tgroup cols="4" colsep="0" rowsep="0">
42005 <colspec colwidth="8*" align="left"/>
42006 <colspec colwidth="6*" align="center"/>
42007 <colspec colwidth="6*" align="center"/>
42008 <colspec colwidth="6*" align="right"/>
42011 <entry><option>hosts</option></entry>
42012 <entry>Use: <emphasis>smtp</emphasis></entry>
42013 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
42014 <entry>Default: <emphasis>unset</emphasis></entry>
42020 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
42021 finds the hosts by looking up the address domain in the DNS, or by
42022 <command>manualroute</command>, which has lists of hosts in its configuration. However,
42023 email addresses can be passed to the <command>smtp</command> transport by any router, and not
42024 all of them can provide an associated list of hosts.
42027 The <option>hosts</option> option specifies a list of hosts to be used if the address being
42028 processed does not have any hosts associated with it. The hosts specified by
42029 <option>hosts</option> are also used, whether or not the address has its own hosts, if
42030 <option>hosts_override</option> is set.
42033 The string is first expanded, before being interpreted as a colon-separated
42034 list of host names or IP addresses, possibly including port numbers. The
42035 separator may be changed to something other than colon, as described in section
42036 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
42037 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
42038 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
42039 of the <command>manualroute</command> router is not available here.
42042 If the expansion fails, delivery is deferred. Unless the failure was caused by
42043 the inability to complete a lookup, the error is logged to the panic log as
42044 well as the main log. Host names are looked up either by searching directly for
42045 address records in the DNS or by calling <function>gethostbyname()</function> (or
42046 <function>getipnodebyname()</function> when available), depending on the setting of the
42047 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
42048 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
42052 During delivery, the hosts are tried in order, subject to their retry status,
42053 unless <option>hosts_randomize</option> is set.
42056 <indexterm role="option">
42057 <primary><option>hosts_avoid_esmtp</option></primary>
42060 <informaltable frame="all">
42061 <tgroup cols="4" colsep="0" rowsep="0">
42062 <colspec colwidth="8*" align="left"/>
42063 <colspec colwidth="6*" align="center"/>
42064 <colspec colwidth="6*" align="center"/>
42065 <colspec colwidth="6*" align="right"/>
42068 <entry><option>hosts_avoid_esmtp</option></entry>
42069 <entry>Use: <emphasis>smtp</emphasis></entry>
42070 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
42071 <entry>Default: <emphasis>unset</emphasis></entry>
42077 <indexterm role="concept">
42078 <primary>ESMTP, avoiding use of</primary>
42080 <indexterm role="concept">
42081 <primary>HELO</primary>
42082 <secondary>forcing use of</secondary>
42084 <indexterm role="concept">
42085 <primary>EHLO</primary>
42086 <secondary>avoiding use of</secondary>
42088 <indexterm role="concept">
42089 <primary>PIPELINING</primary>
42090 <secondary>avoiding the use of</secondary>
42092 This option is for use with broken hosts that announce ESMTP facilities (for
42093 example, PIPELINING) and then fail to implement them properly. When a host
42094 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
42095 start of the SMTP session. This means that it cannot use any of the ESMTP
42096 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
42099 <indexterm role="option">
42100 <primary><option>hosts_avoid_pipelining</option></primary>
42103 <informaltable frame="all">
42104 <tgroup cols="4" colsep="0" rowsep="0">
42105 <colspec colwidth="8*" align="left"/>
42106 <colspec colwidth="6*" align="center"/>
42107 <colspec colwidth="6*" align="center"/>
42108 <colspec colwidth="6*" align="right"/>
42111 <entry><option>hosts_avoid_pipelining</option></entry>
42112 <entry>Use: <emphasis>smtp</emphasis></entry>
42113 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
42114 <entry>Default: <emphasis>unset</emphasis></entry>
42120 <indexterm role="concept">
42121 <primary>PIPELINING</primary>
42122 <secondary>avoiding the use of</secondary>
42124 Exim will not use the SMTP PIPELINING extension when delivering to any host
42125 that matches this list, even if the server host advertises PIPELINING support.
42128 <indexterm role="option">
42129 <primary><option>hosts_avoid_tls</option></primary>
42132 <informaltable frame="all">
42133 <tgroup cols="4" colsep="0" rowsep="0">
42134 <colspec colwidth="8*" align="left"/>
42135 <colspec colwidth="6*" align="center"/>
42136 <colspec colwidth="6*" align="center"/>
42137 <colspec colwidth="6*" align="right"/>
42140 <entry><option>hosts_avoid_tls</option></entry>
42141 <entry>Use: <emphasis>smtp</emphasis></entry>
42142 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
42143 <entry>Default: <emphasis>unset</emphasis></entry>
42149 <indexterm role="concept">
42150 <primary>TLS</primary>
42151 <secondary>avoiding for certain hosts</secondary>
42153 Exim will not try to start a TLS session when delivering to any host that
42154 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
42157 <indexterm role="option">
42158 <primary><option>hosts_max_try</option></primary>
42161 <informaltable frame="all">
42162 <tgroup cols="4" colsep="0" rowsep="0">
42163 <colspec colwidth="8*" align="left"/>
42164 <colspec colwidth="6*" align="center"/>
42165 <colspec colwidth="6*" align="center"/>
42166 <colspec colwidth="6*" align="right"/>
42169 <entry><option>hosts_max_try</option></entry>
42170 <entry>Use: <emphasis>smtp</emphasis></entry>
42171 <entry>Type: <emphasis>integer</emphasis></entry>
42172 <entry>Default: <emphasis>5</emphasis></entry>
42178 <indexterm role="concept">
42179 <primary>host</primary>
42180 <secondary>maximum number to try</secondary>
42182 <indexterm role="concept">
42183 <primary>limit</primary>
42184 <secondary>number of hosts tried</secondary>
42186 <indexterm role="concept">
42187 <primary>limit</primary>
42188 <secondary>number of MX tried</secondary>
42190 <indexterm role="concept">
42191 <primary>MX record</primary>
42192 <secondary>maximum tried</secondary>
42194 This option limits the number of IP addresses that are tried for any one
42195 delivery in cases where there are temporary delivery errors. Section
42196 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
42199 <indexterm role="option">
42200 <primary><option>hosts_max_try_hardlimit</option></primary>
42203 <informaltable frame="all">
42204 <tgroup cols="4" colsep="0" rowsep="0">
42205 <colspec colwidth="8*" align="left"/>
42206 <colspec colwidth="6*" align="center"/>
42207 <colspec colwidth="6*" align="center"/>
42208 <colspec colwidth="6*" align="right"/>
42211 <entry><option>hosts_max_try_hardlimit</option></entry>
42212 <entry>Use: <emphasis>smtp</emphasis></entry>
42213 <entry>Type: <emphasis>integer</emphasis></entry>
42214 <entry>Default: <emphasis>50</emphasis></entry>
42220 This is an additional check on the maximum number of IP addresses that Exim
42221 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
42225 <indexterm role="option">
42226 <primary><option>hosts_nopass_tls</option></primary>
42229 <informaltable frame="all">
42230 <tgroup cols="4" colsep="0" rowsep="0">
42231 <colspec colwidth="8*" align="left"/>
42232 <colspec colwidth="6*" align="center"/>
42233 <colspec colwidth="6*" align="center"/>
42234 <colspec colwidth="6*" align="right"/>
42237 <entry><option>hosts_nopass_tls</option></entry>
42238 <entry>Use: <emphasis>smtp</emphasis></entry>
42239 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
42240 <entry>Default: <emphasis>unset</emphasis></entry>
42246 <indexterm role="concept">
42247 <primary>TLS</primary>
42248 <secondary>passing connection</secondary>
42250 <indexterm role="concept">
42251 <primary>multiple SMTP deliveries</primary>
42253 <indexterm role="concept">
42254 <primary>TLS</primary>
42255 <secondary>multiple message deliveries</secondary>
42257 For any host that matches this list, a connection on which a TLS session has
42258 been started will not be passed to a new delivery process for sending another
42259 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
42260 explanation of when this might be needed.
42263 <indexterm role="option">
42264 <primary><option>hosts_override</option></primary>
42267 <informaltable frame="all">
42268 <tgroup cols="4" colsep="0" rowsep="0">
42269 <colspec colwidth="8*" align="left"/>
42270 <colspec colwidth="6*" align="center"/>
42271 <colspec colwidth="6*" align="center"/>
42272 <colspec colwidth="6*" align="right"/>
42275 <entry><option>hosts_override</option></entry>
42276 <entry>Use: <emphasis>smtp</emphasis></entry>
42277 <entry>Type: <emphasis>boolean</emphasis></entry>
42278 <entry>Default: <emphasis>false</emphasis></entry>
42284 If this option is set and the <option>hosts</option> option is also set, any hosts that are
42285 attached to the address are ignored, and instead the hosts specified by the
42286 <option>hosts</option> option are always used. This option does not apply to
42287 <option>fallback_hosts</option>.
42290 <indexterm role="option">
42291 <primary><option>hosts_randomize</option></primary>
42294 <informaltable frame="all">
42295 <tgroup cols="4" colsep="0" rowsep="0">
42296 <colspec colwidth="8*" align="left"/>
42297 <colspec colwidth="6*" align="center"/>
42298 <colspec colwidth="6*" align="center"/>
42299 <colspec colwidth="6*" align="right"/>
42302 <entry><option>hosts_randomize</option></entry>
42303 <entry>Use: <emphasis>smtp</emphasis></entry>
42304 <entry>Type: <emphasis>boolean</emphasis></entry>
42305 <entry>Default: <emphasis>false</emphasis></entry>
42311 <indexterm role="concept">
42312 <primary>randomized host list</primary>
42314 <indexterm role="concept">
42315 <primary>host</primary>
42316 <secondary>list of; randomized</secondary>
42318 <indexterm role="concept">
42319 <primary>fallback</primary>
42320 <secondary>randomized hosts</secondary>
42322 If this option is set, and either the list of hosts is taken from the
42323 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
42324 were not obtained from MX records (this includes fallback hosts from the
42325 router), and were not randomized by the router, the order of trying the hosts
42326 is randomized each time the transport runs. Randomizing the order of a host
42327 list can be used to do crude load sharing.
42330 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
42331 order is separately randomized. This makes it possible to set up MX-like
42332 behaviour. The boundaries between groups are indicated by an item that is just
42333 <literal>+</literal> in the host list. For example:
42335 <literallayout class="monospaced">
42336 hosts = host1:host2:host3:+:host4:host5
42339 The order of the first three hosts and the order of the last two hosts is
42340 randomized for each use, but the first three always end up before the last two.
42341 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
42344 <indexterm role="option">
42345 <primary><option>hosts_require_auth</option></primary>
42348 <informaltable frame="all">
42349 <tgroup cols="4" colsep="0" rowsep="0">
42350 <colspec colwidth="8*" align="left"/>
42351 <colspec colwidth="6*" align="center"/>
42352 <colspec colwidth="6*" align="center"/>
42353 <colspec colwidth="6*" align="right"/>
42356 <entry><option>hosts_require_auth</option></entry>
42357 <entry>Use: <emphasis>smtp</emphasis></entry>
42358 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
42359 <entry>Default: <emphasis>unset</emphasis></entry>
42365 <indexterm role="concept">
42366 <primary>authentication</primary>
42367 <secondary>required by client</secondary>
42369 This option provides a list of servers for which authentication must succeed
42370 before Exim will try to transfer a message. If authentication fails for
42371 servers which are not in this list, Exim tries to send unauthenticated. If
42372 authentication fails for one of these servers, delivery is deferred. This
42373 temporary error is detectable in the retry rules, so it can be turned into a
42374 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
42375 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
42378 <indexterm role="option">
42379 <primary><option>hosts_require_tls</option></primary>
42382 <informaltable frame="all">
42383 <tgroup cols="4" colsep="0" rowsep="0">
42384 <colspec colwidth="8*" align="left"/>
42385 <colspec colwidth="6*" align="center"/>
42386 <colspec colwidth="6*" align="center"/>
42387 <colspec colwidth="6*" align="right"/>
42390 <entry><option>hosts_require_tls</option></entry>
42391 <entry>Use: <emphasis>smtp</emphasis></entry>
42392 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
42393 <entry>Default: <emphasis>unset</emphasis></entry>
42399 <indexterm role="concept">
42400 <primary>TLS</primary>
42401 <secondary>requiring for certain servers</secondary>
42403 Exim will insist on using a TLS session when delivering to any host that
42404 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
42405 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
42406 incoming messages, use an appropriate ACL.
42409 <indexterm role="option">
42410 <primary><option>hosts_try_auth</option></primary>
42413 <informaltable frame="all">
42414 <tgroup cols="4" colsep="0" rowsep="0">
42415 <colspec colwidth="8*" align="left"/>
42416 <colspec colwidth="6*" align="center"/>
42417 <colspec colwidth="6*" align="center"/>
42418 <colspec colwidth="6*" align="right"/>
42421 <entry><option>hosts_try_auth</option></entry>
42422 <entry>Use: <emphasis>smtp</emphasis></entry>
42423 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
42424 <entry>Default: <emphasis>unset</emphasis></entry>
42430 <indexterm role="concept">
42431 <primary>authentication</primary>
42432 <secondary>optional in client</secondary>
42434 This option provides a list of servers to which, provided they announce
42435 authentication support, Exim will attempt to authenticate as a client when it
42436 connects. If authentication fails, Exim will try to transfer the message
42437 unauthenticated. See also <option>hosts_require_auth</option>, and chapter
42438 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
42441 <indexterm role="option">
42442 <primary><option>interface</option></primary>
42445 <informaltable frame="all">
42446 <tgroup cols="4" colsep="0" rowsep="0">
42447 <colspec colwidth="8*" align="left"/>
42448 <colspec colwidth="6*" align="center"/>
42449 <colspec colwidth="6*" align="center"/>
42450 <colspec colwidth="6*" align="right"/>
42453 <entry><option>interface</option></entry>
42454 <entry>Use: <emphasis>smtp</emphasis></entry>
42455 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
42456 <entry>Default: <emphasis>unset</emphasis></entry>
42462 <indexterm role="concept">
42463 <primary>bind IP address</primary>
42465 <indexterm role="concept">
42466 <primary>IP address</primary>
42467 <secondary>binding</secondary>
42469 <indexterm role="variable">
42470 <primary><varname>$host</varname></primary>
42472 <indexterm role="variable">
42473 <primary><varname>$host_address</varname></primary>
42475 This option specifies which interface to bind to when making an outgoing SMTP
42476 call. The value is an IP address, not an interface name such as
42477 <literal>eth0</literal>. Do not confuse this with the interface address that was used when a
42478 message was received, which is in <varname>$received_ip_address</varname>, formerly known as
42479 <varname>$interface_address</varname>. The name was changed to minimize confusion with the
42480 outgoing interface address. There is no variable that contains an outgoing
42481 interface address because, unless it is set by this option, its value is
42485 During the expansion of the <option>interface</option> option the variables <varname>$host</varname> and
42486 <varname>$host_address</varname> refer to the host to which a connection is about to be made
42487 during the expansion of the string. Forced expansion failure, or an empty
42488 string result causes the option to be ignored. Otherwise, after expansion, the
42489 string must be a list of IP addresses, colon-separated by default, but the
42490 separator can be changed in the usual way. For example:
42492 <literallayout class="monospaced">
42493 interface = <; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
42496 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
42497 connection. If none of them are the correct type, the option is ignored. If
42498 <option>interface</option> is not set, or is ignored, the system’s IP functions choose which
42499 interface to use if the host has more than one.
42502 <indexterm role="option">
42503 <primary><option>keepalive</option></primary>
42506 <informaltable frame="all">
42507 <tgroup cols="4" colsep="0" rowsep="0">
42508 <colspec colwidth="8*" align="left"/>
42509 <colspec colwidth="6*" align="center"/>
42510 <colspec colwidth="6*" align="center"/>
42511 <colspec colwidth="6*" align="right"/>
42514 <entry><option>keepalive</option></entry>
42515 <entry>Use: <emphasis>smtp</emphasis></entry>
42516 <entry>Type: <emphasis>boolean</emphasis></entry>
42517 <entry>Default: <emphasis>true</emphasis></entry>
42523 <indexterm role="concept">
42524 <primary>keepalive</primary>
42525 <secondary>on outgoing connection</secondary>
42527 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
42528 connections. When set, it causes the kernel to probe idle connections
42529 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
42530 of the connection should send a acknowledgment if the connection is still okay
42531 or a reset if the connection has been aborted. The reason for doing this is
42532 that it has the beneficial effect of freeing up certain types of connection
42533 that can get stuck when the remote host is disconnected without tidying up the
42534 TCP/IP call properly. The keepalive mechanism takes several hours to detect
42538 <indexterm role="option">
42539 <primary><option>lmtp_ignore_quota</option></primary>
42542 <informaltable frame="all">
42543 <tgroup cols="4" colsep="0" rowsep="0">
42544 <colspec colwidth="8*" align="left"/>
42545 <colspec colwidth="6*" align="center"/>
42546 <colspec colwidth="6*" align="center"/>
42547 <colspec colwidth="6*" align="right"/>
42550 <entry><option>lmtp_ignore_quota</option></entry>
42551 <entry>Use: <emphasis>smtp</emphasis></entry>
42552 <entry>Type: <emphasis>boolean</emphasis></entry>
42553 <entry>Default: <emphasis>false</emphasis></entry>
42559 <indexterm role="concept">
42560 <primary>LMTP</primary>
42561 <secondary>ignoring quota errors</secondary>
42563 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
42564 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
42565 has advertised support for IGNOREQUOTA in its response to the LHLO command.
42568 <indexterm role="option">
42569 <primary><option>max_rcpt</option></primary>
42572 <informaltable frame="all">
42573 <tgroup cols="4" colsep="0" rowsep="0">
42574 <colspec colwidth="8*" align="left"/>
42575 <colspec colwidth="6*" align="center"/>
42576 <colspec colwidth="6*" align="center"/>
42577 <colspec colwidth="6*" align="right"/>
42580 <entry><option>max_rcpt</option></entry>
42581 <entry>Use: <emphasis>smtp</emphasis></entry>
42582 <entry>Type: <emphasis>integer</emphasis></entry>
42583 <entry>Default: <emphasis>100</emphasis></entry>
42589 <indexterm role="concept">
42590 <primary>RCPT</primary>
42591 <secondary>maximum number of outgoing</secondary>
42593 This option limits the number of RCPT commands that are sent in a single
42594 SMTP message transaction. Each set of addresses is treated independently, and
42595 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
42599 <indexterm role="option">
42600 <primary><option>multi_domain</option></primary>
42603 <informaltable frame="all">
42604 <tgroup cols="4" colsep="0" rowsep="0">
42605 <colspec colwidth="8*" align="left"/>
42606 <colspec colwidth="6*" align="center"/>
42607 <colspec colwidth="6*" align="center"/>
42608 <colspec colwidth="6*" align="right"/>
42611 <entry><option>multi_domain</option></entry>
42612 <entry>Use: <emphasis>smtp</emphasis></entry>
42613 <entry>Type: <emphasis>boolean</emphasis></entry>
42614 <entry>Default: <emphasis>true</emphasis></entry>
42620 <indexterm role="variable">
42621 <primary><varname>$domain</varname></primary>
42623 When this option is set, the <command>smtp</command> transport can handle a number of
42624 addresses containing a mixture of different domains provided they all resolve
42625 to the same list of hosts. Turning the option off restricts the transport to
42626 handling only one domain at a time. This is useful if you want to use
42627 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
42628 is a single domain involved in a remote delivery.
42631 <indexterm role="option">
42632 <primary><option>port</option></primary>
42635 <informaltable frame="all">
42636 <tgroup cols="4" colsep="0" rowsep="0">
42637 <colspec colwidth="8*" align="left"/>
42638 <colspec colwidth="6*" align="center"/>
42639 <colspec colwidth="6*" align="center"/>
42640 <colspec colwidth="6*" align="right"/>
42643 <entry><option>port</option></entry>
42644 <entry>Use: <emphasis>smtp</emphasis></entry>
42645 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
42646 <entry>Default: <emphasis>see below</emphasis></entry>
42652 <indexterm role="concept">
42653 <primary>port</primary>
42654 <secondary>sending TCP/IP</secondary>
42656 <indexterm role="concept">
42657 <primary>TCP/IP</primary>
42658 <secondary>setting outgoing port</secondary>
42660 This option specifies the TCP/IP port on the server to which Exim connects.
42661 <emphasis role="bold">Note:</emphasis> Do not confuse this with the port that was used when a message was
42662 received, which is in <varname>$received_port</varname>, formerly known as <varname>$interface_port</varname>.
42663 The name was changed to minimize confusion with the outgoing port. There is no
42664 variable that contains an outgoing port.
42667 If the value of this option begins with a digit it is taken as a port number;
42668 otherwise it is looked up using <function>getservbyname()</function>. The default value is
42669 normally <quote>smtp</quote>, but if <option>protocol</option> is set to <quote>lmtp</quote>, the default is
42670 <quote>lmtp</quote>. If the expansion fails, or if a port number cannot be found, delivery
42674 <indexterm role="option">
42675 <primary><option>protocol</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>protocol</option></entry>
42687 <entry>Use: <emphasis>smtp</emphasis></entry>
42688 <entry>Type: <emphasis>string</emphasis></entry>
42689 <entry>Default: <emphasis>smtp</emphasis></entry>
42695 <indexterm role="concept">
42696 <primary>LMTP</primary>
42697 <secondary>over TCP/IP</secondary>
42699 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
42700 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
42701 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
42702 deliveries into closed message stores. Exim also has support for running LMTP
42703 over a pipe to a local process – see chapter <xref linkend="CHAPLMTP"/>.
42706 <indexterm role="option">
42707 <primary><option>retry_include_ip_address</option></primary>
42710 <informaltable frame="all">
42711 <tgroup cols="4" colsep="0" rowsep="0">
42712 <colspec colwidth="8*" align="left"/>
42713 <colspec colwidth="6*" align="center"/>
42714 <colspec colwidth="6*" align="center"/>
42715 <colspec colwidth="6*" align="right"/>
42718 <entry><option>retry_include_ip_address</option></entry>
42719 <entry>Use: <emphasis>smtp</emphasis></entry>
42720 <entry>Type: <emphasis>boolean</emphasis></entry>
42721 <entry>Default: <emphasis>true</emphasis></entry>
42727 Exim normally includes both the host name and the IP address in the key it
42728 constructs for indexing retry data after a temporary delivery failure. This
42729 means that when one of several IP addresses for a host is failing, it gets
42730 tried periodically (controlled by the retry rules), but use of the other IP
42731 addresses is not affected.
42734 However, in some dialup environments hosts are assigned a different IP address
42735 each time they connect. In this situation the use of the IP address as part of
42736 the retry key leads to undesirable behaviour. Setting this option false causes
42737 Exim to use only the host name. This should normally be done on a separate
42738 instance of the <command>smtp</command> transport, set up specially to handle the dialup
42742 <indexterm role="option">
42743 <primary><option>serialize_hosts</option></primary>
42746 <informaltable frame="all">
42747 <tgroup cols="4" colsep="0" rowsep="0">
42748 <colspec colwidth="8*" align="left"/>
42749 <colspec colwidth="6*" align="center"/>
42750 <colspec colwidth="6*" align="center"/>
42751 <colspec colwidth="6*" align="right"/>
42754 <entry><option>serialize_hosts</option></entry>
42755 <entry>Use: <emphasis>smtp</emphasis></entry>
42756 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
42757 <entry>Default: <emphasis>unset</emphasis></entry>
42763 <indexterm role="concept">
42764 <primary>serializing connections</primary>
42766 <indexterm role="concept">
42767 <primary>host</primary>
42768 <secondary>serializing connections</secondary>
42770 Because Exim operates in a distributed manner, if several messages for the same
42771 host arrive at around the same time, more than one simultaneous connection to
42772 the remote host can occur. This is not usually a problem except when there is a
42773 slow link between the hosts. In that situation it may be helpful to restrict
42774 Exim to one connection at a time. This can be done by setting
42775 <option>serialize_hosts</option> to match the relevant hosts.
42778 <indexterm role="concept">
42779 <primary>hints database</primary>
42780 <secondary>serializing deliveries to a host</secondary>
42782 Exim implements serialization by means of a hints database in which a record is
42783 written whenever a process connects to one of the restricted hosts. The record
42784 is deleted when the connection is completed. Obviously there is scope for
42785 records to get left lying around if there is a system or program crash. To
42786 guard against this, Exim ignores any records that are more than six hours old.
42789 If you set up this kind of serialization, you should also arrange to delete the
42790 relevant hints database whenever your system reboots. The names of the files
42791 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
42792 may be one or two files, depending on the type of DBM in use. The same files
42793 are used for ETRN serialization.
42796 <indexterm role="option">
42797 <primary><option>size_addition</option></primary>
42800 <informaltable frame="all">
42801 <tgroup cols="4" colsep="0" rowsep="0">
42802 <colspec colwidth="8*" align="left"/>
42803 <colspec colwidth="6*" align="center"/>
42804 <colspec colwidth="6*" align="center"/>
42805 <colspec colwidth="6*" align="right"/>
42808 <entry><option>size_addition</option></entry>
42809 <entry>Use: <emphasis>smtp</emphasis></entry>
42810 <entry>Type: <emphasis>integer</emphasis></entry>
42811 <entry>Default: <emphasis>1024</emphasis></entry>
42817 <indexterm role="concept">
42818 <primary>SMTP</primary>
42819 <secondary>SIZE</secondary>
42821 <indexterm role="concept">
42822 <primary>message</primary>
42823 <secondary>size issue for transport filter</secondary>
42825 <indexterm role="concept">
42826 <primary>size</primary>
42827 <secondary>of message</secondary>
42829 <indexterm role="concept">
42830 <primary>transport</primary>
42831 <secondary>filter</secondary>
42833 <indexterm role="concept">
42834 <primary>filter</primary>
42835 <secondary>transport filter</secondary>
42837 If a remote SMTP server indicates that it supports the SIZE option of the
42838 MAIL command, Exim uses this to pass over the message size at the start of
42839 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
42840 sends, to allow for headers and other text that may be added during delivery by
42841 configuration options or in a transport filter. It may be necessary to increase
42842 this if a lot of text is added to messages.
42845 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
42846 the use of the SIZE option altogether.
42849 <indexterm role="option">
42850 <primary><option>tls_certificate</option></primary>
42853 <informaltable frame="all">
42854 <tgroup cols="4" colsep="0" rowsep="0">
42855 <colspec colwidth="8*" align="left"/>
42856 <colspec colwidth="6*" align="center"/>
42857 <colspec colwidth="6*" align="center"/>
42858 <colspec colwidth="6*" align="right"/>
42861 <entry><option>tls_certificate</option></entry>
42862 <entry>Use: <emphasis>smtp</emphasis></entry>
42863 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
42864 <entry>Default: <emphasis>unset</emphasis></entry>
42870 <indexterm role="concept">
42871 <primary>TLS</primary>
42872 <secondary>client certificate, location of</secondary>
42874 <indexterm role="concept">
42875 <primary>certificate</primary>
42876 <secondary>client, location of</secondary>
42878 <indexterm role="variable">
42879 <primary><varname>$host</varname></primary>
42881 <indexterm role="variable">
42882 <primary><varname>$host_address</varname></primary>
42884 The value of this option must be the absolute path to a file which contains the
42885 client’s certificate, for possible use when sending a message over an encrypted
42886 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
42887 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
42891 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
42892 certificate when sending messages as a client. The global option of the same
42893 name specifies the certificate for Exim as a server; it is not automatically
42894 assumed that the same certificate should be used when Exim is operating as a
42898 <indexterm role="option">
42899 <primary><option>tls_crl</option></primary>
42902 <informaltable frame="all">
42903 <tgroup cols="4" colsep="0" rowsep="0">
42904 <colspec colwidth="8*" align="left"/>
42905 <colspec colwidth="6*" align="center"/>
42906 <colspec colwidth="6*" align="center"/>
42907 <colspec colwidth="6*" align="right"/>
42910 <entry><option>tls_crl</option></entry>
42911 <entry>Use: <emphasis>smtp</emphasis></entry>
42912 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
42913 <entry>Default: <emphasis>unset</emphasis></entry>
42919 <indexterm role="concept">
42920 <primary>TLS</primary>
42921 <secondary>client certificate revocation list</secondary>
42923 <indexterm role="concept">
42924 <primary>certificate</primary>
42925 <secondary>revocation list for client</secondary>
42927 This option specifies a certificate revocation list. The expanded value must
42928 be the name of a file that contains a CRL in PEM format.
42931 <indexterm role="option">
42932 <primary><option>tls_privatekey</option></primary>
42935 <informaltable frame="all">
42936 <tgroup cols="4" colsep="0" rowsep="0">
42937 <colspec colwidth="8*" align="left"/>
42938 <colspec colwidth="6*" align="center"/>
42939 <colspec colwidth="6*" align="center"/>
42940 <colspec colwidth="6*" align="right"/>
42943 <entry><option>tls_privatekey</option></entry>
42944 <entry>Use: <emphasis>smtp</emphasis></entry>
42945 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
42946 <entry>Default: <emphasis>unset</emphasis></entry>
42952 <indexterm role="concept">
42953 <primary>TLS</primary>
42954 <secondary>client private key, location of</secondary>
42956 <indexterm role="variable">
42957 <primary><varname>$host</varname></primary>
42959 <indexterm role="variable">
42960 <primary><varname>$host_address</varname></primary>
42962 The value of this option must be the absolute path to a file which contains the
42963 client’s private key. This is used when sending a message over an encrypted
42964 connection using a client certificate. The values of <varname>$host</varname> and
42965 <varname>$host_address</varname> are set to the name and address of the server during the
42966 expansion. If this option is unset, or the expansion is forced to fail, or the
42967 result is an empty string, the private key is assumed to be in the same file as
42968 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
42971 <indexterm role="option">
42972 <primary><option>tls_require_ciphers</option></primary>
42975 <informaltable frame="all">
42976 <tgroup cols="4" colsep="0" rowsep="0">
42977 <colspec colwidth="8*" align="left"/>
42978 <colspec colwidth="6*" align="center"/>
42979 <colspec colwidth="6*" align="center"/>
42980 <colspec colwidth="6*" align="right"/>
42983 <entry><option>tls_require_ciphers</option></entry>
42984 <entry>Use: <emphasis>smtp</emphasis></entry>
42985 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
42986 <entry>Default: <emphasis>unset</emphasis></entry>
42992 <indexterm role="concept">
42993 <primary>TLS</primary>
42994 <secondary>requiring specific ciphers</secondary>
42996 <indexterm role="concept">
42997 <primary>cipher</primary>
42998 <secondary>requiring specific</secondary>
43000 <indexterm role="variable">
43001 <primary><varname>$host</varname></primary>
43003 <indexterm role="variable">
43004 <primary><varname>$host_address</varname></primary>
43006 The value of this option must be a list of permitted cipher suites, for use
43007 when setting up an outgoing encrypted connection. (There is a global option of
43008 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
43009 <varname>$host_address</varname> are set to the name and address of the server during the
43010 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
43011 is used in different ways by OpenSSL and GnuTLS (see sections
43012 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
43013 ciphers is a preference order.
43016 <indexterm role="option">
43017 <primary><option>tls_tempfail_tryclear</option></primary>
43020 <informaltable frame="all">
43021 <tgroup cols="4" colsep="0" rowsep="0">
43022 <colspec colwidth="8*" align="left"/>
43023 <colspec colwidth="6*" align="center"/>
43024 <colspec colwidth="6*" align="center"/>
43025 <colspec colwidth="6*" align="right"/>
43028 <entry><option>tls_tempfail_tryclear</option></entry>
43029 <entry>Use: <emphasis>smtp</emphasis></entry>
43030 <entry>Type: <emphasis>boolean</emphasis></entry>
43031 <entry>Default: <emphasis>true</emphasis></entry>
43037 <indexterm role="concept">
43038 <primary>4<emphasis>xx</emphasis> responses</primary>
43039 <secondary>to STARTTLS</secondary>
43041 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
43042 setting up a TLS session, this option determines whether or not Exim should try
43043 to deliver the message unencrypted. If it is set false, delivery to the
43044 current host is deferred; if there are other hosts, they are tried. If this
43045 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
43046 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
43047 TLS negotiation fails, Exim closes the current connection (because it is in an
43048 unknown state), opens a new one to the same host, and then tries the delivery
43052 <indexterm role="option">
43053 <primary><option>tls_verify_certificates</option></primary>
43056 <informaltable frame="all">
43057 <tgroup cols="4" colsep="0" rowsep="0">
43058 <colspec colwidth="8*" align="left"/>
43059 <colspec colwidth="6*" align="center"/>
43060 <colspec colwidth="6*" align="center"/>
43061 <colspec colwidth="6*" align="right"/>
43064 <entry><option>tls_verify_certificates</option></entry>
43065 <entry>Use: <emphasis>smtp</emphasis></entry>
43066 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
43067 <entry>Default: <emphasis>unset</emphasis></entry>
43073 <indexterm role="concept">
43074 <primary>TLS</primary>
43075 <secondary>server certificate verification</secondary>
43077 <indexterm role="concept">
43078 <primary>certificate</primary>
43079 <secondary>verification of server</secondary>
43081 <indexterm role="variable">
43082 <primary><varname>$host</varname></primary>
43084 <indexterm role="variable">
43085 <primary><varname>$host_address</varname></primary>
43087 The value of this option must be the absolute path to a file containing
43088 permitted server certificates, for use when setting up an encrypted connection.
43089 Alternatively, if you are using OpenSSL, you can set
43090 <option>tls_verify_certificates</option> to the name of a directory containing certificate
43091 files. This does not work with GnuTLS; the option must be set to the name of a
43092 single file if you are using GnuTLS. The values of <varname>$host</varname> and
43093 <varname>$host_address</varname> are set to the name and address of the server during the
43094 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
43097 <section id="SECTvalhosmax">
43098 <title>How the limits for the number of hosts to try are used</title>
43100 <indexterm role="concept">
43101 <primary>host</primary>
43102 <secondary>maximum number to try</secondary>
43104 <indexterm role="concept">
43105 <primary>limit</primary>
43106 <secondary>hosts; maximum number tried</secondary>
43108 There are two options that are concerned with the number of hosts that are
43109 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
43110 <option>hosts_max_try_hardlimit</option>.
43113 The <option>hosts_max_try</option> option limits the number of hosts that are tried
43114 for a single delivery. However, despite the term <quote>host</quote> in its name, the
43115 option actually applies to each IP address independently. In other words, a
43116 multihomed host is treated as several independent hosts, just as it is for
43120 Many of the larger ISPs have multiple MX records which often point to
43121 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
43122 created as a result of routing one of these domains.
43125 Trying every single IP address on such a long list does not seem sensible; if
43126 several at the top of the list fail, it is reasonable to assume there is some
43127 problem that is likely to affect all of them. Roughly speaking, the value of
43128 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
43129 delivery. However, the logic cannot be quite that simple.
43132 Firstly, IP addresses that are skipped because their retry times have not
43133 arrived do not count, and in addition, addresses that are past their retry
43134 limits are also not counted, even when they are tried. This means that when
43135 some IP addresses are past their retry limits, more than the value of
43136 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
43137 that all IP addresses are considered before timing out an email address (but
43138 see below for an exception).
43141 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
43142 list to see if there is a subsequent host with a different (higher valued) MX.
43143 If there is, that host is considered next, and the current IP address is used
43144 but not counted. This behaviour helps in the case of a domain with a retry rule
43145 that hardly ever delays any hosts, as is now explained:
43148 Consider the case of a long list of hosts with one MX value, and a few with a
43149 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
43150 hosts at the top of the list are tried at first. With the default retry rule,
43151 which specifies increasing retry times, the higher MX hosts are eventually
43152 tried when those at the top of the list are skipped because they have not
43153 reached their retry times.
43156 However, it is common practice to put a fixed short retry time on domains for
43157 large ISPs, on the grounds that their servers are rarely down for very long.
43158 Unfortunately, these are exactly the domains that tend to resolve to long lists
43159 of hosts. The short retry time means that the lowest MX hosts are tried every
43160 time. The attempts may be in a different order because of random sorting, but
43161 without the special MX check, the higher MX hosts would never be tried until
43162 all the lower MX hosts had timed out (which might be several days), because
43163 there are always some lower MX hosts that have reached their retry times. With
43164 the special check, Exim considers at least one IP address from each MX value at
43165 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
43169 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
43170 particular, Exim normally eventually tries all the IP addresses before timing
43171 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
43172 reasonable thing to do. Recently, however, some lunatic DNS configurations have
43173 been set up with hundreds of IP addresses for some domains. It can
43174 take a very long time indeed for an address to time out in these cases.
43177 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
43178 Exim never tries more than this number of IP addresses; if it hits this limit
43179 and they are all timed out, the email address is bounced, even though not all
43180 possible IP addresses have been tried.
43181 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
43182 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
43187 <chapter id="CHAPrewrite">
43188 <title>Address rewriting</title>
43190 <indexterm role="concept" id="IIDaddrew" class="startofrange">
43191 <primary>rewriting</primary>
43192 <secondary>addresses</secondary>
43194 There are some circumstances in which Exim automatically rewrites domains in
43195 addresses. The two most common are when an address is given without a domain
43196 (referred to as an <quote>unqualified address</quote>) or when an address contains an
43197 abbreviated domain that is expanded by DNS lookup.
43200 Unqualified envelope addresses are accepted only for locally submitted
43201 messages, or for messages that are received from hosts matching
43202 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
43203 appropriate. Unqualified addresses in header lines are qualified if they are in
43204 locally submitted messages, or messages from hosts that are permitted to send
43205 unqualified envelope addresses. Otherwise, unqualified addresses in header
43206 lines are neither qualified nor rewritten.
43209 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
43210 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
43211 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
43212 do this. The new RFCs do not contain this suggestion.
43214 <section id="SECID147">
43215 <title>Explicitly configured address rewriting</title>
43217 This chapter describes the rewriting rules that can be used in the
43218 main rewrite section of the configuration file, and also in the generic
43219 <option>headers_rewrite</option> option that can be set on any transport.
43222 Some people believe that configured address rewriting is a Mortal Sin.
43223 Others believe that life is not possible without it. Exim provides the
43224 facility; you do not have to use it.
43227 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
43228 configuration file are applied to addresses in incoming messages, both envelope
43229 addresses and addresses in header lines. Each rule specifies the types of
43230 address to which it applies.
43233 Whether or not addresses in header lines are rewritten depends on the origin of
43234 the headers and the type of rewriting. Global rewriting, that is, rewriting
43235 rules from the rewrite section of the configuration file, is applied only to
43236 those headers that were received with the message. Header lines that are added
43237 by ACLs or by a system filter or by individual routers or transports (which
43238 are specific to individual recipient addresses) are not rewritten by the global
43242 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
43243 applies all headers except those added by routers and transports. That is, as
43244 well as the headers that were received with the message, it also applies to
43245 headers that were added by an ACL or a system filter.
43248 In general, rewriting addresses from your own system or domain has some
43249 legitimacy. Rewriting other addresses should be done only with great care and
43250 in special circumstances. The author of Exim believes that rewriting should be
43251 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
43252 Although it can sometimes be used as a routing tool, this is very strongly
43256 There are two commonly encountered circumstances where rewriting is used, as
43257 illustrated by these examples:
43262 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
43263 exchange mail with each other behind a firewall, but there is only a single
43264 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
43265 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
43270 A host rewrites the local parts of its own users so that, for example,
43271 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
43276 <section id="SECID148">
43277 <title>When does rewriting happen?</title>
43279 <indexterm role="concept">
43280 <primary>rewriting</primary>
43281 <secondary>timing of</secondary>
43283 <indexterm role="concept">
43284 <primary>access control lists (ACLs)</primary>
43285 <secondary>rewriting addresses in</secondary>
43287 Configured address rewriting can take place at several different stages of a
43288 message’s processing.
43291 <indexterm role="variable">
43292 <primary><varname>$sender_address</varname></primary>
43294 At the start of an ACL for MAIL, the sender address may have been rewritten
43295 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
43296 ordinary rewrite rules have yet been applied. If, however, the sender address
43297 is verified in the ACL, it is rewritten before verification, and remains
43298 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
43299 rewritten address. This also applies if sender verification happens in a
43300 RCPT ACL. Otherwise, when the sender address is not verified, it is
43301 rewritten as soon as a message’s header lines have been received.
43304 <indexterm role="variable">
43305 <primary><varname>$domain</varname></primary>
43307 <indexterm role="variable">
43308 <primary><varname>$local_part</varname></primary>
43310 Similarly, at the start of an ACL for RCPT, the current recipient’s address
43311 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
43312 rewrite rules have yet been applied to it. However, the behaviour is different
43313 from the sender address when a recipient is verified. The address is rewritten
43314 for the verification, but the rewriting is not remembered at this stage. The
43315 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
43316 as they were before (that is, they contain the unrewritten – except for
43317 SMTP-time rewriting – address).
43320 As soon as a message’s header lines have been received, all the envelope
43321 recipient addresses are permanently rewritten, and rewriting is also applied to
43322 the addresses in the header lines (if configured). This happens before adding
43323 any header lines that were specified in MAIL or RCPT ACLs, and
43324 <indexterm role="concept">
43325 <primary><function>local_scan()</function> function</primary>
43326 <secondary>address rewriting; timing of</secondary>
43328 before the DATA ACL and <function>local_scan()</function> functions are run.
43331 When an address is being routed, either for delivery or for verification,
43332 rewriting is applied immediately to child addresses that are generated by
43333 redirection, unless <option>no_rewrite</option> is set on the router.
43336 <indexterm role="concept">
43337 <primary>envelope sender</primary>
43338 <secondary>rewriting at transport time</secondary>
43340 <indexterm role="concept">
43341 <primary>rewriting</primary>
43342 <secondary>at transport time</secondary>
43344 <indexterm role="concept">
43345 <primary>header lines</primary>
43346 <secondary>rewriting at transport time</secondary>
43348 At transport time, additional rewriting of addresses in header lines can be
43349 specified by setting the generic <option>headers_rewrite</option> option on a transport.
43350 This option contains rules that are identical in form to those in the rewrite
43351 section of the configuration file. They are applied to the original message
43352 header lines and any that were added by ACLs or a system filter. They are not
43353 applied to header lines that are added by routers or the transport.
43356 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
43357 transport option. However, it is not possible to rewrite envelope recipients at
43361 <section id="SECID149">
43362 <title>Testing the rewriting rules that apply on input</title>
43364 <indexterm role="concept">
43365 <primary>rewriting</primary>
43366 <secondary>testing</secondary>
43368 <indexterm role="concept">
43369 <primary>testing</primary>
43370 <secondary>rewriting</secondary>
43372 Exim’s input rewriting configuration appears in a part of the run time
43373 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
43374 <option>-brw</option> command line option. This takes an address (which can be a full RFC
43375 2822 address) as its argument. The output is a list of how the address would be
43376 transformed by the rewriting rules for each of the different places it might
43377 appear in an incoming message, that is, for each different header and for the
43378 envelope sender and recipient fields. For example,
43380 <literallayout class="monospaced">
43381 exim -brw ph10@exim.workshop.example
43384 might produce the output
43386 <literallayout class="monospaced">
43387 sender: Philip.Hazel@exim.workshop.example
43388 from: Philip.Hazel@exim.workshop.example
43389 to: ph10@exim.workshop.example
43390 cc: ph10@exim.workshop.example
43391 bcc: ph10@exim.workshop.example
43392 reply-to: Philip.Hazel@exim.workshop.example
43393 env-from: Philip.Hazel@exim.workshop.example
43394 env-to: ph10@exim.workshop.example
43397 which shows that rewriting has been set up for that address when used in any of
43398 the source fields, but not when it appears as a recipient address. At the
43399 present time, there is no equivalent way of testing rewriting rules that are
43400 set for a particular transport.
43403 <section id="SECID150">
43404 <title>Rewriting rules</title>
43406 <indexterm role="concept">
43407 <primary>rewriting</primary>
43408 <secondary>rules</secondary>
43410 The rewrite section of the configuration file consists of lines of rewriting
43414 <<emphasis>source pattern</emphasis>> <<emphasis>replacement</emphasis>> <<emphasis>flags</emphasis>>
43417 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
43418 transport option are given as a colon-separated list. Each item in the list
43419 takes the same form as a line in the main rewriting configuration (except that
43420 any colons must be doubled, of course).
43423 The formats of source patterns and replacement strings are described below.
43424 Each is terminated by white space, unless enclosed in double quotes, in which
43425 case normal quoting conventions apply inside the quotes. The flags are single
43426 characters which may appear in any order. Spaces and tabs between them are
43430 For each address that could potentially be rewritten, the rules are scanned in
43431 order, and replacements for the address from earlier rules can themselves be
43432 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
43435 The order in which addresses are rewritten is undefined, may change between
43436 releases, and must not be relied on, with one exception: when a message is
43437 received, the envelope sender is always rewritten first, before any header
43438 lines are rewritten. For example, the replacement string for a rewrite of an
43439 address in <emphasis>To:</emphasis> must not assume that the message’s address in <emphasis>From:</emphasis> has
43440 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
43441 that the envelope sender has already been rewritten.
43444 <indexterm role="variable">
43445 <primary><varname>$domain</varname></primary>
43447 <indexterm role="variable">
43448 <primary><varname>$local_part</varname></primary>
43450 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
43451 string to refer to the address that is being rewritten. Note that lookup-driven
43452 rewriting can be done by a rule of the form
43454 <literallayout class="monospaced">
43458 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
43459 refer to the address that is being rewritten.
43462 <section id="SECID151">
43463 <title>Rewriting patterns</title>
43465 <indexterm role="concept">
43466 <primary>rewriting</primary>
43467 <secondary>patterns</secondary>
43469 <indexterm role="concept">
43470 <primary>address list</primary>
43471 <secondary>in a rewriting pattern</secondary>
43473 The source pattern in a rewriting rule is any item which may appear in an
43474 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
43475 single-item address list, which means that it is expanded before being tested
43476 against the address. As always, if you use a regular expression as a pattern,
43477 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
43478 facility to suppress string expansion within the regular expression.
43481 Domains in patterns should be given in lower case. Local parts in patterns are
43482 case-sensitive. If you want to do case-insensitive matching of local parts, you
43483 can use a regular expression that starts with <literal>^(?i)</literal>.
43486 <indexterm role="concept">
43487 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
43488 <secondary>in rewriting rules</secondary>
43490 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
43491 depending on the type of match which occurred. These can be used in the
43492 replacement string to insert portions of the incoming address. <varname>$0</varname> always
43493 refers to the complete incoming address. When a regular expression is used, the
43494 numerical variables are set from its capturing subexpressions. For other types
43495 of pattern they are set as follows:
43500 If a local part or domain starts with an asterisk, the numerical variables
43501 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
43502 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
43505 <literallayout class="monospaced">
43506 *queen@*.fict.example
43509 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
43511 <literallayout class="monospaced">
43512 $0 = hearts-queen@wonderland.fict.example
43517 Note that if the local part does not start with an asterisk, but the domain
43518 does, it is <varname>$1</varname> that contains the wild part of the domain.
43523 If the domain part of the pattern is a partial lookup, the wild and fixed parts
43524 of the domain are placed in the next available numerical variables. Suppose,
43525 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
43526 rewriting rule of the form
43529 <literal>*@partial-dbm;/some/dbm/file</literal> <<emphasis>replacement string</emphasis>>
43532 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
43534 <literallayout class="monospaced">
43540 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
43541 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
43542 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
43543 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
43544 whole domain. For non-partial domain lookups, no numerical variables are set.
43549 <section id="SECID152">
43550 <title>Rewriting replacements</title>
43552 <indexterm role="concept">
43553 <primary>rewriting</primary>
43554 <secondary>replacements</secondary>
43556 If the replacement string for a rule is a single asterisk, addresses that
43557 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
43558 rewriting rules are scanned. For example,
43560 <literallayout class="monospaced">
43561 hatta@lookingglass.fict.example * f
43564 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
43565 <emphasis>From:</emphasis> headers.
43568 <indexterm role="variable">
43569 <primary><varname>$domain</varname></primary>
43571 <indexterm role="variable">
43572 <primary><varname>$local_part</varname></primary>
43574 If the replacement string is not a single asterisk, it is expanded, and must
43575 yield a fully qualified address. Within the expansion, the variables
43576 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
43577 Any letters they contain retain their original case – they are not lower
43578 cased. The numerical variables are set up according to the type of pattern that
43579 matched the address, as described above. If the expansion is forced to fail by
43580 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
43581 current rule is abandoned, but subsequent rules may take effect. Any other
43582 expansion failure causes the entire rewriting operation to be abandoned, and an
43583 entry written to the panic log.
43586 <section id="SECID153">
43587 <title>Rewriting flags</title>
43589 There are three different kinds of flag that may appear on rewriting rules:
43594 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
43600 A flag that specifies rewriting at SMTP time: S.
43605 Flags that control the rewriting process: Q, q, R, w.
43610 For rules that are part of the <option>headers_rewrite</option> generic transport option,
43611 E, F, T, and S are not permitted.
43614 <section id="SECID154">
43615 <title>Flags specifying which headers and envelope addresses to rewrite</title>
43617 <indexterm role="concept">
43618 <primary>rewriting</primary>
43619 <secondary>flags</secondary>
43621 If none of the following flag letters, nor the <quote>S</quote> flag (see section
43622 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
43623 and to both the sender and recipient fields of the envelope, whereas a
43624 transport-time rewriting rule just applies to all headers. Otherwise, the
43625 rewriting rule is skipped unless the relevant addresses are being processed.
43628 <literal>E</literal> rewrite all envelope fields
43629 <literal>F</literal> rewrite the envelope From field
43630 <literal>T</literal> rewrite the envelope To field
43631 <literal>b</literal> rewrite the <emphasis>Bcc:</emphasis> header
43632 <literal>c</literal> rewrite the <emphasis>Cc:</emphasis> header
43633 <literal>f</literal> rewrite the <emphasis>From:</emphasis> header
43634 <literal>h</literal> rewrite all headers
43635 <literal>r</literal> rewrite the <emphasis>Reply-To:</emphasis> header
43636 <literal>s</literal> rewrite the <emphasis>Sender:</emphasis> header
43637 <literal>t</literal> rewrite the <emphasis>To:</emphasis> header
43640 "All headers" means all of the headers listed above that can be selected
43641 individually, plus their <emphasis>Resent-</emphasis> versions. It does not include
43642 other headers such as <emphasis>Subject:</emphasis> etc.
43645 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
43646 restrict this to special known cases in your own domains.
43649 <section id="SECTrewriteS">
43650 <title>The SMTP-time rewriting flag</title>
43652 <indexterm role="concept">
43653 <primary>SMTP</primary>
43654 <secondary>rewriting malformed addresses</secondary>
43656 <indexterm role="concept">
43657 <primary>RCPT</primary>
43658 <secondary>rewriting argument of</secondary>
43660 <indexterm role="concept">
43661 <primary>MAIL</primary>
43662 <secondary>rewriting argument of</secondary>
43664 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
43665 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
43666 before any other processing; even before syntax checking. The pattern is
43667 required to be a regular expression, and it is matched against the whole of the
43668 data for the command, including any surrounding angle brackets.
43671 <indexterm role="variable">
43672 <primary><varname>$domain</varname></primary>
43674 <indexterm role="variable">
43675 <primary><varname>$local_part</varname></primary>
43677 This form of rewrite rule allows for the handling of addresses that are not
43678 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
43679 input). Because the input is not required to be a syntactically valid address,
43680 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
43681 expansion of the replacement string. The result of rewriting replaces the
43682 original address in the MAIL or RCPT command.
43685 <section id="SECID155">
43686 <title>Flags controlling the rewriting process</title>
43688 There are four flags which control the way the rewriting process works. These
43689 take effect only when a rule is invoked, that is, when the address is of the
43690 correct type (matches the flags) and matches the pattern:
43695 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
43696 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
43697 absence of <quote>Q</quote> the rewritten address must always include a domain.
43702 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
43703 even if no rewriting actually takes place because of a <quote>fail</quote> in the
43704 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
43705 (does not match the flags) or does not match the pattern.
43710 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
43711 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
43712 rewriting once it fails to match (after at least one successful rewrite).
43717 <indexterm role="concept">
43718 <primary>rewriting</primary>
43719 <secondary>whole addresses</secondary>
43721 When an address in a header is rewritten, the rewriting normally applies only
43722 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
43723 left unchanged. For example, rewriting might change
43725 <literallayout class="monospaced">
43726 From: Ford Prefect <fp42@restaurant.hitch.fict.example>
43731 <literallayout class="monospaced">
43732 From: Ford Prefect <prefectf@hitch.fict.example>
43735 <indexterm role="concept">
43736 <primary>RFC 2047</primary>
43738 Sometimes there is a need to replace the whole address item, and this can be
43739 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
43740 causes an address in a header line to be rewritten, the entire address is
43741 replaced, not just the working part. The replacement must be a complete RFC
43742 2822 address, including the angle brackets if necessary. If text outside angle
43743 brackets contains a character whose value is greater than 126 or less than 32
43744 (except for tab), the text is encoded according to RFC 2047. The character set
43745 is taken from <option>headers_charset</option>, which defaults to ISO-8859-1.
43748 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
43749 rewritten, all but the working part of the replacement address is discarded.
43754 <section id="SECID156">
43755 <title>Rewriting examples</title>
43757 Here is an example of the two common rewriting paradigms:
43759 <literallayout class="monospaced">
43760 *@*.hitch.fict.example $1@hitch.fict.example
43761 *@hitch.fict.example ${lookup{$1}dbm{/etc/realnames}\
43762 {$value}fail}@hitch.fict.example bctfrF
43765 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
43766 the string expansion to fail if the lookup does not succeed. In this context it
43767 has the effect of leaving the original address unchanged, but Exim goes on to
43768 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
43769 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
43770 explicitly, which would cause the rewritten address to be the same as before,
43771 at the cost of a small bit of processing. Not supplying either of these is an
43772 error, since the rewritten address would then contain no local part.
43775 The first example above replaces the domain with a superior, more general
43776 domain. This may not be desirable for certain local parts. If the rule
43778 <literallayout class="monospaced">
43779 root@*.hitch.fict.example *
43782 were inserted before the first rule, rewriting would be suppressed for the
43783 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
43786 Rewriting can be made conditional on a number of tests, by making use of
43787 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
43788 messages that originate outside the local host:
43790 <literallayout class="monospaced">
43791 *@*.hitch.fict.example "${if !eq {$sender_host_address}{}\
43792 {$1@hitch.fict.example}fail}"
43795 The replacement string is quoted in this example because it contains white
43799 <indexterm role="concept">
43800 <primary>rewriting</primary>
43801 <secondary>bang paths</secondary>
43803 <indexterm role="concept">
43804 <primary>bang paths</primary>
43805 <secondary>rewriting</secondary>
43807 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
43808 an address it treats it as an unqualified local part which it qualifies with
43809 the local qualification domain (if the source of the message is local or if the
43810 remote host is permitted to send unqualified addresses). Rewriting can
43811 sometimes be used to handle simple bang paths with a fixed number of
43812 components. For example, the rule
43814 <literallayout class="monospaced">
43815 \N^([^!]+)!(.*)@your.domain.example$\N $2@$1
43818 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
43819 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
43820 a global rewriting rule for envelope addresses. It can provide a backdoor
43821 method for using your system as a relay, because the incoming addresses appear
43822 to be local. If the bang path addresses are received via SMTP, it is safer to
43823 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
43824 can be done on the rewritten addresses.
43825 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
43830 <chapter id="CHAPretry">
43831 <title>Retry configuration</title>
43833 <indexterm role="concept" id="IIDretconf1" class="startofrange">
43834 <primary>retry</primary>
43835 <secondary>configuration, description of</secondary>
43837 <indexterm role="concept" id="IIDregconf2" class="startofrange">
43838 <primary>configuration file</primary>
43839 <secondary>retry section</secondary>
43841 The <quote>retry</quote> section of the runtime configuration file contains a list of
43842 retry rules that control how often Exim tries to deliver messages that cannot
43843 be delivered at the first attempt. If there are no retry rules (the section is
43844 empty or not present), there are no retries. In this situation, temporary
43845 errors are treated as permanent. The default configuration contains a single,
43846 general-purpose retry rule (see section <xref linkend="SECID57"/>). The <option>-brt</option> command
43847 line option can be used to test which retry rule will be used for a given
43848 address, domain and error.
43851 The most common cause of retries is temporary failure to deliver to a remote
43852 host because the host is down, or inaccessible because of a network problem.
43853 Exim’s retry processing in this case is applied on a per-host (strictly, per IP
43854 address) basis, not on a per-message basis. Thus, if one message has recently
43855 been delayed, delivery of a new message to the same host is not immediately
43856 tried, but waits for the host’s retry time to arrive. If the <option>retry_defer</option>
43857 log selector is set, the message
43858 <indexterm role="concept">
43859 <primary>retry</primary>
43860 <secondary>time not reached</secondary>
43862 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
43863 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
43864 the handling of errors during remote deliveries.
43867 Retry processing applies to routing as well as to delivering, except as covered
43868 in the next paragraph. The retry rules do not distinguish between these
43869 actions. It is not possible, for example, to specify different behaviour for
43870 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
43871 the host <emphasis>snark.fict.example</emphasis>. I didn’t think anyone would ever need this
43872 added complication, so did not implement it. However, although they share the
43873 same retry rule, the actual retry times for routing and transporting a given
43874 domain are maintained independently.
43877 When a delivery is not part of a queue run (typically an immediate delivery on
43878 receipt of a message), the routers are always run, and local deliveries are
43879 always attempted, even if retry times are set for them. This makes for better
43880 behaviour if one particular message is causing problems (for example, causing
43881 quota overflow, or provoking an error in a filter file). If such a delivery
43882 suffers a temporary failure, the retry data is updated as normal, and
43883 subsequent delivery attempts from queue runs occur only when the retry time for
43884 the local address is reached.
43886 <section id="SECID157">
43887 <title>Changing retry rules</title>
43889 If you change the retry rules in your configuration, you should consider
43890 whether or not to delete the retry data that is stored in Exim’s spool area in
43891 files with names like <filename>db/retry</filename>. Deleting any of Exim’s hints files is
43892 always safe; that is why they are called <quote>hints</quote>.
43895 The hints retry data contains suggested retry times based on the previous
43896 rules. In the case of a long-running problem with a remote host, it might
43897 record the fact that the host has timed out. If your new rules increase the
43898 timeout time for such a host, you should definitely remove the old retry data
43899 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
43900 messages that it should now be retaining.
43903 <section id="SECID158">
43904 <title>Format of retry rules</title>
43906 <indexterm role="concept">
43907 <primary>retry</primary>
43908 <secondary>rules</secondary>
43910 Each retry rule occupies one line and consists of three or four parts,
43911 separated by white space: a pattern, an error name, an optional list of sender
43912 addresses, and a list of retry parameters. The pattern and sender lists must be
43913 enclosed in double quotes if they contain white space. The rules are searched
43914 in order until one is found where the pattern, error name, and sender list (if
43915 present) match the failing host or address, the error that occurred, and the
43916 message’s sender, respectively.
43919 The pattern is any single item that may appear in an address list (see section
43920 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
43921 which means that it is expanded before being tested against the address that
43922 has been delayed. A negated address list item is permitted. Address
43923 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
43924 which makes it possible for many retry rules to start with just a domain. For
43927 <literallayout class="monospaced">
43928 lookingglass.fict.example * F,24h,30m;
43931 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
43934 <literallayout class="monospaced">
43935 alice@lookingglass.fict.example * F,24h,30m;
43938 applies only to temporary failures involving the local part <option>alice</option>.
43939 In practice, almost all rules start with a domain name pattern without a local
43943 <indexterm role="concept">
43944 <primary>regular expressions</primary>
43945 <secondary>in retry rules</secondary>
43947 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a routing rule pattern, it
43948 must match a complete address, not just a domain, because that is how regular
43949 expressions work in address lists.
43952 <literal>^\Nxyz\d+\.abc\.example$\N * G,1h,10m,2</literal> <option>Wrong</option>
43953 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N * G,1h,10m,2</literal> <option>Right</option>
43956 <section id="SECID159">
43957 <title>Choosing which retry rule to use for address errors</title>
43959 When Exim is looking for a retry rule after a routing attempt has failed (for
43960 example, after a DNS timeout), each line in the retry configuration is tested
43961 against the complete address only if <option>retry_use_local_part</option> is set for the
43962 router. Otherwise, only the domain is used, except when matching against a
43963 regular expression, when the local part of the address is replaced with <quote>*</quote>.
43964 A domain on its own can match a domain pattern, or a pattern that starts with
43965 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
43966 <option>check_local_user</option> is true, and false for other routers.
43969 Similarly, when Exim is looking for a retry rule after a local delivery has
43970 failed (for example, after a mailbox full error), each line in the retry
43971 configuration is tested against the complete address only if
43972 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
43976 <indexterm role="concept">
43977 <primary>4<emphasis>xx</emphasis> responses</primary>
43978 <secondary>retry rules for</secondary>
43980 However, when Exim is looking for a retry rule after a remote delivery attempt
43981 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
43982 whole address is always used as the key when searching the retry rules. The
43983 rule that is found is used to create a retry time for the combination of the
43984 failing address and the message’s sender. It is the combination of sender and
43985 recipient that is delayed in subsequent queue runs until its retry time is
43986 reached. You can delay the recipient without regard to the sender by setting
43987 <option>address_retry_include_sender</option> false in the <command>smtp</command> transport but this can
43988 lead to problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT
43992 <section id="SECID160">
43993 <title>Choosing which retry rule to use for host and message errors</title>
43995 For a temporary error that is not related to an individual address (for
43996 example, a connection timeout), each line in the retry configuration is checked
43997 twice. First, the name of the remote host is used as a domain name (preceded by
43998 <quote>*@</quote> when matching a regular expression). If this does not match the line,
43999 the domain from the email address is tried in a similar fashion. For example,
44000 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
44002 <literallayout class="monospaced">
44003 a.b.c.example MX 5 x.y.z.example
44008 and the retry rules are
44010 <literallayout class="monospaced">
44011 p.q.r.example * F,24h,30m;
44012 a.b.c.example * F,4d,45m;
44015 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
44016 first rule matches neither the host nor the domain, so Exim looks at the second
44017 rule. This does not match the host, but it does match the domain, so it is used
44018 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
44019 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
44020 first retry rule is used, because it matches the host.
44023 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
44024 first rule to determine retry times, but for all the other hosts for the domain
44025 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
44026 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
44029 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
44030 However, if a message is routed directly to an IP address without the use of a
44031 host name, for example, if a <command>manualroute</command> router contains a setting such as:
44033 <literallayout class="monospaced">
44034 route_list = *.a.example 192.168.34.23
44037 then the <quote>host name</quote> that is used when searching for a retry rule is the
44038 textual form of the IP address.
44041 <section id="SECID161">
44042 <title>Retry rules for specific errors</title>
44044 <indexterm role="concept">
44045 <primary>retry</primary>
44046 <secondary>specific errors; specifying</secondary>
44048 The second field in a retry rule is the name of a particular error, or an
44049 asterisk, which matches any error. The errors that can be tested for are:
44053 <term><option>auth_failed</option></term>
44056 Authentication failed when trying to send to a host in the
44057 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
44059 </listitem></varlistentry>
44061 <term><option>data_4xx</option></term>
44064 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
44065 after the command, or after sending the message’s data.
44067 </listitem></varlistentry>
44069 <term><option>mail_4xx</option></term>
44072 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
44074 </listitem></varlistentry>
44076 <term><option>rcpt_4xx</option></term>
44079 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
44081 </listitem></varlistentry>
44084 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x’s can be given
44085 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
44086 recognize 452 errors given to RCPT commands for addresses in a certain domain,
44087 and have retries every ten minutes with a one-hour timeout, you could set up a
44088 retry rule of this form:
44090 <literallayout class="monospaced">
44091 the.domain.name rcpt_452 F,1h,10m
44094 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
44095 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
44099 <term><option>lost_connection</option></term>
44102 A server unexpectedly closed the SMTP connection. There may, of course,
44103 legitimate reasons for this (host died, network died), but if it repeats a lot
44104 for the same host, it indicates something odd.
44106 </listitem></varlistentry>
44108 <term><option>refused_MX</option></term>
44111 A connection to a host obtained from an MX record was refused.
44113 </listitem></varlistentry>
44115 <term><option>refused_A</option></term>
44118 A connection to a host not obtained from an MX record was refused.
44120 </listitem></varlistentry>
44122 <term><option>refused</option></term>
44125 A connection was refused.
44127 </listitem></varlistentry>
44129 <term><option>timeout_connect_MX</option></term>
44132 A connection attempt to a host obtained from an MX record timed out.
44134 </listitem></varlistentry>
44136 <term><option>timeout_connect_A</option></term>
44139 A connection attempt to a host not obtained from an MX record timed out.
44141 </listitem></varlistentry>
44143 <term><option>timeout_connect</option></term>
44146 A connection attempt timed out.
44148 </listitem></varlistentry>
44150 <term><option>timeout_MX</option></term>
44153 There was a timeout while connecting or during an SMTP session with a host
44154 obtained from an MX record.
44156 </listitem></varlistentry>
44158 <term><option>timeout_A</option></term>
44161 There was a timeout while connecting or during an SMTP session with a host not
44162 obtained from an MX record.
44164 </listitem></varlistentry>
44166 <term><option>timeout</option></term>
44169 There was a timeout while connecting or during an SMTP session.
44171 </listitem></varlistentry>
44173 <term><option>tls_required</option></term>
44176 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
44177 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
44178 to STARTTLS, or there was a problem setting up the TLS connection.
44180 </listitem></varlistentry>
44182 <term><option>quota</option></term>
44185 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
44188 </listitem></varlistentry>
44190 <term><option>quota_</option><<emphasis>time</emphasis>></term>
44193 <indexterm role="concept">
44194 <primary>quota</primary>
44195 <secondary>error testing in retry rule</secondary>
44197 <indexterm role="concept">
44198 <primary>retry</primary>
44199 <secondary>quota error testing</secondary>
44201 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
44202 transport, and the mailbox has not been accessed for <<emphasis>time</emphasis>>. For example,
44203 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
44206 </listitem></varlistentry>
44209 <indexterm role="concept">
44210 <primary>mailbox</primary>
44211 <secondary>time of last read</secondary>
44213 The idea of <option>quota_</option><<emphasis>time</emphasis>> is to make it possible to have shorter
44214 timeouts when the mailbox is full and is not being read by its owner. Ideally,
44215 it should be based on the last time that the user accessed the mailbox.
44216 However, it is not always possible to determine this. Exim uses the following
44222 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
44223 used. As no new messages are being delivered (because the mailbox is over
44224 quota), Exim does not access the file, so this is the time of last user access.
44229 <indexterm role="concept">
44230 <primary>maildir format</primary>
44231 <secondary>time of last read</secondary>
44233 For a maildir delivery, the time of last modification of the <filename>new</filename>
44234 subdirectory is used. As the mailbox is over quota, no new files are created in
44235 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
44236 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
44237 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
44238 time that is used is therefore the last time that the user read a new message.
44243 For other kinds of multi-file mailbox, the time of last access cannot be
44244 obtained, so a retry rule that uses this type of error field is never matched.
44249 The quota errors apply both to system-enforced quotas and to Exim’s own quota
44250 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
44251 when a local delivery is deferred because a partition is full (the ENOSPC
44255 <section id="SECID162">
44256 <title>Retry rules for specified senders</title>
44258 <indexterm role="concept">
44259 <primary>retry</primary>
44260 <secondary>rules; sender-specific</secondary>
44262 You can specify retry rules that apply only when the failing message has a
44263 specific sender. In particular, this can be used to define retry rules that
44264 apply only to bounce messages. The third item in a retry rule can be of this
44268 <literal>senders=</literal><<emphasis>address list</emphasis>>
44271 The retry timings themselves are then the fourth item. For example:
44273 <literallayout class="monospaced">
44274 * rcpt_4xx senders=: F,1h,30m
44277 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
44278 host. If the address list contains white space, it must be enclosed in quotes.
44281 <literallayout class="monospaced">
44282 a.domain rcpt_452 senders="xb.dom : yc.dom" G,8h,10m,1.5
44285 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
44286 (which do not depend on the recipient). The reason is that the sender is used
44287 only to match the retry rule. Once the rule has been found for a host error,
44288 its contents are used to set a retry time for the host, and this will apply to
44289 all messages, not just those with specific senders.
44292 When testing retry rules using <option>-brt</option>, you can supply a sender using the
44293 <option>-f</option> command line option, like this:
44295 <literallayout class="monospaced">
44296 exim -f "" -brt user@dom.ain
44299 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
44300 list is never matched.
44303 <section id="SECID163">
44304 <title>Retry parameters</title>
44306 <indexterm role="concept">
44307 <primary>retry</primary>
44308 <secondary>parameters in rules</secondary>
44310 The third (or fourth, if a senders list is present) field in a retry rule is a
44311 sequence of retry parameter sets, separated by semicolons. Each set consists of
44314 <<emphasis>letter</emphasis>>,<<emphasis>cutoff time</emphasis>>,<<emphasis>arguments</emphasis>>
44317 The letter identifies the algorithm for computing a new retry time; the cutoff
44318 time is the time beyond which this algorithm no longer applies, and the
44319 arguments vary the algorithm’s action. The cutoff time is measured from the
44320 time that the first failure for the domain (combined with the local part if
44321 relevant) was detected, not from the time the message was received.
44324 <indexterm role="concept">
44325 <primary>retry</primary>
44326 <secondary>algorithms</secondary>
44328 <indexterm role="concept">
44329 <primary>retry</primary>
44330 <secondary>fixed intervals</secondary>
44332 <indexterm role="concept">
44333 <primary>retry</primary>
44334 <secondary>increasing intervals</secondary>
44336 <indexterm role="concept">
44337 <primary>retry</primary>
44338 <secondary>random intervals</secondary>
44340 The available algorithms are:
44345 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
44351 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
44352 specifies a starting value for the interval, and the second a multiplier, which
44353 is used to increase the size of the interval at each retry.
44358 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
44359 retry, the previous interval is multiplied by the factor in order to get a
44360 maximum for the next interval. The minimum interval is the first argument of
44361 the parameter, and an actual interval is chosen randomly between them. Such a
44362 rule has been found to be helpful in cluster configurations when all the
44363 members of the cluster restart at once, and may therefore synchronize their
44364 queue processing times.
44369 When computing the next retry time, the algorithm definitions are scanned in
44370 order until one whose cutoff time has not yet passed is reached. This is then
44371 used to compute a new retry time that is later than the current time. In the
44372 case of fixed interval retries, this simply means adding the interval to the
44373 current time. For geometrically increasing intervals, retry intervals are
44374 computed from the rule’s parameters until one that is greater than the previous
44375 interval is found. The main configuration variable
44376 <indexterm role="concept">
44377 <primary>limit</primary>
44378 <secondary>retry interval</secondary>
44380 <indexterm role="concept">
44381 <primary>retry</primary>
44382 <secondary>interval, maximum</secondary>
44384 <indexterm role="option">
44385 <primary><option>retry_interval_max</option></primary>
44387 <option>retry_interval_max</option> limits the maximum interval between retries. It
44388 cannot be set greater than <literal>24h</literal>, which is its default value.
44391 A single remote domain may have a number of hosts associated with it, and each
44392 host may have more than one IP address. Retry algorithms are selected on the
44393 basis of the domain name, but are applied to each IP address independently. If,
44394 for example, a host has two IP addresses and one is unusable, Exim will
44395 generate retry times for it and will not try to use it until its next retry
44396 time comes. Thus the good IP address is likely to be tried first most of the
44400 <indexterm role="concept">
44401 <primary>hints database</primary>
44402 <secondary>use for retrying</secondary>
44404 Retry times are hints rather than promises. Exim does not make any attempt to
44405 run deliveries exactly at the computed times. Instead, a queue runner process
44406 starts delivery processes for delayed messages periodically, and these attempt
44407 new deliveries only for those addresses that have passed their next retry time.
44408 If a new message arrives for a deferred address, an immediate delivery attempt
44409 occurs only if the address has passed its retry time. In the absence of new
44410 messages, the minimum time between retries is the interval between queue runner
44411 processes. There is not much point in setting retry times of five minutes if
44412 your queue runners happen only once an hour, unless there are a significant
44413 number of incoming messages (which might be the case on a system that is
44414 sending everything to a smart host, for example).
44417 The data in the retry hints database can be inspected by using the
44418 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
44419 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
44420 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
44421 are for the hosts associated with a particular mail domain, and also for local
44422 deliveries that have been deferred.
44425 <section id="SECID164">
44426 <title>Retry rule examples</title>
44428 Here are some example retry rules:
44430 <literallayout class="monospaced">
44431 alice@wonderland.fict.example quota_5d F,7d,3h
44432 wonderland.fict.example quota_5d
44433 wonderland.fict.example * F,1h,15m; G,2d,1h,2;
44434 lookingglass.fict.example * F,24h,30m;
44435 * refused_A F,2h,20m;
44436 * * F,2h,15m; G,16h,1h,1.5; F,5d,8h
44439 The first rule sets up special handling for mail to
44440 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
44441 mailbox has not been read for at least 5 days. Retries continue every three
44442 hours for 7 days. The second rule handles over-quota errors for all other local
44443 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
44444 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
44445 fail are bounced immediately if the mailbox has not been read for at least 5
44449 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
44450 happen every 15 minutes for an hour, then with geometrically increasing
44451 intervals until two days have passed since a delivery first failed. After the
44452 first hour there is a delay of one hour, then two hours, then four hours, and
44453 so on (this is a rather extreme example).
44456 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
44457 They happen every 30 minutes for 24 hours only. The remaining two rules handle
44458 all other domains, with special action for connection refusal from hosts that
44459 were not obtained from an MX record.
44462 The final rule in a retry configuration should always have asterisks in the
44463 first two fields so as to provide a general catch-all for any addresses that do
44464 not have their own special handling. This example tries every 15 minutes for 2
44465 hours, then with intervals starting at one hour and increasing by a factor of
44466 1.5 up to 16 hours, then every 8 hours up to 5 days.
44469 <section id="SECID165">
44470 <title>Timeout of retry data</title>
44472 <indexterm role="concept">
44473 <primary>timeout</primary>
44474 <secondary>of retry data</secondary>
44476 <indexterm role="option">
44477 <primary><option>retry_data_expire</option></primary>
44479 <indexterm role="concept">
44480 <primary>hints database</primary>
44481 <secondary>data expiry</secondary>
44483 <indexterm role="concept">
44484 <primary>retry</primary>
44485 <secondary>timeout of data</secondary>
44487 Exim timestamps the data that it writes to its retry hints database. When it
44488 consults the data during a delivery it ignores any that is older than the value
44489 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn’t
44490 been tried for 7 days, Exim will try to deliver to it immediately a message
44491 arrives, and if that fails, it will calculate a retry time as if it were
44492 failing for the first time.
44495 This improves the behaviour for messages routed to rarely-used hosts such as MX
44496 backups. If such a host was down at one time, and happens to be down again when
44497 Exim tries a month later, using the old retry data would imply that it had been
44498 down all the time, which is not a justified assumption.
44501 If a host really is permanently dead, this behaviour causes a burst of retries
44502 every now and again, but only if messages routed to it are rare. If there is a
44503 message at least once every 7 days the retry data never expires.
44506 <section id="SECID166">
44507 <title>Long-term failures</title>
44509 <indexterm role="concept">
44510 <primary>delivery failure, long-term</primary>
44512 <indexterm role="concept">
44513 <primary>retry</primary>
44514 <secondary>after long-term failure</secondary>
44516 Special processing happens when an email address has been failing for so long
44517 that the cutoff time for the last algorithm is reached. For example, using the
44518 default retry rule:
44520 <literallayout class="monospaced">
44521 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
44524 the cutoff time is four days. Reaching the retry cutoff is independent of how
44525 long any specific message has been failing; it is the length of continuous
44526 failure for the recipient address that counts.
44529 When the cutoff time is reached for a local delivery, or for all the IP
44530 addresses associated with a remote delivery, a subsequent delivery failure
44531 causes Exim to give up on the address, and a bounce message is generated.
44532 In order to cater for new messages that use the failing address, a next retry
44533 time is still computed from the final algorithm, and is used as follows:
44536 For local deliveries, one delivery attempt is always made for any subsequent
44537 messages. If this delivery fails, the address fails immediately. The
44538 post-cutoff retry time is not used.
44541 If the delivery is remote, there are two possibilities, controlled by the
44542 <indexterm role="option">
44543 <primary><option>delay_after_cutoff</option></primary>
44545 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
44546 default. Until the post-cutoff retry time for one of the IP addresses is
44547 reached, the failing email address is bounced immediately, without a delivery
44548 attempt taking place. After that time, one new delivery attempt is made to
44549 those IP addresses that are past their retry times, and if that still fails,
44550 the address is bounced and new retry times are computed.
44553 In other words, when all the hosts for a given email address have been failing
44554 for a long time, Exim bounces rather then defers until one of the hosts’ retry
44555 times is reached. Then it tries once, and bounces if that attempt fails. This
44556 behaviour ensures that few resources are wasted in repeatedly trying to deliver
44557 to a broken destination, but if the host does recover, Exim will eventually
44561 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
44562 addresses are past their final cutoff time, Exim tries to deliver to those IP
44563 addresses that have not been tried since the message arrived. If there are
44564 no suitable IP addresses, or if they all fail, the address is bounced. In other
44565 words, it does not delay when a new message arrives, but tries the expired
44566 addresses immediately, unless they have been tried since the message arrived.
44567 If there is a continuous stream of messages for the failing domains, setting
44568 <option>delay_after_cutoff</option> false means that there will be many more attempts to
44569 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
44573 <section id="SECID167">
44574 <title>Deliveries that work intermittently</title>
44576 <indexterm role="concept">
44577 <primary>retry</primary>
44578 <secondary>intermittently working deliveries</secondary>
44580 Some additional logic is needed to cope with cases where a host is
44581 intermittently available, or when a message has some attribute that prevents
44582 its delivery when others to the same address get through. In this situation,
44583 because some messages are successfully delivered, the <quote>retry clock</quote> for the
44584 host or address keeps getting reset by the successful deliveries, and so
44585 failing messages remain on the queue for ever because the cutoff time is never
44589 Two exceptional actions are applied to prevent this happening. The first
44590 applies to errors that are related to a message rather than a remote host.
44591 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
44592 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
44593 commands, and quota failures. For this type of error, if a message’s arrival
44594 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
44595 is used when scanning the retry rules to decide when to try next and when to
44596 time out the address.
44599 The exceptional second action applies in all cases. If a message has been on
44600 the queue for longer than the cutoff time of any applicable retry rule for a
44601 given address, a delivery is attempted for that address, even if it is not yet
44602 time, and if this delivery fails, the address is timed out. A new retry time is
44603 not computed in this case, so that other messages for the same address are
44604 considered immediately.
44605 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
44606 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
44611 <chapter id="CHAPSMTPAUTH">
44612 <title>SMTP authentication</title>
44614 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
44615 <primary>SMTP</primary>
44616 <secondary>authentication configuration</secondary>
44618 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
44619 <primary>authentication</primary>
44621 The <quote>authenticators</quote> section of Exim’s run time configuration is concerned
44622 with SMTP authentication. This facility is an extension to the SMTP protocol,
44623 described in RFC 2554, which allows a client SMTP host to authenticate itself
44624 to a server. This is a common way for a server to recognize clients that are
44625 permitted to use it as a relay. SMTP authentication is not of relevance to the
44626 transfer of mail between servers that have no managerial connection with each
44630 <indexterm role="concept">
44631 <primary>AUTH</primary>
44632 <secondary>description of</secondary>
44634 Very briefly, the way SMTP authentication works is as follows:
44639 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
44640 the client’s EHLO command.
44645 The client issues an AUTH command, naming a specific mechanism. The command
44646 may, optionally, contain some authentication data.
44651 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
44652 appropriate responses. In simple authentication mechanisms, the challenges are
44653 just prompts for user names and passwords. The server does not have to issue
44654 any challenges – in some mechanisms the relevant data may all be transmitted
44655 with the AUTH command.
44660 The server either accepts or denies authentication.
44665 If authentication succeeds, the client may optionally make use of the AUTH
44666 option on the MAIL command to pass an authenticated sender in subsequent
44667 mail transactions. Authentication lasts for the remainder of the SMTP
44673 If authentication fails, the client may give up, or it may try a different
44674 authentication mechanism, or it may try transferring mail over the
44675 unauthenticated connection.
44680 If you are setting up a client, and want to know which authentication
44681 mechanisms the server supports, you can use Telnet to connect to port 25 (the
44682 SMTP port) on the server, and issue an EHLO command. The response to this
44683 includes the list of supported mechanisms. For example:
44686 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
44687 <literal>Trying 192.168.34.25...</literal>
44688 <literal>Connected to server.example.</literal>
44689 <literal>Escape character is '^]'.</literal>
44690 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
44691 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
44692 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
44693 <literal>250-SIZE 52428800</literal>
44694 <literal>250-PIPELINING</literal>
44695 <literal>250-AUTH PLAIN</literal>
44696 <literal>250 HELP</literal>
44699 The second-last line of this example output shows that the server supports
44700 authentication using the PLAIN mechanism. In Exim, the different authentication
44701 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
44702 routers and transports, which authenticators are included in the binary is
44703 controlled by build-time definitions. The following are currently available,
44704 included by setting
44706 <literallayout class="monospaced">
44708 AUTH_CYRUS_SASL=yes
44713 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
44714 authentication mechanism (RFC 2195), and the second provides an interface to
44715 the Cyrus SASL authentication library. The third can be configured to support
44716 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
44717 not formally documented, but used by several MUAs. The fourth authenticator
44718 supports Microsoft’s <emphasis>Secure Password Authentication</emphasis> mechanism.
44721 The authenticators are configured using the same syntax as other drivers (see
44722 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
44723 authentication section need be present in the configuration file. Each
44724 authenticator can in principle have both server and client functions. When Exim
44725 is receiving SMTP mail, it is acting as a server; when it is sending out
44726 messages over SMTP, it is acting as a client. Authenticator configuration
44727 options are provided for use in both these circumstances.
44730 To make it clear which options apply to which situation, the prefixes
44731 <option>server_</option> and <option>client_</option> are used on option names that are specific to
44732 either the server or the client function, respectively. Server and client
44733 functions are disabled if none of their options are set. If an authenticator is
44734 to be used for both server and client functions, a single definition, using
44735 both sets of options, is required. For example:
44737 <literallayout class="monospaced">
44740 public_name = CRAM-MD5
44741 server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
44743 client_secret = secret2
44746 The <option>server_</option> option is used when Exim is acting as a server, and the
44747 <option>client_</option> options when it is acting as a client.
44750 Descriptions of the individual authenticators are given in subsequent chapters.
44751 The remainder of this chapter covers the generic options for the
44752 authenticators, followed by general discussion of the way authentication works
44755 <section id="SECID168">
44756 <title>Generic options for authenticators</title>
44758 <indexterm role="concept">
44759 <primary>authentication</primary>
44760 <secondary>generic options</secondary>
44762 <indexterm role="concept">
44763 <primary>options</primary>
44764 <secondary>generic; for authenticators</secondary>
44768 <indexterm role="option">
44769 <primary><option>client_condition</option></primary>
44772 <informaltable frame="all">
44773 <tgroup cols="4" colsep="0" rowsep="0">
44774 <colspec colwidth="8*" align="left"/>
44775 <colspec colwidth="6*" align="center"/>
44776 <colspec colwidth="6*" align="center"/>
44777 <colspec colwidth="6*" align="right"/>
44780 <entry><option>client_condition</option></entry>
44781 <entry>Use: <emphasis>authenticators</emphasis></entry>
44782 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
44783 <entry>Default: <emphasis>unset</emphasis></entry>
44789 When Exim is authenticating as a client, it skips any authenticator whose
44790 <option>client_condition</option> expansion yields <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>. This can be
44791 used, for example, to skip plain text authenticators when the connection is not
44792 encrypted by a setting such as:
44794 <literallayout class="monospaced">
44795 client_condition = ${if !eq{$tls_cipher}{}}
44798 (Older documentation incorrectly states that <varname>$tls_cipher</varname> contains the cipher
44799 used for incoming messages. In fact, during SMTP delivery, it contains the
44800 cipher used for the delivery.)
44803 <indexterm role="option">
44804 <primary><option>driver</option></primary>
44807 <informaltable frame="all">
44808 <tgroup cols="4" colsep="0" rowsep="0">
44809 <colspec colwidth="8*" align="left"/>
44810 <colspec colwidth="6*" align="center"/>
44811 <colspec colwidth="6*" align="center"/>
44812 <colspec colwidth="6*" align="right"/>
44815 <entry><option>driver</option></entry>
44816 <entry>Use: <emphasis>authenticators</emphasis></entry>
44817 <entry>Type: <emphasis>string</emphasis></entry>
44818 <entry>Default: <emphasis>unset</emphasis></entry>
44824 This option must always be set. It specifies which of the available
44825 authenticators is to be used.
44828 <indexterm role="option">
44829 <primary><option>public_name</option></primary>
44832 <informaltable frame="all">
44833 <tgroup cols="4" colsep="0" rowsep="0">
44834 <colspec colwidth="8*" align="left"/>
44835 <colspec colwidth="6*" align="center"/>
44836 <colspec colwidth="6*" align="center"/>
44837 <colspec colwidth="6*" align="right"/>
44840 <entry><option>public_name</option></entry>
44841 <entry>Use: <emphasis>authenticators</emphasis></entry>
44842 <entry>Type: <emphasis>string</emphasis></entry>
44843 <entry>Default: <emphasis>unset</emphasis></entry>
44849 This option specifies the name of the authentication mechanism that the driver
44850 implements, and by which it is known to the outside world. These names should
44851 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
44852 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
44853 defaults to the driver’s instance name.
44856 <indexterm role="option">
44857 <primary><option>server_advertise_condition</option></primary>
44860 <informaltable frame="all">
44861 <tgroup cols="4" colsep="0" rowsep="0">
44862 <colspec colwidth="8*" align="left"/>
44863 <colspec colwidth="6*" align="center"/>
44864 <colspec colwidth="6*" align="center"/>
44865 <colspec colwidth="6*" align="right"/>
44868 <entry><option>server_advertise_condition</option></entry>
44869 <entry>Use: <emphasis>authenticators</emphasis></entry>
44870 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
44871 <entry>Default: <emphasis>unset</emphasis></entry>
44877 When a server is about to advertise an authentication mechanism, the condition
44878 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
44879 mechanism is not advertised.
44880 If the expansion fails, the mechanism is not advertised. If the failure was not
44881 forced, and was not caused by a lookup defer, the incident is logged.
44882 See section <xref linkend="SECTauthexiser"/> below for further discussion.
44885 <indexterm role="option">
44886 <primary><option>server_condition</option></primary>
44889 <informaltable frame="all">
44890 <tgroup cols="4" colsep="0" rowsep="0">
44891 <colspec colwidth="8*" align="left"/>
44892 <colspec colwidth="6*" align="center"/>
44893 <colspec colwidth="6*" align="center"/>
44894 <colspec colwidth="6*" align="right"/>
44897 <entry><option>server_condition</option></entry>
44898 <entry>Use: <emphasis>authenticators</emphasis></entry>
44899 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
44900 <entry>Default: <emphasis>unset</emphasis></entry>
44906 This option must be set for a <option>plaintext</option> server authenticator, where it
44907 is used directly to control authentication. See section <xref linkend="SECTplainserver"/>
44911 For the other authenticators, <option>server_condition</option> can be used as an additional
44912 authentication or authorization mechanism that is applied after the other
44913 authenticator conditions succeed. If it is set, it is expanded when the
44914 authenticator would otherwise return a success code. If the expansion is forced
44915 to fail, authentication fails. Any other expansion failure causes a temporary
44916 error code to be returned. If the result of a successful expansion is an empty
44917 string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
44918 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds. For any
44919 other result, a temporary error code is returned, with the expanded string as
44923 <indexterm role="option">
44924 <primary><option>server_debug_print</option></primary>
44927 <informaltable frame="all">
44928 <tgroup cols="4" colsep="0" rowsep="0">
44929 <colspec colwidth="8*" align="left"/>
44930 <colspec colwidth="6*" align="center"/>
44931 <colspec colwidth="6*" align="center"/>
44932 <colspec colwidth="6*" align="right"/>
44935 <entry><option>server_debug_print</option></entry>
44936 <entry>Use: <emphasis>authenticators</emphasis></entry>
44937 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
44938 <entry>Default: <emphasis>unset</emphasis></entry>
44944 If this option is set and authentication debugging is enabled (see the <option>-d</option>
44945 command line option), the string is expanded and included in the debugging
44946 output when the authenticator is run as a server. This can help with checking
44947 out the values of variables.
44948 If expansion of the string fails, the error message is written to the debugging
44949 output, and Exim carries on processing.
44952 <indexterm role="option">
44953 <primary><option>server_set_id</option></primary>
44956 <informaltable frame="all">
44957 <tgroup cols="4" colsep="0" rowsep="0">
44958 <colspec colwidth="8*" align="left"/>
44959 <colspec colwidth="6*" align="center"/>
44960 <colspec colwidth="6*" align="center"/>
44961 <colspec colwidth="6*" align="right"/>
44964 <entry><option>server_set_id</option></entry>
44965 <entry>Use: <emphasis>authenticators</emphasis></entry>
44966 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
44967 <entry>Default: <emphasis>unset</emphasis></entry>
44973 <indexterm role="variable">
44974 <primary><varname>$authenticated_id</varname></primary>
44976 When an Exim server successfully authenticates a client, this string is
44977 expanded using data from the authentication, and preserved for any incoming
44978 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
44979 lines for incoming messages. For example, a user/password authenticator
44980 configuration might preserve the user name that was used to authenticate, and
44981 refer to it subsequently during delivery of the message.
44982 If expansion fails, the option is ignored.
44985 <indexterm role="option">
44986 <primary><option>server_mail_auth_condition</option></primary>
44989 <informaltable frame="all">
44990 <tgroup cols="4" colsep="0" rowsep="0">
44991 <colspec colwidth="8*" align="left"/>
44992 <colspec colwidth="6*" align="center"/>
44993 <colspec colwidth="6*" align="center"/>
44994 <colspec colwidth="6*" align="right"/>
44997 <entry><option>server_mail_auth_condition</option></entry>
44998 <entry>Use: <emphasis>authenticators</emphasis></entry>
44999 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
45000 <entry>Default: <emphasis>unset</emphasis></entry>
45006 This option allows a server to discard authenticated sender addresses supplied
45007 as part of MAIL commands in SMTP connections that are authenticated by the
45008 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
45009 as part of the authentication process; instead its (unexpanded) value is
45010 remembered for later use.
45011 How it is used is described in the following section.
45014 <section id="SECTauthparamail">
45015 <title>The AUTH parameter on MAIL commands</title>
45017 <indexterm role="concept">
45018 <primary>authentication</primary>
45019 <secondary>sender; authenticated</secondary>
45021 <indexterm role="concept">
45022 <primary>AUTH</primary>
45023 <secondary>on MAIL command</secondary>
45025 When a client supplied an AUTH= item on a MAIL command, Exim applies
45026 the following checks before accepting it as the authenticated sender of the
45032 If the connection is not using extended SMTP (that is, HELO was used rather
45033 than EHLO), the use of AUTH= is a syntax error.
45038 If the value of the AUTH= parameter is <quote><></quote>, it is ignored.
45043 <indexterm role="variable">
45044 <primary><varname>$authenticated_sender</varname></primary>
45046 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
45047 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
45048 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
45049 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
45050 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
45051 given for the MAIL command.
45056 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
45057 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
45063 If the AUTH= value was accepted by either of the two previous rules, and
45064 the client has authenticated, and the authenticator has a setting for the
45065 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
45066 valued that was saved from the authenticator is expanded. If the expansion
45067 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
45068 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
45069 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
45075 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
45076 hosts to which Exim authenticates as a client. Do not confuse this value with
45077 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
45078 process, and which is not usually a complete email address.
45081 <indexterm role="variable">
45082 <primary><varname>$sender_address</varname></primary>
45084 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
45085 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
45086 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
45087 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
45091 <section id="SECTauthexiser">
45092 <title>Authentication on an Exim server</title>
45094 <indexterm role="concept">
45095 <primary>authentication</primary>
45096 <secondary>on an Exim server</secondary>
45098 When Exim receives an EHLO command, it advertises the public names of those
45099 authenticators that are configured as servers, subject to the following
45105 The client host must match <option>auth_advertise_hosts</option> (default *).
45110 It the <option>server_advertise_condition</option> option is set, its expansion must not
45111 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
45116 The order in which the authenticators are defined controls the order in which
45117 the mechanisms are advertised.
45120 Some mail clients (for example, some versions of Netscape) require the user to
45121 provide a name and password for authentication whenever AUTH is advertised,
45122 even though authentication may not in fact be needed (for example, Exim may be
45123 set up to allow unconditional relaying from the client by an IP address check).
45124 You can make such clients more friendly by not advertising AUTH to them.
45125 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
45126 that runs for RCPT) to relay without authentication, you should set
45128 <literallayout class="monospaced">
45129 auth_advertise_hosts = ! 10.9.8.0/24
45132 so that no authentication mechanisms are advertised to them.
45135 The <option>server_advertise_condition</option> controls the advertisement of individual
45136 authentication mechanisms. For example, it can be used to restrict the
45137 advertisement of a particular mechanism to encrypted connections, by a setting
45140 <literallayout class="monospaced">
45141 server_advertise_condition = ${if eq{$tls_cipher}{}{no}{yes}}
45144 <indexterm role="variable">
45145 <primary><varname>$tls_cipher</varname></primary>
45147 If the session is encrypted, <varname>$tls_cipher</varname> is not empty, and so the expansion
45148 yields <quote>yes</quote>, which allows the advertisement to happen.
45151 When an Exim server receives an AUTH command from a client, it rejects it
45152 immediately if AUTH was not advertised in response to an earlier EHLO
45153 command. This is the case if
45158 The client host does not match <option>auth_advertise_hosts</option>; or
45163 No authenticators are configured with server options; or
45168 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
45169 server authenticators.
45174 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
45175 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
45176 AUTH is accepted from any client host.
45179 If AUTH is not rejected by the ACL, Exim searches its configuration for a
45180 server authentication mechanism that was advertised in response to EHLO and
45181 that matches the one named in the AUTH command. If it finds one, it runs
45182 the appropriate authentication protocol, and authentication either succeeds or
45183 fails. If there is no matching advertised mechanism, the AUTH command is
45184 rejected with a 504 error.
45187 <indexterm role="variable">
45188 <primary><varname>$received_protocol</varname></primary>
45190 <indexterm role="variable">
45191 <primary><varname>$sender_host_authenticated</varname></primary>
45193 When a message is received from an authenticated host, the value of
45194 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
45195 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
45196 public name) of the authenticator driver that successfully authenticated the
45197 client from which the message was received. This variable is empty if there was
45198 no successful authentication.
45201 <section id="SECID169">
45202 <title>Testing server authentication</title>
45204 <indexterm role="concept">
45205 <primary>authentication</primary>
45206 <secondary>testing a server</secondary>
45208 <indexterm role="concept">
45209 <primary>AUTH</primary>
45210 <secondary>testing a server</secondary>
45212 <indexterm role="concept">
45213 <primary>base64 encoding</primary>
45214 <secondary>creating authentication test data</secondary>
45216 Exim’s <option>-bh</option> option can be useful for testing server authentication
45217 configurations. The data for the AUTH command has to be sent using base64
45218 encoding. A quick way to produce such data for testing is the following Perl
45221 <literallayout class="monospaced">
45223 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
45226 <indexterm role="concept">
45227 <primary>binary zero</primary>
45228 <secondary>in authentication data</secondary>
45230 This interprets its argument as a Perl string, and then encodes it. The
45231 interpretation as a Perl string allows binary zeros, which are required for
45232 some kinds of authentication, to be included in the data. For example, a
45233 command line to run this script on such data might be
45235 <literallayout class="monospaced">
45236 encode '\0user\0password'
45239 Note the use of single quotes to prevent the shell interpreting the
45240 backslashes, so that they can be interpreted by Perl to specify characters
45241 whose code value is zero.
45244 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
45245 digit, you must use three zeros instead of one after the leading backslash. If
45246 you do not, the octal digit that starts your string will be incorrectly
45247 interpreted as part of the code for the first character.
45250 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
45251 specially, you must use a Perl escape to prevent them being misinterpreted. For
45252 example, a command such as
45254 <literallayout class="monospaced">
45255 encode '\0user@domain.com\0pas$$word'
45258 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
45261 If you have the <option>mimencode</option> command installed, another way to do produce
45262 base64-encoded strings is to run the command
45264 <literallayout class="monospaced">
45265 echo -e -n `\0user\0password' | mimencode
45268 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
45269 in the argument, and the <option>-n</option> option specifies no newline at the end of its
45270 output. However, not all versions of <option>echo</option> recognize these options, so you
45271 should check your version before relying on this suggestion.
45274 <section id="SECID170">
45275 <title>Authentication by an Exim client</title>
45277 <indexterm role="concept">
45278 <primary>authentication</primary>
45279 <secondary>on an Exim client</secondary>
45281 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
45282 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
45283 announces support for authentication, and the host matches an entry in either
45284 of these options, Exim (as a client) tries to authenticate as follows:
45289 For each authenticator that is configured as a client, in the order in which
45290 they are defined in the configuration, it searches the authentication
45291 mechanisms announced by the server for one whose name matches the public name
45292 of the authenticator.
45297 <indexterm role="variable">
45298 <primary><varname>$host</varname></primary>
45300 <indexterm role="variable">
45301 <primary><varname>$host_address</varname></primary>
45303 When it finds one that matches, it runs the authenticator’s client code. The
45304 variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string expansions
45305 that the client might do. They are set to the server’s name and IP address. If
45306 any expansion is forced to fail, the authentication attempt is abandoned, and
45307 Exim moves on to the next authenticator. Otherwise an expansion failure causes
45308 delivery to be deferred.
45313 If the result of the authentication attempt is a temporary error or a timeout,
45314 Exim abandons trying to send the message to the host for the moment. It will
45315 try again later. If there are any backup hosts available, they are tried in the
45321 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
45322 carries on searching the list of authenticators and tries another one if
45323 possible. If all authentication attempts give permanent errors, or if there are
45324 no attempts because no mechanisms match (or option expansions force failure),
45325 what happens depends on whether the host matches <option>hosts_require_auth</option> or
45326 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
45327 delivery is deferred. The error can be detected in the retry rules, and thereby
45328 turned into a permanent error if you wish. In the second case, Exim tries to
45329 deliver the message unauthenticated.
45334 <indexterm role="concept">
45335 <primary>AUTH</primary>
45336 <secondary>on MAIL command</secondary>
45338 When Exim has authenticated itself to a remote server, it adds the AUTH
45339 parameter to the MAIL commands it sends, if it has an authenticated sender for
45340 the message. If the message came from a remote host, the authenticated sender
45341 is the one that was receiving on an incoming MAIL command, provided that the
45342 incoming connection was authenticated and the <option>server_mail_auth</option> condition
45343 allowed the authenticated sender to be retained. If a local process calls Exim
45344 to send a message, the sender address that is built from the login name and
45345 <option>qualify_domain</option> is treated as authenticated. However, if the
45346 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
45347 the authenticated sender that was received with the message.
45348 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
45349 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
45354 <chapter id="CHAPplaintext">
45355 <title>The plaintext authenticator</title>
45357 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
45358 <primary><command>plaintext</command> authenticator</primary>
45360 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
45361 <primary>authenticators</primary>
45362 <secondary><command>plaintext</command></secondary>
45364 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
45365 LOGIN authentication mechanisms, both of which transfer authentication data as
45366 plain (unencrypted) text (though base64 encoded). The use of plain text is a
45367 security risk; you are strongly advised to insist on the use of SMTP encryption
45368 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
45369 use unencrypted plain text, you should not use the same passwords for SMTP
45370 connections as you do for login accounts.
45372 <section id="SECID171">
45373 <title>Plaintext options</title>
45375 <indexterm role="concept">
45376 <primary>options</primary>
45377 <secondary><command>plaintext</command> authenticator (server)</secondary>
45379 When configured as a server, <command>plaintext</command> uses the following options:
45382 <indexterm role="option">
45383 <primary><option>server_condition</option></primary>
45386 <informaltable frame="all">
45387 <tgroup cols="4" colsep="0" rowsep="0">
45388 <colspec colwidth="8*" align="left"/>
45389 <colspec colwidth="6*" align="center"/>
45390 <colspec colwidth="6*" align="center"/>
45391 <colspec colwidth="6*" align="right"/>
45394 <entry><option>server_condition</option></entry>
45395 <entry>Use: <emphasis>authenticators</emphasis></entry>
45396 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
45397 <entry>Default: <emphasis>unset</emphasis></entry>
45403 This is actually a global authentication option, but it must be set in order to
45404 configure the <command>plaintext</command> driver as a server. Its use is described below.
45407 <indexterm role="option">
45408 <primary><option>server_prompts</option></primary>
45411 <informaltable frame="all">
45412 <tgroup cols="4" colsep="0" rowsep="0">
45413 <colspec colwidth="8*" align="left"/>
45414 <colspec colwidth="6*" align="center"/>
45415 <colspec colwidth="6*" align="center"/>
45416 <colspec colwidth="6*" align="right"/>
45419 <entry><option>server_prompts</option></entry>
45420 <entry>Use: <emphasis>plaintext</emphasis></entry>
45421 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
45422 <entry>Default: <emphasis>unset</emphasis></entry>
45428 The contents of this option, after expansion, must be a colon-separated list of
45429 prompt strings. If expansion fails, a temporary authentication rejection is
45433 <section id="SECTplainserver">
45434 <title>Using plaintext in a server</title>
45436 <indexterm role="concept">
45437 <primary>AUTH</primary>
45438 <secondary>in <command>plaintext</command> authenticator</secondary>
45440 <indexterm role="concept">
45441 <primary>binary zero</primary>
45442 <secondary>in <command>plaintext</command> authenticator</secondary>
45444 <indexterm role="concept">
45445 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
45446 <secondary>in <command>plaintext</command> authenticator</secondary>
45448 <indexterm role="variable">
45449 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
45451 <indexterm role="concept">
45452 <primary>base64 encoding</primary>
45453 <secondary>in <command>plaintext</command> authenticator</secondary>
45457 When running as a server, <command>plaintext</command> performs the authentication test by
45458 expanding a string. The data sent by the client with the AUTH command, or in
45459 response to subsequent prompts, is base64 encoded, and so may contain any byte
45460 values when decoded. If any data is supplied with the command, it is treated as
45461 a list of strings, separated by NULs (binary zeros), the first three of which
45462 are placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname>
45463 (neither LOGIN nor PLAIN uses more than three strings).
45466 For compatibility with previous releases of Exim, the values are also placed in
45467 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
45468 variables for this purpose is now deprecated, as it can lead to confusion in
45469 string expansions that also use them for other things.
45472 If there are more strings in <option>server_prompts</option> than the number of strings
45473 supplied with the AUTH command, the remaining prompts are used to obtain more
45474 data. Each response from the client may be a list of NUL-separated strings.
45477 <indexterm role="variable">
45478 <primary><varname>$authenticated_id</varname></primary>
45480 Once a sufficient number of data strings have been received,
45481 <option>server_condition</option> is expanded. If the expansion is forced to fail,
45482 authentication fails. Any other expansion failure causes a temporary error code
45483 to be returned. If the result of a successful expansion is an empty string,
45484 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
45485 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
45486 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
45487 For any other result, a temporary error code is returned, with the expanded
45488 string as the error text.
45491 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user’s
45492 password, be sure to make the authentication fail if the user is unknown.
45493 There are good and bad examples at the end of the next section.
45496 <section id="SECID172">
45497 <title>The PLAIN authentication mechanism</title>
45499 <indexterm role="concept">
45500 <primary>PLAIN authentication mechanism</primary>
45502 <indexterm role="concept">
45503 <primary>authentication</primary>
45504 <secondary>PLAIN mechanism</secondary>
45506 <indexterm role="concept">
45507 <primary>binary zero</primary>
45508 <secondary>in <command>plaintext</command> authenticator</secondary>
45510 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
45511 sent as one item of data (that is, one combined string containing two NUL
45512 separators). The data is sent either as part of the AUTH command, or
45513 subsequently in response to an empty prompt from the server.
45516 The second and third strings are a user name and a corresponding password.
45517 Using a single fixed user name and password as an example, this could be
45518 configured as follows:
45520 <literallayout class="monospaced">
45523 public_name = PLAIN
45525 server_condition = \
45526 ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
45527 server_set_id = $auth2
45530 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
45531 are exactly what we want here, so they need not be specified. Obviously, if the
45532 password contains expansion-significant characters such as dollar, backslash,
45533 or closing brace, they have to be escaped.
45536 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
45537 the end of a string list are ignored). If all the data comes as part of the
45538 AUTH command, as is commonly the case, the prompt is not used. This
45539 authenticator is advertised in the response to EHLO as
45541 <literallayout class="monospaced">
45545 and a client host can authenticate itself by sending the command
45547 <literallayout class="monospaced">
45548 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
45551 As this contains three strings (more than the number of prompts), no further
45552 data is required from the client. Alternatively, the client may just send
45554 <literallayout class="monospaced">
45558 to initiate authentication, in which case the server replies with an empty
45559 prompt. The client must respond with the combined data string.
45562 The data string is base64 encoded, as required by the RFC. This example,
45563 when decoded, is <<emphasis>NUL</emphasis>><literal>username</literal><<emphasis>NUL</emphasis>><literal>mysecret</literal>, where <<emphasis>NUL</emphasis>>
45564 represents a zero byte. This is split up into three strings, the first of which
45565 is empty. The <option>server_condition</option> option in the authenticator checks that the
45566 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
45569 Having just one fixed user name and password, as in this example, is not very
45570 realistic, though for a small organization with only a handful of
45571 authenticating clients it could make sense.
45574 A more sophisticated instance of this authenticator could use the user name in
45575 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
45576 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
45577 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
45578 This is an incorrect example:
45580 <literallayout class="monospaced">
45581 server_condition = \
45582 ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
45585 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
45586 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
45587 incorrect? It works fine for existing users, but consider what happens if a
45588 non-existent user name is given. The lookup fails, but as no success/failure
45589 strings are given for the lookup, it yields an empty string. Thus, to defeat
45590 the authentication, all a client has to do is to supply a non-existent user
45591 name and an empty password. The correct way of writing this test is:
45593 <literallayout class="monospaced">
45594 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
45595 {${if eq{$value}{$auth3}}} {false}}
45598 In this case, if the lookup succeeds, the result is checked; if the lookup
45599 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
45600 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
45601 always fails if its second argument is empty. However, the second way of
45602 writing the test makes the logic clearer.
45605 <section id="SECID173">
45606 <title>The LOGIN authentication mechanism</title>
45608 <indexterm role="concept">
45609 <primary>LOGIN authentication mechanism</primary>
45611 <indexterm role="concept">
45612 <primary>authentication</primary>
45613 <secondary>LOGIN mechanism</secondary>
45615 The LOGIN authentication mechanism is not documented in any RFC, but is in use
45616 in a number of programs. No data is sent with the AUTH command. Instead, a
45617 user name and password are supplied separately, in response to prompts. The
45618 plaintext authenticator can be configured to support this as in this example:
45620 <literallayout class="monospaced">
45623 public_name = LOGIN
45624 server_prompts = User Name : Password
45625 server_condition = \
45626 ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
45627 server_set_id = $auth1
45630 Because of the way plaintext operates, this authenticator accepts data supplied
45631 with the AUTH command (in contravention of the specification of LOGIN), but
45632 if the client does not supply it (as is the case for LOGIN clients), the prompt
45633 strings are used to obtain two data items.
45636 Some clients are very particular about the precise text of the prompts. For
45637 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
45638 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
45639 strings. It uses the <option>ldapauth</option> expansion condition to check the user
45640 name and password by binding to an LDAP server:
45642 <literallayout class="monospaced">
45645 public_name = LOGIN
45646 server_prompts = Username:: : Password::
45647 server_condition = ${if and{{
45649 ldapauth{user="cn=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
45650 pass=${quote:$auth2} \
45651 ldap://ldap.example.org/} }} }
45652 server_set_id = uid=$auth1,ou=people,o=example.org
45654 <para revisionflag="changed">
45655 We have to check that the username is not empty before using it, because LDAP
45656 does not permit empty DN components. We must also use the <option>quote_ldap_dn</option>
45657 operator to correctly quote the DN for authentication. However, the basic
45658 <option>quote</option> operator, rather than any of the LDAP quoting operators, is the
45659 correct one to use for the password, because quoting is needed only to make
45660 the password conform to the Exim syntax. At the LDAP level, the password is an
45661 uninterpreted string.
45664 <section id="SECID174">
45665 <title>Support for different kinds of authentication</title>
45667 A number of string expansion features are provided for the purpose of
45668 interfacing to different ways of user authentication. These include checking
45669 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
45670 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
45671 <xref linkend="SECTexpcond"/>.
45674 <section id="SECID175">
45675 <title>Using plaintext in a client</title>
45677 <indexterm role="concept">
45678 <primary>options</primary>
45679 <secondary><command>plaintext</command> authenticator (client)</secondary>
45681 The <command>plaintext</command> authenticator has two client options:
45684 <indexterm role="option">
45685 <primary><option>client_ignore_invalid_base64</option></primary>
45688 <informaltable frame="all">
45689 <tgroup cols="4" colsep="0" rowsep="0">
45690 <colspec colwidth="8*" align="left"/>
45691 <colspec colwidth="6*" align="center"/>
45692 <colspec colwidth="6*" align="center"/>
45693 <colspec colwidth="6*" align="right"/>
45696 <entry><option>client_ignore_invalid_base64</option></entry>
45697 <entry>Use: <emphasis>plaintext</emphasis></entry>
45698 <entry>Type: <emphasis>boolean</emphasis></entry>
45699 <entry>Default: <emphasis>false</emphasis></entry>
45705 If the client receives a server prompt that is not a valid base64 string,
45706 authentication is abandoned by default. However, if this option is set true,
45707 the error in the challenge is ignored and the client sends the response as
45711 <indexterm role="option">
45712 <primary><option>client_send</option></primary>
45715 <informaltable frame="all">
45716 <tgroup cols="4" colsep="0" rowsep="0">
45717 <colspec colwidth="8*" align="left"/>
45718 <colspec colwidth="6*" align="center"/>
45719 <colspec colwidth="6*" align="center"/>
45720 <colspec colwidth="6*" align="right"/>
45723 <entry><option>client_send</option></entry>
45724 <entry>Use: <emphasis>plaintext</emphasis></entry>
45725 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
45726 <entry>Default: <emphasis>unset</emphasis></entry>
45732 The string is a colon-separated list of authentication data strings. Each
45733 string is independently expanded before being sent to the server. The first
45734 string is sent with the AUTH command; any more strings are sent in response
45735 to prompts from the server. Before each string is expanded, the value of the
45736 most recent prompt is placed in the next <varname>$auth</varname><<emphasis>n</emphasis>> variable, starting
45737 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
45738 way. Thus, the prompt that is received in response to sending the first string
45739 (with the AUTH command) can be used in the expansion of the second string, and
45740 so on. If an invalid base64 string is received when
45741 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
45742 <varname>$auth</varname><<emphasis>n</emphasis>> variable.
45745 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
45746 splitting takes priority and happens first.
45749 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
45750 the data, further processing is applied to each string before it is sent. If
45751 there are any single circumflex characters in the string, they are converted to
45752 NULs. Should an actual circumflex be required as data, it must be doubled in
45756 This is an example of a client configuration that implements the PLAIN
45757 authentication mechanism with a fixed user name and password:
45759 <literallayout class="monospaced">
45762 public_name = PLAIN
45763 client_send = ^username^mysecret
45766 The lack of colons means that the entire text is sent with the AUTH
45767 command, with the circumflex characters converted to NULs. A similar example
45768 that uses the LOGIN mechanism is:
45770 <literallayout class="monospaced">
45773 public_name = LOGIN
45774 client_send = : username : mysecret
45777 The initial colon means that the first string is empty, so no data is sent with
45778 the AUTH command itself. The remaining strings are sent in response to
45780 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
45781 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
45786 <chapter id="CHID9">
45787 <title>The cram_md5 authenticator</title>
45789 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
45790 <primary><command>cram_md5</command> authenticator</primary>
45792 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
45793 <primary>authenticators</primary>
45794 <secondary><command>cram_md5</command></secondary>
45796 <indexterm role="concept">
45797 <primary>CRAM-MD5 authentication mechanism</primary>
45799 <indexterm role="concept">
45800 <primary>authentication</primary>
45801 <secondary>CRAM-MD5 mechanism</secondary>
45803 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
45804 sends a challenge string to the client, and the response consists of a user
45805 name and the CRAM-MD5 digest of the challenge string combined with a secret
45806 string (password) which is known to both server and client. Thus, the secret
45807 is not sent over the network as plain text, which makes this authenticator more
45808 secure than <command>plaintext</command>. However, the downside is that the secret has to be
45809 available in plain text at either end.
45811 <section id="SECID176">
45812 <title>Using cram_md5 as a server</title>
45814 <indexterm role="concept">
45815 <primary>options</primary>
45816 <secondary><command>cram_md5</command> authenticator (server)</secondary>
45818 This authenticator has one server option, which must be set to configure the
45819 authenticator as a server:
45822 <indexterm role="option">
45823 <primary><option>server_secret</option></primary>
45826 <informaltable frame="all">
45827 <tgroup cols="4" colsep="0" rowsep="0">
45828 <colspec colwidth="8*" align="left"/>
45829 <colspec colwidth="6*" align="center"/>
45830 <colspec colwidth="6*" align="center"/>
45831 <colspec colwidth="6*" align="right"/>
45834 <entry><option>server_secret</option></entry>
45835 <entry>Use: <emphasis>cram_md5</emphasis></entry>
45836 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
45837 <entry>Default: <emphasis>unset</emphasis></entry>
45843 <indexterm role="concept">
45844 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
45845 <secondary>in <command>cram_md5</command> authenticator</secondary>
45847 When the server receives the client’s response, the user name is placed in
45848 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
45849 obtain the password for that user. The server then computes the CRAM-MD5 digest
45850 that the client should have sent, and checks that it received the correct
45851 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
45852 fails. If the expansion fails for some other reason, a temporary error code is
45853 returned to the client.
45856 For compatibility with previous releases of Exim, the user name is also placed
45857 in <varname>$1</varname>. However, the use of this variables for this purpose is now
45858 deprecated, as it can lead to confusion in string expansions that also use
45859 numeric variables for other things.
45862 For example, the following authenticator checks that the user name given by the
45863 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
45864 user name, authentication fails.
45866 <literallayout class="monospaced">
45869 public_name = CRAM-MD5
45870 server_secret = ${if eq{$auth1}{ph10}{secret}fail}
45871 server_set_id = $auth1
45874 <indexterm role="variable">
45875 <primary><varname>$authenticated_id</varname></primary>
45877 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
45878 name in <varname>$authenticated_id</varname>. A more typical configuration might look up the
45879 secret string in a file, using the user name as the key. For example:
45881 <literallayout class="monospaced">
45884 public_name = CRAM-MD5
45885 server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}\
45887 server_set_id = $auth1
45890 Note that this expansion explicitly forces failure if the lookup fails
45891 because <varname>$auth1</varname> contains an unknown user name.
45894 <section id="SECID177">
45895 <title>Using cram_md5 as a client</title>
45897 <indexterm role="concept">
45898 <primary>options</primary>
45899 <secondary><command>cram_md5</command> authenticator (client)</secondary>
45901 When used as a client, the <command>cram_md5</command> authenticator has two options:
45904 <indexterm role="option">
45905 <primary><option>client_name</option></primary>
45908 <informaltable frame="all">
45909 <tgroup cols="4" colsep="0" rowsep="0">
45910 <colspec colwidth="8*" align="left"/>
45911 <colspec colwidth="6*" align="center"/>
45912 <colspec colwidth="6*" align="center"/>
45913 <colspec colwidth="6*" align="right"/>
45916 <entry><option>client_name</option></entry>
45917 <entry>Use: <emphasis>cram_md5</emphasis></entry>
45918 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
45919 <entry>Default: <emphasis>the primary host name</emphasis></entry>
45925 This string is expanded, and the result used as the user name data when
45926 computing the response to the server’s challenge.
45929 <indexterm role="option">
45930 <primary><option>client_secret</option></primary>
45933 <informaltable frame="all">
45934 <tgroup cols="4" colsep="0" rowsep="0">
45935 <colspec colwidth="8*" align="left"/>
45936 <colspec colwidth="6*" align="center"/>
45937 <colspec colwidth="6*" align="center"/>
45938 <colspec colwidth="6*" align="right"/>
45941 <entry><option>client_secret</option></entry>
45942 <entry>Use: <emphasis>cram_md5</emphasis></entry>
45943 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
45944 <entry>Default: <emphasis>unset</emphasis></entry>
45950 This option must be set for the authenticator to work as a client. Its value is
45951 expanded and the result used as the secret string when computing the response.
45954 <indexterm role="variable">
45955 <primary><varname>$host</varname></primary>
45957 <indexterm role="variable">
45958 <primary><varname>$host_address</varname></primary>
45960 Different user names and secrets can be used for different servers by referring
45961 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
45962 expansion string is treated as an indication that this authenticator is not
45963 prepared to handle this case. Exim moves on to the next configured client
45964 authenticator. Any other expansion failure causes Exim to give up trying to
45965 send the message to the current server.
45968 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
45971 <literallayout class="monospaced">
45974 public_name = CRAM-MD5
45976 client_secret = secret
45979 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
45980 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
45985 <chapter id="CHID10">
45986 <title>The cyrus_sasl authenticator</title>
45988 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
45989 <primary><command>cyrus_sasl</command> authenticator</primary>
45991 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
45992 <primary>authenticators</primary>
45993 <secondary><command>cyrus_sasl</command></secondary>
45995 <indexterm role="concept">
45996 <primary>Cyrus</primary>
45997 <secondary>SASL library</secondary>
45999 <indexterm role="concept">
46000 <primary>Kerberos</primary>
46002 The code for this authenticator was provided by Matthew Byng-Maddick of A L
46003 Digital Ltd (<emphasis role="bold"><ulink url="http://www.aldigital.co.uk">http://www.aldigital.co.uk</ulink></emphasis>).
46006 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
46007 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
46008 Layer</quote>). This library supports a number of authentication mechanisms,
46009 including PLAIN and LOGIN, but also several others that Exim does not support
46010 directly. In particular, there is support for Kerberos authentication.
46013 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
46014 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
46015 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
46016 name of the driver to determine which mechanism to support.
46019 Where access to some kind of secret file is required, for example in GSSAPI
46020 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
46021 user, and that the Cyrus SASL library has no way of escalating privileges
46022 by default. You may also find you need to set environment variables,
46023 depending on the driver you are using.
46026 The application name provided by Exim is <quote>exim</quote>, so various SASL options may
46027 be set in <filename>exim.conf</filename> in your SASL directory. If you are using GSSAPI for
46028 Kerberos, note that because of limitations in the GSSAPI interface,
46029 changing the server keytab might need to be communicated down to the Kerberos
46030 layer independently. The mechanism for doing so is dependent upon the Kerberos
46031 implementation. For example, for Heimdal, the environment variable KRB5_KTNAME
46032 may be set to point to an alternative keytab file. Exim will pass this
46033 variable through from its own inherited environment when started as root or the
46034 Exim user. The keytab file needs to be readable by the Exim user.
46036 <section id="SECID178">
46037 <title>Using cyrus_sasl as a server</title>
46039 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
46040 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
46041 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
46042 use of this variable for this purpose is now deprecated, as it can lead to
46043 confusion in string expansions that also use numeric variables for other
46047 <indexterm role="option">
46048 <primary><option>server_hostname</option></primary>
46051 <informaltable frame="all">
46052 <tgroup cols="4" colsep="0" rowsep="0">
46053 <colspec colwidth="8*" align="left"/>
46054 <colspec colwidth="6*" align="center"/>
46055 <colspec colwidth="6*" align="center"/>
46056 <colspec colwidth="6*" align="right"/>
46059 <entry><option>server_hostname</option></entry>
46060 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46061 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
46062 <entry>Default: <emphasis>see below</emphasis></entry>
46068 This option selects the hostname that is used when communicating with the
46069 library. The default value is <literal>$primary_hostname</literal>. It is up to the underlying
46070 SASL plug-in what it does with this data.
46073 <indexterm role="option">
46074 <primary><option>server_mech</option></primary>
46077 <informaltable frame="all">
46078 <tgroup cols="4" colsep="0" rowsep="0">
46079 <colspec colwidth="8*" align="left"/>
46080 <colspec colwidth="6*" align="center"/>
46081 <colspec colwidth="6*" align="center"/>
46082 <colspec colwidth="6*" align="right"/>
46085 <entry><option>server_mech</option></entry>
46086 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46087 <entry>Type: <emphasis>string</emphasis></entry>
46088 <entry>Default: <emphasis>see below</emphasis></entry>
46094 This option selects the authentication mechanism this driver should use. The
46095 default is the value of the generic <option>public_name</option> option. This option allows
46096 you to use a different underlying mechanism from the advertised name. For
46099 <literallayout class="monospaced">
46101 driver = cyrus_sasl
46102 public_name = X-ANYTHING
46103 server_mech = CRAM-MD5
46104 server_set_id = $auth1
46107 <indexterm role="option">
46108 <primary><option>server_realm</option></primary>
46111 <informaltable frame="all">
46112 <tgroup cols="4" colsep="0" rowsep="0">
46113 <colspec colwidth="8*" align="left"/>
46114 <colspec colwidth="6*" align="center"/>
46115 <colspec colwidth="6*" align="center"/>
46116 <colspec colwidth="6*" align="right"/>
46119 <entry><option>server_realm</option></entry>
46120 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46121 <entry>Type: <emphasis>string</emphasis></entry>
46122 <entry>Default: <emphasis>unset</emphasis></entry>
46128 This specifies the SASL realm that the server claims to be in.
46131 <indexterm role="option">
46132 <primary><option>server_service</option></primary>
46135 <informaltable frame="all">
46136 <tgroup cols="4" colsep="0" rowsep="0">
46137 <colspec colwidth="8*" align="left"/>
46138 <colspec colwidth="6*" align="center"/>
46139 <colspec colwidth="6*" align="center"/>
46140 <colspec colwidth="6*" align="right"/>
46143 <entry><option>server_service</option></entry>
46144 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46145 <entry>Type: <emphasis>string</emphasis></entry>
46146 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
46152 This is the SASL service that the server claims to implement.
46155 For straightforward cases, you do not need to set any of the authenticator’s
46156 private options. All you need to do is to specify an appropriate mechanism as
46157 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
46158 PLAIN, you could have two authenticators as follows:
46160 <literallayout class="monospaced">
46162 driver = cyrus_sasl
46163 public_name = CRAM-MD5
46164 server_set_id = $auth1
46167 driver = cyrus_sasl
46168 public_name = PLAIN
46169 server_set_id = $auth2
46172 Cyrus SASL does implement the LOGIN authentication method, even though it is
46173 not a standard method. It is disabled by default in the source distribution,
46174 but it is present in many binary distributions.
46175 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
46176 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
46181 <chapter id="CHAPdovecot">
46182 <title>The dovecot authenticator</title>
46184 <indexterm role="concept" id="IIDdcotauth1" class="startofrange">
46185 <primary><command>dovecot</command> authenticator</primary>
46187 <indexterm role="concept" id="IIDdcotauth2" class="startofrange">
46188 <primary>authenticators</primary>
46189 <secondary><command>dovecot</command></secondary>
46191 This authenticator is an interface to the authentication facility of the
46192 Dovecot POP/IMAP server, which can support a number of authentication methods.
46193 If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful
46194 to use the same mechanisms for SMTP authentication. This is a server
46195 authenticator only. There is only one option:
46198 <indexterm role="option">
46199 <primary><option>server_socket</option></primary>
46202 <informaltable frame="all">
46203 <tgroup cols="4" colsep="0" rowsep="0">
46204 <colspec colwidth="8*" align="left"/>
46205 <colspec colwidth="6*" align="center"/>
46206 <colspec colwidth="6*" align="center"/>
46207 <colspec colwidth="6*" align="right"/>
46210 <entry><option>server_socket</option></entry>
46211 <entry>Use: <emphasis>dovecot</emphasis></entry>
46212 <entry>Type: <emphasis>string</emphasis></entry>
46213 <entry>Default: <emphasis>unset</emphasis></entry>
46219 This option must specify the socket that is the interface to Dovecot
46220 authentication. The <option>public_name</option> option must specify an authentication
46221 mechanism that Dovecot is configured to support. You can have several
46222 authenticators for different mechanisms. For example:
46224 <literallayout class="monospaced">
46227 public_name = PLAIN
46228 server_socket = /var/run/dovecot/auth-client
46229 server_set_id = $auth2
46234 server_socket = /var/run/dovecot/auth-client
46235 server_set_id = $auth1
46238 If the SMTP connection is encrypted, or if <varname>$sender_host_address</varname> is equal to
46239 <varname>$received_ip_address</varname> (that is, the connection is local), the <quote>secured</quote>
46240 option is passed in the Dovecot authentication command. If, for a TLS
46241 connection, a client certificate has been verified, the <quote>valid-client-cert</quote>
46242 option is passed. When authentication succeeds, the identity of the user
46243 who authenticated is placed in <varname>$auth1</varname>.
46244 <indexterm role="concept" startref="IIDdcotauth1" class="endofrange"/>
46245 <indexterm role="concept" startref="IIDdcotauth2" class="endofrange"/>
46249 <chapter id="CHAPspa">
46250 <title>The spa authenticator</title>
46252 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
46253 <primary><command>spa</command> authenticator</primary>
46255 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
46256 <primary>authenticators</primary>
46257 <secondary><command>spa</command></secondary>
46259 <indexterm role="concept">
46260 <primary>authentication</primary>
46261 <secondary>Microsoft Secure Password</secondary>
46263 <indexterm role="concept">
46264 <primary>authentication</primary>
46265 <secondary>NTLM</secondary>
46267 <indexterm role="concept">
46268 <primary>Microsoft Secure Password Authentication</primary>
46270 <indexterm role="concept">
46271 <primary>NTLM authentication</primary>
46273 The <command>spa</command> authenticator provides client support for Microsoft’s <emphasis>Secure
46274 Password Authentication</emphasis> mechanism,
46275 which is also sometimes known as NTLM (NT LanMan). The code for client side of
46276 this authenticator was contributed by Marc Prud’hommeaux, and much of it is
46277 taken from the Samba project (<emphasis role="bold"><ulink url="http://www.samba.org">http://www.samba.org</ulink></emphasis>). The code for the
46278 server side was subsequently contributed by Tom Kistner. The mechanism works as
46284 After the AUTH command has been accepted, the client sends an SPA
46285 authentication request based on the user name and optional domain.
46290 The server sends back a challenge.
46295 The client builds a challenge response which makes use of the user’s password
46296 and sends it to the server, which then accepts or rejects it.
46301 Encryption is used to protect the password in transit.
46303 <section id="SECID179">
46304 <title>Using spa as a server</title>
46306 <indexterm role="concept">
46307 <primary>options</primary>
46308 <secondary><command>spa</command> authenticator (server)</secondary>
46310 The <command>spa</command> authenticator has just one server option:
46313 <indexterm role="option">
46314 <primary><option>server_password</option></primary>
46317 <informaltable frame="all">
46318 <tgroup cols="4" colsep="0" rowsep="0">
46319 <colspec colwidth="8*" align="left"/>
46320 <colspec colwidth="6*" align="center"/>
46321 <colspec colwidth="6*" align="center"/>
46322 <colspec colwidth="6*" align="right"/>
46325 <entry><option>server_password</option></entry>
46326 <entry>Use: <emphasis>spa</emphasis></entry>
46327 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
46328 <entry>Default: <emphasis>unset</emphasis></entry>
46334 <indexterm role="concept">
46335 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
46336 <secondary>in <command>spa</command> authenticator</secondary>
46338 This option is expanded, and the result must be the cleartext password for the
46339 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
46340 compatibility with previous releases of Exim, the user name is also placed in
46341 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
46342 it can lead to confusion in string expansions that also use numeric variables
46343 for other things. For example:
46345 <literallayout class="monospaced">
46349 server_password = \
46350 ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
46353 If the expansion is forced to fail, authentication fails. Any other expansion
46354 failure causes a temporary error code to be returned.
46357 <section id="SECID180">
46358 <title>Using spa as a client</title>
46360 <indexterm role="concept">
46361 <primary>options</primary>
46362 <secondary><command>spa</command> authenticator (client)</secondary>
46364 The <command>spa</command> authenticator has the following client options:
46367 <indexterm role="option">
46368 <primary><option>client_domain</option></primary>
46371 <informaltable frame="all">
46372 <tgroup cols="4" colsep="0" rowsep="0">
46373 <colspec colwidth="8*" align="left"/>
46374 <colspec colwidth="6*" align="center"/>
46375 <colspec colwidth="6*" align="center"/>
46376 <colspec colwidth="6*" align="right"/>
46379 <entry><option>client_domain</option></entry>
46380 <entry>Use: <emphasis>spa</emphasis></entry>
46381 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
46382 <entry>Default: <emphasis>unset</emphasis></entry>
46388 This option specifies an optional domain for the authentication.
46391 <indexterm role="option">
46392 <primary><option>client_password</option></primary>
46395 <informaltable frame="all">
46396 <tgroup cols="4" colsep="0" rowsep="0">
46397 <colspec colwidth="8*" align="left"/>
46398 <colspec colwidth="6*" align="center"/>
46399 <colspec colwidth="6*" align="center"/>
46400 <colspec colwidth="6*" align="right"/>
46403 <entry><option>client_password</option></entry>
46404 <entry>Use: <emphasis>spa</emphasis></entry>
46405 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
46406 <entry>Default: <emphasis>unset</emphasis></entry>
46412 This option specifies the user’s password, and must be set.
46415 <indexterm role="option">
46416 <primary><option>client_username</option></primary>
46419 <informaltable frame="all">
46420 <tgroup cols="4" colsep="0" rowsep="0">
46421 <colspec colwidth="8*" align="left"/>
46422 <colspec colwidth="6*" align="center"/>
46423 <colspec colwidth="6*" align="center"/>
46424 <colspec colwidth="6*" align="right"/>
46427 <entry><option>client_username</option></entry>
46428 <entry>Use: <emphasis>spa</emphasis></entry>
46429 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
46430 <entry>Default: <emphasis>unset</emphasis></entry>
46436 This option specifies the user name, and must be set. Here is an example of a
46437 configuration of this authenticator for use with the mail servers at
46438 <emphasis>msn.com</emphasis>:
46440 <literallayout class="monospaced">
46444 client_username = msn/msn_username
46445 client_password = msn_plaintext_password
46446 client_domain = DOMAIN_OR_UNSET
46449 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
46450 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
46455 <chapter id="CHAPTLS">
46456 <title>Encrypted SMTP connections using TLS/SSL</title>
46457 <titleabbrev>Encrypted SMTP connections</titleabbrev>
46459 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
46460 <primary>encryption</primary>
46461 <secondary>on SMTP connection</secondary>
46463 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
46464 <primary>SMTP</primary>
46465 <secondary>encryption</secondary>
46467 <indexterm role="concept">
46468 <primary>TLS</primary>
46469 <secondary>on SMTP connection</secondary>
46471 <indexterm role="concept">
46472 <primary>OpenSSL</primary>
46474 <indexterm role="concept">
46475 <primary>GnuTLS</primary>
46477 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
46478 Sockets Layer), is implemented by making use of the OpenSSL library or the
46479 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
46480 cryptographic code in the Exim distribution itself for implementing TLS. In
46481 order to use this feature you must install OpenSSL or GnuTLS, and then build a
46482 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
46483 You also need to understand the basic concepts of encryption at a managerial
46484 level, and in particular, the way that public keys, private keys, and
46485 certificates are used.
46488 RFC 3207 defines how SMTP connections can make use of encryption. Once a
46489 connection is established, the client issues a STARTTLS command. If the
46490 server accepts this, the client and the server negotiate an encryption
46491 mechanism. If the negotiation succeeds, the data that subsequently passes
46492 between them is encrypted.
46495 Exim’s ACLs can detect whether the current SMTP session is encrypted or not,
46496 and if so, what cipher suite is in use, whether the client supplied a
46497 certificate, and whether or not that certificate was verified. This makes it
46498 possible for an Exim server to deny or accept certain commands based on the
46502 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
46503 disrupt TLS connections. You need to turn off SMTP scanning for these products
46504 in order to get TLS to work.
46506 <section id="SECID284">
46507 <title>Support for the legacy <quote>ssmtp</quote> (aka <quote>smtps</quote>) protocol</title>
46509 <indexterm role="concept">
46510 <primary>ssmtp protocol</primary>
46512 <indexterm role="concept">
46513 <primary>smtps protocol</primary>
46515 <indexterm role="concept">
46516 <primary>SMTP</primary>
46517 <secondary>ssmtp protocol</secondary>
46519 <indexterm role="concept">
46520 <primary>SMTP</primary>
46521 <secondary>smtps protocol</secondary>
46523 Early implementations of encrypted SMTP used a different TCP port from normal
46524 SMTP, and expected an encryption negotiation to start immediately, instead of
46525 waiting for a STARTTLS command from the client using the standard SMTP
46526 port. The protocol was called <quote>ssmtp</quote> or <quote>smtps</quote>, and port 465 was
46527 allocated for this purpose.
46530 This approach was abandoned when encrypted SMTP was standardized, but there are
46531 still some legacy clients that use it. Exim supports these clients by means of
46532 the <option>tls_on_connect_ports</option> global option. Its value must be a list of port
46533 numbers; the most common use is expected to be:
46535 <literallayout class="monospaced">
46536 tls_on_connect_ports = 465
46539 The port numbers specified by this option apply to all SMTP connections, both
46540 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
46541 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
46542 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
46543 an extra port – rather, it specifies different behaviour on a port that is
46547 There is also a <option>-tls-on-connect</option> command line option. This overrides
46548 <option>tls_on_connect_ports</option>; it forces the legacy behaviour for all ports.
46551 <section id="SECTopenvsgnu">
46552 <title>OpenSSL vs GnuTLS</title>
46554 <indexterm role="concept">
46555 <primary>TLS</primary>
46556 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
46558 The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS
46559 followed later, when the first versions of GnuTLS were released. To build Exim
46560 to use GnuTLS, you need to set
46562 <literallayout class="monospaced">
46566 in Local/Makefile, in addition to
46568 <literallayout class="monospaced">
46572 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
46573 include files and libraries for GnuTLS can be found.
46576 There are some differences in usage when using GnuTLS instead of OpenSSL:
46581 The <option>tls_verify_certificates</option> option must contain the name of a file, not the
46582 name of a directory (for OpenSSL it can be either).
46587 The <option>tls_dhparam</option> option is ignored, because early versions of GnuTLS had no
46588 facility for varying its Diffie-Hellman parameters. I understand that this has
46589 changed, but Exim has not been updated to provide this facility.
46594 <indexterm role="variable">
46595 <primary><varname>$tls_peerdn</varname></primary>
46597 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
46598 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
46599 affects the value of the <varname>$tls_peerdn</varname> variable.
46604 OpenSSL identifies cipher suites using hyphens as separators, for example:
46605 DES-CBC3-SHA. GnuTLS uses underscores, for example: RSA_ARCFOUR_SHA. What is
46606 more, OpenSSL complains if underscores are present in a cipher list. To make
46607 life simpler, Exim changes underscores to hyphens for OpenSSL and hyphens to
46608 underscores for GnuTLS when processing lists of cipher suites in the
46609 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
46615 The <option>tls_require_ciphers</option> options operate differently, as described in the
46616 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
46621 <section id="SECID181">
46622 <title>GnuTLS parameter computation</title>
46624 GnuTLS uses D-H parameters that may take a substantial amount of time
46625 to compute. It is unreasonable to re-compute them for every TLS session.
46626 Therefore, Exim keeps this data in a file in its spool directory, called
46627 <filename>gnutls-params</filename>. The file is owned by the Exim user and is readable only by
46628 its owner. Every Exim process that start up GnuTLS reads the D-H
46629 parameters from this file. If the file does not exist, the first Exim process
46630 that needs it computes the data and writes it to a temporary file which is
46631 renamed once it is complete. It does not matter if several Exim processes do
46632 this simultaneously (apart from wasting a few resources). Once a file is in
46633 place, new Exim processes immediately start using it.
46636 For maximum security, the parameters that are stored in this file should be
46637 recalculated periodically, the frequency depending on your paranoia level.
46638 Arranging this is easy in principle; just delete the file when you want new
46639 values to be computed. However, there may be a problem. The calculation of new
46640 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
46641 If the system is not very active, <filename>/dev/random</filename> may delay returning data
46642 until enough randomness (entropy) is available. This may cause Exim to hang for
46643 a substantial amount of time, causing timeouts on incoming connections.
46646 The solution is to generate the parameters externally to Exim. They are stored
46647 in <filename>gnutls-params</filename> in PEM format, which means that they can be generated
46648 externally using the <command>certtool</command> command that is part of GnuTLS.
46651 To replace the parameters with new ones, instead of deleting the file
46652 and letting Exim re-create it, you can generate new parameters using
46653 <command>certtool</command> and, when this has been done, replace Exim’s cache file by
46654 renaming. The relevant commands are something like this:
46656 <literallayout class="monospaced">
46659 # chown exim:exim new-params
46660 # chmod 0400 new-params
46661 # certtool --generate-privkey --bits 512 >new-params
46662 # echo "" >>new-params
46663 # certtool --generate-dh-params --bits 1024 >> new-params
46664 # mv new-params gnutls-params
46667 If Exim never has to generate the parameters itself, the possibility of
46668 stalling is removed.
46671 <section id="SECTreqciphssl">
46672 <title>Requiring specific ciphers in OpenSSL</title>
46674 <indexterm role="concept">
46675 <primary>TLS</primary>
46676 <secondary>requiring specific ciphers (OpenSSL)</secondary>
46678 <indexterm role="option">
46679 <primary><option>tls_require_ciphers</option></primary>
46680 <secondary>OpenSSL</secondary>
46682 There is a function in the OpenSSL library that can be passed a list of cipher
46683 suites before the cipher negotiation takes place. This specifies which ciphers
46684 are acceptable. The list is colon separated and may contain names like
46685 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
46686 directly to this function call. The following quotation from the OpenSSL
46687 documentation specifies what forms of item are allowed in the cipher string:
46692 It can consist of a single cipher suite such as RC4-SHA.
46697 It can represent a list of cipher suites containing a certain algorithm,
46698 or cipher suites of a certain type. For example SHA1 represents all
46699 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
46705 Lists of cipher suites can be combined in a single cipher string using
46706 the + character. This is used as a logical and operation. For example
46707 SHA1+DES represents all cipher suites containing the SHA1 and the DES
46713 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
46714 <literal>-</literal> or <literal>+</literal>.
46719 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
46720 ciphers deleted can never reappear in the list even if they are explicitly
46726 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
46727 of the ciphers can be added again by later options.
46732 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
46733 option does not add any new ciphers; it just moves matching existing ones.
46738 If none of these characters is present, the string is interpreted as
46739 a list of ciphers to be appended to the current preference list. If the list
46740 includes any ciphers already present they will be ignored: that is, they will
46741 not be moved to the end of the list.
46744 <section id="SECTreqciphgnu">
46745 <title>Requiring specific ciphers or other parameters in GnuTLS</title>
46747 <indexterm role="concept">
46748 <primary>GnuTLS</primary>
46749 <secondary>specifying parameters for</secondary>
46751 <indexterm role="concept">
46752 <primary>TLS</primary>
46753 <secondary>specifying ciphers (GnuTLS)</secondary>
46755 <indexterm role="concept">
46756 <primary>TLS</primary>
46757 <secondary>specifying key exchange methods (GnuTLS)</secondary>
46759 <indexterm role="concept">
46760 <primary>TLS</primary>
46761 <secondary>specifying MAC algorithms (GnuTLS)</secondary>
46763 <indexterm role="concept">
46764 <primary>TLS</primary>
46765 <secondary>specifying protocols (GnuTLS)</secondary>
46767 <indexterm role="option">
46768 <primary><option>tls_require_ciphers</option></primary>
46769 <secondary>GnuTLS</secondary>
46771 The GnuTLS library allows the caller to specify separate lists of permitted key
46772 exchange methods, main cipher algorithms, MAC algorithms, and protocols.
46773 Unfortunately, these lists are numerical, and the library does not have a
46774 function for turning names into numbers. Consequently, lists of recognized
46775 names have to be built into the application. The permitted key exchange
46776 methods, ciphers, and MAC algorithms may be used in any combination to form a
46777 cipher suite. This is unlike OpenSSL, where complete cipher suite names are
46778 passed to its control function.
46781 For compatibility with OpenSSL, the <option>tls_require_ciphers</option> option can be set
46782 to complete cipher suite names such as RSA_ARCFOUR_SHA, but for GnuTLS this
46783 option controls only the cipher algorithms. Exim searches each item in the
46784 list for the name of an available algorithm. For example, if the list
46785 contains RSA_AES_SHA, then AES is recognized, and the behaviour is exactly
46786 the same as if just AES were given.
46789 <indexterm role="option">
46790 <primary><option>gnutls_require_kx</option></primary>
46792 <indexterm role="option">
46793 <primary><option>gnutls_require_mac</option></primary>
46795 <indexterm role="option">
46796 <primary><option>gnutls_require_protocols</option></primary>
46798 There are additional options called <option>gnutls_require_kx</option>,
46799 <option>gnutls_require_mac</option>, and <option>gnutls_require_protocols</option> that can be used to
46800 restrict the key exchange methods, MAC algorithms, and protocols, respectively.
46801 These options are ignored if OpenSSL is in use.
46804 All four options are available as global options, controlling how Exim
46805 behaves as a server, and also as options of the <command>smtp</command> transport, controlling
46806 how Exim behaves as a client. All the values are string expanded. After
46807 expansion, the values must be colon-separated lists, though the separator
46808 can be changed in the usual way.
46811 Each of the four lists starts out with a default set of algorithms. If the
46812 first item in a list does <emphasis>not</emphasis> start with an exclamation mark, all the
46813 default items are deleted. In this case, only those that are explicitly
46814 specified can be used. If the first item in a list <emphasis>does</emphasis> start with an
46815 exclamation mark, the defaults are left on the list.
46818 Then, any item that starts with an exclamation mark causes the relevant
46819 entry to be removed from the list, and any item that does not start with an
46820 exclamation mark causes a new entry to be added to the list. Unrecognized
46821 items in the list are ignored. Thus:
46823 <literallayout class="monospaced">
46824 tls_require_ciphers = !ARCFOUR
46827 allows all the defaults except ARCFOUR, whereas
46829 <literallayout class="monospaced">
46830 tls_require_ciphers = AES : 3DES
46833 allows only cipher suites that use AES or 3DES.
46836 For <option>tls_require_ciphers</option> the recognized names are AES_256, AES_128, AES
46837 (both of the preceding), 3DES, ARCFOUR_128, ARCFOUR_40, and ARCFOUR (both of
46838 the preceding). The default list does not contain all of these; it just has
46839 AES_256, AES_128, 3DES, and ARCFOUR_128.
46842 For <option>gnutls_require_kx</option>, the recognized names are DHE_RSA, RSA (which
46843 includes DHE_RSA), DHE_DSS, and DHE (which includes both DHE_RSA and
46844 DHE_DSS). The default list contains RSA, DHE_DSS, DHE_RSA.
46847 For <option>gnutls_require_mac</option>, the recognized names are SHA (synonym SHA1), and
46848 MD5. The default list contains SHA, MD5.
46851 For <option>gnutls_require_protocols</option>, the recognized names are TLS1 and SSL3.
46852 The default list contains TLS1, SSL3.
46855 In a server, the order of items in these lists is unimportant. The server
46856 advertises the availability of all the relevant cipher suites. However, in a
46857 client, the order in the <option>tls_require_ciphers</option> list specifies a preference
46858 order for the cipher algorithms. The first one in the client’s list that is
46859 also advertised by the server is tried first. The default order is as listed
46863 <section id="SECID182">
46864 <title>Configuring an Exim server to use TLS</title>
46866 <indexterm role="concept">
46867 <primary>TLS</primary>
46868 <secondary>configuring an Exim server</secondary>
46870 When Exim has been built with TLS support, it advertises the availability of
46871 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
46872 but not to any others. The default value of this option is unset, which means
46873 that STARTTLS is not advertised at all. This default is chosen because you
46874 need to set some other options in order to make TLS available, and also it is
46875 sensible for systems that want to use TLS only as a client.
46878 If a client issues a STARTTLS command and there is some configuration
46879 problem in the server, the command is rejected with a 454 error. If the client
46880 persists in trying to issue SMTP commands, all except QUIT are rejected
46883 <literallayout class="monospaced">
46884 554 Security failure
46887 If a STARTTLS command is issued within an existing TLS session, it is
46888 rejected with a 554 error code.
46891 To enable TLS operations on a server, you must set <option>tls_advertise_hosts</option> to
46892 match some hosts. You can, of course, set it to * to match all hosts.
46893 However, this is not all you need to do. TLS sessions to a server won’t work
46894 without some further configuration at the server end.
46897 It is rumoured that all existing clients that support TLS/SSL use RSA
46898 encryption. To make this work you need to set, in the server,
46900 <literallayout class="monospaced">
46901 tls_certificate = /some/file/name
46902 tls_privatekey = /some/file/name
46905 These options are, in fact, expanded strings, so you can make them depend on
46906 the identity of the client that is connected if you wish. The first file
46907 contains the server’s X509 certificate, and the second contains the private key
46908 that goes with it. These files need to be readable by the Exim user, and must
46909 always be given as full path names. They can be the same file if both the
46910 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
46911 set, or if its expansion is forced to fail or results in an empty string, this
46912 is assumed to be the case. The certificate file may also contain intermediate
46913 certificates that need to be sent to the client to enable it to authenticate
46914 the server’s certificate.
46917 If you do not understand about certificates and keys, please try to find a
46918 source of this background information, which is not Exim-specific. (There are a
46919 few comments below in section <xref linkend="SECTcerandall"/>.)
46922 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client –
46923 they apply only in the case of a server. If you need to use a certificate in an
46924 Exim client, you must set the options of the same names in an <command>smtp</command>
46928 With just these options, an Exim server will be able to use TLS. It does not
46929 require the client to have a certificate (but see below for how to insist on
46930 this). There is one other option that may be needed in other situations. If
46932 <literallayout class="monospaced">
46933 tls_dhparam = /some/file/name
46936 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
46937 with the parameters contained in the file. This increases the set of cipher
46938 suites that the server supports. See the command
46940 <literallayout class="monospaced">
46944 for a way of generating this data. At present, <option>tls_dhparam</option> is used only
46945 when Exim is linked with OpenSSL. It is ignored if GnuTLS is being used.
46948 The strings supplied for these three options are expanded every time a client
46949 host connects. It is therefore possible to use different certificates and keys
46950 for different hosts, if you so wish, by making use of the client’s IP address
46951 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
46952 forced to fail, Exim behaves as if the option is not set.
46955 <indexterm role="concept">
46956 <primary>cipher</primary>
46957 <secondary>logging</secondary>
46959 <indexterm role="concept">
46960 <primary>log</primary>
46961 <secondary>TLS cipher</secondary>
46963 <indexterm role="variable">
46964 <primary><varname>$tls_cipher</varname></primary>
46966 The variable <varname>$tls_cipher</varname> is set to the cipher suite that was negotiated for
46967 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
46968 incoming message (by default – you can, of course, change this), and it is
46969 also included in the log line that records a message’s arrival, keyed by
46970 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
46971 condition can be used to test for specific cipher suites in ACLs.
46972 (For outgoing SMTP deliveries, <varname>$tls_cipher</varname> is reset – see section
46973 <xref linkend="SECID185"/>.)
46976 Once TLS has been established, the ACLs that run for subsequent SMTP commands
46977 can check the name of the cipher suite and vary their actions accordingly. The
46978 cipher suite names vary, depending on which TLS library is being used. For
46979 example, OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other
46980 contexts is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL or GnuTLS
46981 documentation for more details.
46984 <section id="SECID183">
46985 <title>Requesting and verifying client certificates</title>
46987 <indexterm role="concept">
46988 <primary>certificate</primary>
46989 <secondary>verification of client</secondary>
46991 <indexterm role="concept">
46992 <primary>TLS</primary>
46993 <secondary>client certificate verification</secondary>
46995 If you want an Exim server to request a certificate when negotiating a TLS
46996 session with a client, you must set either <option>tls_verify_hosts</option> or
46997 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
46998 apply to all TLS connections. For any host that matches one of these options,
46999 Exim requests a certificate as part of the setup of the TLS session. The
47000 contents of the certificate are verified by comparing it with a list of
47001 expected certificates. These must be available in a file or,
47002 for OpenSSL only (not GnuTLS), a directory, identified by
47003 <option>tls_verify_certificates</option>.
47006 A file can contain multiple certificates, concatenated end to end. If a
47009 each certificate must be in a separate file, with a name (or a symbolic link)
47010 of the form <<emphasis>hash</emphasis>>.0, where <<emphasis>hash</emphasis>> is a hash value constructed from the
47011 certificate. You can compute the relevant hash by running the command
47013 <literallayout class="monospaced">
47014 openssl x509 -hash -noout -in /cert/file
47017 where <filename>/cert/file</filename> contains a single certificate.
47020 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
47021 what happens if the client does not supply a certificate, or if the certificate
47022 does not match any of the certificates in the collection named by
47023 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
47024 attempt to set up a TLS session is aborted, and the incoming connection is
47025 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
47026 session continues. ACLs that run for subsequent SMTP commands can detect the
47027 fact that no certificate was verified, and vary their actions accordingly. For
47028 example, you can insist on a certificate before accepting a message for
47029 relaying, but not when the message is destined for local delivery.
47032 <indexterm role="variable">
47033 <primary><varname>$tls_peerdn</varname></primary>
47035 When a client supplies a certificate (whether it verifies or not), the value of
47036 the Distinguished Name of the certificate is made available in the variable
47037 <varname>$tls_peerdn</varname> during subsequent processing of the message.
47040 <indexterm role="concept">
47041 <primary>log</primary>
47042 <secondary>distinguished name</secondary>
47044 Because it is often a long text string, it is not included in the log line or
47045 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
47046 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
47047 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
47048 certificate is supplied, <varname>$tls_peerdn</varname> is empty.
47051 <section id="SECID184">
47052 <title>Revoked certificates</title>
47054 <indexterm role="concept">
47055 <primary>TLS</primary>
47056 <secondary>revoked certificates</secondary>
47058 <indexterm role="concept">
47059 <primary>revocation list</primary>
47061 <indexterm role="concept">
47062 <primary>certificate</primary>
47063 <secondary>revocation list</secondary>
47065 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
47066 certificates are revoked. If you have such a list, you can pass it to an Exim
47067 server using the global option called <option>tls_crl</option> and to an Exim client using
47068 an identically named option for the <command>smtp</command> transport. In each case, the value
47069 of the option is expanded and must then be the name of a file that contains a
47073 <section id="SECID185">
47074 <title>Configuring an Exim client to use TLS</title>
47076 <indexterm role="concept">
47077 <primary>cipher</primary>
47078 <secondary>logging</secondary>
47080 <indexterm role="concept">
47081 <primary>log</primary>
47082 <secondary>TLS cipher</secondary>
47084 <indexterm role="concept">
47085 <primary>log</primary>
47086 <secondary>distinguished name</secondary>
47088 <indexterm role="concept">
47089 <primary>TLS</primary>
47090 <secondary>configuring an Exim client</secondary>
47092 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
47093 deliveries as well as to incoming, the latter one causing logging of the
47094 server certificate’s DN. The remaining client configuration for TLS is all
47095 within the <command>smtp</command> transport.
47098 It is not necessary to set any options to have TLS work in the <command>smtp</command>
47099 transport. If Exim is built with TLS support, and TLS is advertised by a
47100 server, the <command>smtp</command> transport always tries to start a TLS session. However,
47101 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
47102 transport) to a list of server hosts for which TLS should not be used.
47105 If you do not want Exim to attempt to send messages unencrypted when an attempt
47106 to set up an encrypted connection fails in any way, you can set
47107 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
47108 those hosts, delivery is always deferred if an encrypted connection cannot be
47109 set up. If there are any other hosts for the address, they are tried in the
47113 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
47114 the message unencrypted. It always does this if the response to STARTTLS is
47115 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
47116 session after a success response code, what happens is controlled by the
47117 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
47118 delivery to this host is deferred, and other hosts (if available) are tried. If
47119 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
47120 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
47121 negotiation fails, Exim closes the current connection (because it is in an
47122 unknown state), opens a new one to the same host, and then tries the delivery
47126 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
47127 transport provide the client with a certificate, which is passed to the server
47128 if it requests it. If the server is Exim, it will request a certificate only if
47129 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client.
47132 If the <option>tls_verify_certificates</option> option is set on the <command>smtp</command> transport, it
47133 must name a file or,
47134 for OpenSSL only (not GnuTLS), a directory, that contains a collection of
47135 expected server certificates. The client verifies the server’s certificate
47136 against this collection, taking into account any revoked certificates that are
47137 in the list defined by <option>tls_crl</option>.
47141 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
47142 list of permitted cipher suites. If either of these checks fails, delivery to
47143 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
47144 alternative hosts, if any.
47146 <para revisionflag="changed">
47147 <emphasis role="bold">Note</emphasis>:
47148 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
47149 is operating as a client. Exim does not assume that a server certificate (set
47150 by the global options of the same name) should also be used when operating as a
47154 <indexterm role="variable">
47155 <primary><varname>$host</varname></primary>
47157 <indexterm role="variable">
47158 <primary><varname>$host_address</varname></primary>
47160 All the TLS options in the <command>smtp</command> transport are expanded before use, with
47161 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
47162 which the client is connected. Forced failure of an expansion causes Exim to
47163 behave as if the relevant option were unset.
47166 <indexterm role="variable">
47167 <primary><varname>$tls_cipher</varname></primary>
47169 <indexterm role="variable">
47170 <primary><varname>$tls_peerdn</varname></primary>
47172 Before an SMTP connection is established, the <varname>$tls_cipher</varname> and <varname>$tls_peerdn</varname>
47173 variables are emptied. (Until the first connection, they contain the values
47174 that were set when the message was received.) If STARTTLS is subsequently
47175 successfully obeyed, these variables are set to the relevant values for the
47176 outgoing connection.
47179 <section id="SECTmulmessam">
47180 <title>Multiple messages on the same encrypted TCP/IP connection</title>
47182 <indexterm role="concept">
47183 <primary>multiple SMTP deliveries with TLS</primary>
47185 <indexterm role="concept">
47186 <primary>TLS</primary>
47187 <secondary>multiple message deliveries</secondary>
47189 Exim sends multiple messages down the same TCP/IP connection by starting up
47190 an entirely new delivery process for each message, passing the socket from
47191 one process to the next. This implementation does not fit well with the use
47192 of TLS, because there is quite a lot of state information associated with a TLS
47193 connection, not just a socket identification. Passing all the state information
47194 to a new process is not feasible. Consequently, Exim shuts down an existing TLS
47195 session before passing the socket to a new process. The new process may then
47196 try to start a new TLS session, and if successful, may try to re-authenticate
47197 if AUTH is in use, before sending the next message.
47200 The RFC is not clear as to whether or not an SMTP session continues in clear
47201 after TLS has been shut down, or whether TLS may be restarted again later, as
47202 just described. However, if the server is Exim, this shutdown and
47203 reinitialization works. It is not known which (if any) other servers operate
47204 successfully if the client closes a TLS session and continues with unencrypted
47205 SMTP, but there are certainly some that do not work. For such servers, Exim
47206 should not pass the socket to another process, because the failure of the
47207 subsequent attempt to use it would cause Exim to record a temporary host error,
47208 and delay other deliveries to that host.
47211 To test for this case, Exim sends an EHLO command to the server after
47212 closing down the TLS session. If this fails in any way, the connection is
47213 closed instead of being passed to a new delivery process, but no retry
47214 information is recorded.
47217 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
47218 <command>smtp</command> transport to match those hosts for which Exim should not pass
47219 connections to new processes if TLS has been used.
47222 <section id="SECTcerandall">
47223 <title>Certificates and all that</title>
47225 <indexterm role="concept">
47226 <primary>certificate</primary>
47227 <secondary>references to discussion</secondary>
47229 In order to understand fully how TLS works, you need to know about
47230 certificates, certificate signing, and certificate authorities. This is not the
47231 place to give a tutorial, especially as I do not know very much about it
47232 myself. Some helpful introduction can be found in the FAQ for the SSL addition
47233 to Apache, currently at
47236 <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>
47239 Other parts of the <emphasis>modssl</emphasis> documentation are also helpful, and have
47240 links to further files.
47241 Eric Rescorla’s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
47242 0-201-61598-3), contains both introductory and more in-depth descriptions.
47243 Some sample programs taken from the book are available from
47246 <emphasis role="bold"><ulink url="http://www.rtfm.com/openssl-examples/">http://www.rtfm.com/openssl-examples/</ulink></emphasis>
47249 <section id="SECID186">
47250 <title>Certificate chains</title>
47252 The file named by <option>tls_certificate</option> may contain more than one
47253 certificate. This is useful in the case where the certificate that is being
47254 sent is validated by an intermediate certificate which the other end does
47255 not have. Multiple certificates must be in the correct order in the file.
47256 First the host’s certificate itself, then the first intermediate
47257 certificate to validate the issuer of the host certificate, then the next
47258 intermediate certificate to validate the issuer of the first intermediate
47259 certificate, and so on, until finally (optionally) the root certificate.
47260 The root certificate must already be trusted by the recipient for
47261 validation to succeed, of course, but if it’s not preinstalled, sending the
47262 root certificate along with the rest makes it available for the user to
47263 install if the receiving end is a client MUA that can interact with a user.
47266 <section id="SECID187">
47267 <title>Self-signed certificates</title>
47269 <indexterm role="concept">
47270 <primary>certificate</primary>
47271 <secondary>self-signed</secondary>
47273 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
47274 with OpenSSL, like this:
47276 <literallayout class="monospaced">
47277 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
47281 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
47282 delimited and so can be identified independently. The <option>-days</option> option
47283 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
47284 important: if you do not set it, the key is encrypted with a passphrase
47285 that you are prompted for, and any use that is made of the key causes more
47286 prompting for the passphrase. This is not helpful if you are going to use
47287 this certificate and key in an MTA, where prompting is not possible.
47290 A self-signed certificate made in this way is sufficient for testing, and
47291 may be adequate for all your requirements if you are mainly interested in
47292 encrypting transfers, and not in secure identification.
47295 However, many clients require that the certificate presented by the server be a
47296 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
47297 certificate. In this situation, the self-signed certificate described above
47298 must be installed on the client host as a trusted root <emphasis>certification
47299 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
47300 signed with that self-signed certificate.
47303 For information on creating self-signed CA certificates and using them to sign
47304 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
47305 Open-source PKI book, available online at
47306 <emphasis role="bold"><ulink url="http://ospkibook.sourceforge.net/">http://ospkibook.sourceforge.net/</ulink></emphasis>.
47307 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
47308 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
47313 <chapter id="CHAPACL">
47314 <title>Access control lists</title>
47316 <indexterm role="concept" id="IIDacl" class="startofrange">
47317 <primary>access control lists (ACLs)</primary>
47318 <secondary>description</secondary>
47320 <indexterm role="concept">
47321 <primary>control of incoming mail</primary>
47323 <indexterm role="concept">
47324 <primary>message</primary>
47325 <secondary>controlling incoming</secondary>
47327 <indexterm role="concept">
47328 <primary>policy control</primary>
47329 <secondary>access control lists</secondary>
47331 Access Control Lists (ACLs) are defined in a separate section of the run time
47332 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
47333 name, terminated by a colon. Here is a complete ACL section that contains just
47334 one very small ACL:
47336 <literallayout class="monospaced">
47339 accept hosts = one.host.only
47342 You can have as many lists as you like in the ACL section, and the order in
47343 which they appear does not matter. The lists are self-terminating.
47346 The majority of ACLs are used to control Exim’s behaviour when it receives
47347 certain SMTP commands. This applies both to incoming TCP/IP connections, and
47348 when a local process submits a message using SMTP by specifying the <option>-bs</option>
47349 option. The most common use is for controlling which recipients are accepted
47350 in incoming messages. In addition, you can define an ACL that is used to check
47351 local non-SMTP messages. The default configuration file contains an example of
47352 a realistic ACL for checking RCPT commands. This is discussed in chapter
47353 <xref linkend="CHAPdefconfil"/>.
47355 <section id="SECID188">
47356 <title>Testing ACLs</title>
47358 The <option>-bh</option> command line option provides a way of testing your ACL
47359 configuration locally by running a fake SMTP session with which you interact.
47360 The host <emphasis>relay-test.mail-abuse.org</emphasis> provides a service for checking your
47361 relaying configuration (see section <xref linkend="SECTcheralcon"/> for more details).
47364 <section id="SECID189">
47365 <title>Specifying when ACLs are used</title>
47367 <indexterm role="concept">
47368 <primary>access control lists (ACLs)</primary>
47369 <secondary>options for specifying</secondary>
47371 In order to cause an ACL to be used, you have to name it in one of the relevant
47372 options in the main part of the configuration. These options are:
47373 <indexterm role="concept">
47374 <primary>AUTH</primary>
47375 <secondary>ACL for</secondary>
47377 <indexterm role="concept">
47378 <primary>DATA</primary>
47379 <secondary>ACLs for</secondary>
47381 <indexterm role="concept">
47382 <primary>ETRN</primary>
47383 <secondary>ACL for</secondary>
47385 <indexterm role="concept">
47386 <primary>EXPN</primary>
47387 <secondary>ACL for</secondary>
47389 <indexterm role="concept">
47390 <primary>HELO</primary>
47391 <secondary>ACL for</secondary>
47393 <indexterm role="concept">
47394 <primary>EHLO</primary>
47395 <secondary>ACL for</secondary>
47397 <indexterm role="concept">
47398 <primary>MAIL</primary>
47399 <secondary>ACL for</secondary>
47401 <indexterm role="concept">
47402 <primary>QUIT, ACL for</primary>
47404 <indexterm role="concept">
47405 <primary>RCPT</primary>
47406 <secondary>ACL for</secondary>
47408 <indexterm role="concept">
47409 <primary>STARTTLS, ACL for</primary>
47411 <indexterm role="concept">
47412 <primary>VRFY</primary>
47413 <secondary>ACL for</secondary>
47415 <indexterm role="concept">
47416 <primary>SMTP</primary>
47417 <secondary>connection, ACL for</secondary>
47419 <indexterm role="concept">
47420 <primary>non-SMTP messages</primary>
47421 <secondary>ACLs for</secondary>
47423 <indexterm role="concept">
47424 <primary>MIME content scanning</primary>
47425 <secondary>ACL for</secondary>
47428 <informaltable frame="none">
47429 <tgroup cols="2" colsep="0" rowsep="0">
47430 <colspec colwidth="140pt" align="left"/>
47431 <colspec colwidth="254pt" align="left"/>
47434 <entry> <option>acl_not_smtp</option></entry>
47435 <entry>ACL for non-SMTP messages</entry>
47438 <entry> <option>acl_not_smtp_mime</option></entry>
47439 <entry>ACL for non-SMTP MIME parts</entry>
47442 <entry> <option>acl_not_smtp_start</option></entry>
47443 <entry>ACL at start of non-SMTP message</entry>
47446 <entry> <option>acl_smtp_auth</option></entry>
47447 <entry>ACL for AUTH</entry>
47450 <entry> <option>acl_smtp_connect</option></entry>
47451 <entry>ACL for start of SMTP connection</entry>
47454 <entry> <option>acl_smtp_data</option></entry>
47455 <entry>ACL after DATA is complete</entry>
47458 <entry> <option>acl_smtp_etrn</option></entry>
47459 <entry>ACL for ETRN</entry>
47462 <entry> <option>acl_smtp_expn</option></entry>
47463 <entry>ACL for EXPN</entry>
47466 <entry> <option>acl_smtp_helo</option></entry>
47467 <entry>ACL for HELO or EHLO</entry>
47470 <entry> <option>acl_smtp_mail</option></entry>
47471 <entry>ACL for MAIL</entry>
47474 <entry> <option>acl_smtp_mailauth</option></entry>
47475 <entry>ACL for the AUTH parameter of MAIL</entry>
47478 <entry> <option>acl_smtp_mime</option></entry>
47479 <entry>ACL for content-scanning MIME parts</entry>
47482 <entry> <option>acl_smtp_notquit</option></entry>
47483 <entry>ACL for non-QUIT terminations</entry>
47486 <entry> <option>acl_smtp_predata</option></entry>
47487 <entry>ACL at start of DATA command</entry>
47490 <entry> <option>acl_smtp_quit</option></entry>
47491 <entry>ACL for QUIT</entry>
47494 <entry> <option>acl_smtp_rcpt</option></entry>
47495 <entry>ACL for RCPT</entry>
47498 <entry> <option>acl_smtp_starttls</option></entry>
47499 <entry>ACL for STARTTLS</entry>
47502 <entry> <option>acl_smtp_vrfy</option></entry>
47503 <entry>ACL for VRFY</entry>
47509 For example, if you set
47511 <literallayout class="monospaced">
47512 acl_smtp_rcpt = small_acl
47515 the little ACL defined above is used whenever Exim receives a RCPT command
47516 in an SMTP dialogue. The majority of policy tests on incoming messages can be
47517 done when RCPT commands arrive. A rejection of RCPT should cause the
47518 sending MTA to give up on the recipient address contained in the RCPT
47519 command, whereas rejection at other times may cause the client MTA to keep on
47520 trying to deliver the message. It is therefore recommended that you do as much
47521 testing as possible at RCPT time.
47524 <section id="SECID190">
47525 <title>The non-SMTP ACLs</title>
47527 <indexterm role="concept">
47528 <primary>non-SMTP messages</primary>
47529 <secondary>ACLs for</secondary>
47531 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
47532 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
47533 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
47534 the state of the SMTP connection such as encryption and authentication) are not
47535 relevant and are forbidden in these ACLs. However, the sender and recipients
47536 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
47537 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
47538 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
47539 in any of these ACLs.
47542 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
47543 non-SMTP message, before any of the message has been read. (This is the
47544 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) In the case of
47545 batched SMTP input, it runs after the DATA command has been reached. The
47546 result of this ACL is ignored; it cannot be used to reject a message. If you
47547 really need to, you could set a value in an ACL variable here and reject based
47548 on that in the <option>acl_not_smtp</option> ACL. However, this ACL can be used to set
47549 controls, and in particular, it can be used to set
47551 <literallayout class="monospaced">
47552 control = suppress_local_fixups
47555 This cannot be used in the other non-SMTP ACLs because by the time they are
47556 run, it is too late.
47559 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
47560 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
47563 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
47564 kind of rejection is treated as permanent, because there is no way of sending a
47565 temporary error for these kinds of message.
47568 <section id="SECID191">
47569 <title>The SMTP connect ACL</title>
47571 <indexterm role="concept">
47572 <primary>SMTP</primary>
47573 <secondary>connection, ACL for</secondary>
47575 <indexterm role="option">
47576 <primary><option>smtp_banner</option></primary>
47578 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
47579 session, after the test specified by <option>host_reject_connection</option> (which is now
47580 an anomaly) and any TCP Wrappers testing (if configured). If the connection is
47581 accepted by an <option>accept</option> verb that has a <option>message</option> modifier, the contents of
47582 the message override the banner message that is otherwise specified by the
47583 <option>smtp_banner</option> option.
47586 <section id="SECID192">
47587 <title>The EHLO/HELO ACL</title>
47589 <indexterm role="concept">
47590 <primary>EHLO</primary>
47591 <secondary>ACL for</secondary>
47593 <indexterm role="concept">
47594 <primary>HELO</primary>
47595 <secondary>ACL for</secondary>
47597 The ACL test specified by <option>acl_smtp_helo</option> happens when the client issues an
47598 EHLO or HELO command, after the tests specified by <option>helo_accept_junk_hosts</option>,
47599 <option>helo_allow_chars</option>, <option>helo_verify_hosts</option>, and <option>helo_try_verify_hosts</option>.
47600 Note that a client may issue more than one EHLO or HELO command in an SMTP
47601 session, and indeed is required to issue a new EHLO or HELO after successfully
47602 setting up encryption following a STARTTLS command.
47605 If the command is accepted by an <option>accept</option> verb that has a <option>message</option>
47606 modifier, the message may not contain more than one line (it will be truncated
47607 at the first newline and a panic logged if it does). Such a message cannot
47608 affect the EHLO options that are listed on the second and subsequent lines of
47612 <section id="SECID193">
47613 <title>The DATA ACLs</title>
47615 <indexterm role="concept">
47616 <primary>DATA</primary>
47617 <secondary>ACLs for</secondary>
47619 Two ACLs are associated with the DATA command, because it is two-stage
47620 command, with two responses being sent to the client.
47621 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
47622 is obeyed. This gives you control after all the RCPT commands, but before
47623 the message itself is received. It offers the opportunity to give a negative
47624 response to the DATA command before the data is transmitted. Header lines
47625 added by MAIL or RCPT ACLs are not visible at this time, but any that
47626 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
47629 You cannot test the contents of the message, for example, to verify addresses
47630 in the headers, at RCPT time or when the DATA command is received. Such
47631 tests have to appear in the ACL that is run after the message itself has been
47632 received, before the final response to the DATA command is sent. This is
47633 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
47634 associated with the DATA command.
47637 For both of these ACLs, it is not possible to reject individual recipients. An
47638 error response rejects the entire message. Unfortunately, it is known that some
47639 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
47640 before or after the data) correctly – they keep the message on their queues
47641 and try again later, but that is their problem, though it does waste some of
47645 <section id="SECID194">
47646 <title>The SMTP MIME ACL</title>
47648 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
47649 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
47652 <section id="SECTQUITACL">
47653 <title>The QUIT ACL</title>
47655 <indexterm role="concept">
47656 <primary>QUIT, ACL for</primary>
47658 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
47659 does not affect the response code to QUIT, which is always 221. Thus, the ACL
47660 does not in fact control any access. For this reason, the only verbs that are
47661 permitted are <option>accept</option> and <option>warn</option>.
47664 This ACL can be used for tasks such as custom logging at the end of an SMTP
47665 session. For example, you can use ACL variables in other ACLs to count
47666 messages, recipients, etc., and log the totals at QUIT time using one or
47667 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
47670 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
47671 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
47674 You do not need to have a final <option>accept</option>, but if you do, you can use a
47675 <option>message</option> modifier to specify custom text that is sent as part of the 221
47679 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
47680 failure (for example, failure to open a log file, or when Exim is bombing out
47681 because it has detected an unrecoverable error), all SMTP commands from the
47682 client are given temporary error responses until QUIT is received or the
47683 connection is closed. In these special cases, the QUIT ACL does not run.
47686 <section id="SECTNOTQUITACL" revisionflag="changed">
47687 <title>The not-QUIT ACL</title>
47688 <para revisionflag="changed">
47689 <indexterm role="variable">
47690 <primary><varname>$acl_smtp_notquit</varname></primary>
47692 The not-QUIT ACL, specified by <option>acl_smtp_notquit</option>, is run in most cases when
47693 an SMTP session ends without sending QUIT. However, when Exim itself is is bad
47694 trouble, such as being unable to write to its log files, this ACL is not run,
47695 because it might try to do things (such as write to log files) that make the
47696 situation even worse.
47699 Like the QUIT ACL, this ACL is provided to make it possible to do customized
47700 logging or to gather statistics, and its outcome is ignored. The <option>delay</option>
47701 modifier is forbidden in this ACL, and the only permitted verbs are <option>accept</option>
47702 and <option>warn</option>.
47705 <indexterm role="variable">
47706 <primary><varname>$smtp_notquit_reason</varname></primary>
47708 When the not-QUIT ACL is running, the variable <varname>$smtp_notquit_reason</varname> is set
47709 to a string that indicates the reason for the termination of the SMTP
47710 connection. The possible values are:
47712 <informaltable frame="none">
47713 <tgroup cols="2" colsep="0" rowsep="0">
47714 <colspec colwidth="196pt" align="left"/>
47715 <colspec colwidth="254pt" align="left"/>
47718 <entry> <literal>acl-drop</literal></entry>
47719 <entry>Another ACL issued a <option>drop</option> command</entry>
47722 <entry> <literal>bad-commands</literal></entry>
47723 <entry>Too many unknown or non-mail commands</entry>
47726 <entry> <literal>command-timeout</literal></entry>
47727 <entry>Timeout while reading SMTP commands</entry>
47730 <entry> <literal>connection-lost</literal></entry>
47731 <entry>The SMTP connection has been lost</entry>
47734 <entry> <literal>data-timeout</literal></entry>
47735 <entry>Timeout while reading message data</entry>
47738 <entry> <literal>local-scan-error</literal></entry>
47739 <entry>The <function>local_scan()</function> function crashed</entry>
47742 <entry> <literal>local-scan-timeout</literal></entry>
47743 <entry>The <function>local_scan()</function> function timed out</entry>
47746 <entry> <literal>signal-exit</literal></entry>
47747 <entry>SIGTERM or SIGINT</entry>
47750 <entry> <literal>synchronization-error</literal></entry>
47751 <entry>SMTP synchronization error</entry>
47754 <entry> <literal>tls-failed</literal></entry>
47755 <entry>TLS failed to start</entry>
47761 In most cases when an SMTP connection is closed without having received QUIT,
47762 Exim sends an SMTP response message before actually closing the connection.
47763 With the exception of the <literal>acl-drop</literal> case, the default message can be
47764 overridden by the <option>message</option> modifier in the not-QUIT ACL. In the case of a
47765 <option>drop</option> verb in another ACL, it is the message from the other ACL that is
47769 <section id="SECID195">
47770 <title>Finding an ACL to use</title>
47772 <indexterm role="concept">
47773 <primary>access control lists (ACLs)</primary>
47774 <secondary>finding which to use</secondary>
47776 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
47777 you can use different ACLs in different circumstances. For example,
47779 <literallayout class="monospaced">
47780 acl_smtp_rcpt = ${if ={25}{$interface_port} \
47781 {acl_check_rcpt} {acl_check_rcpt_submit} }
47784 In the default configuration file there are some example settings for
47785 providing an RFC 4409 message submission service on port 587 and a
47786 non-standard <quote>smtps</quote> service on port 465. You can use a string
47787 expansion like this to choose an ACL for MUAs on these ports which is
47788 more appropriate for this purpose than the default ACL on port 25.
47791 The expanded string does not have to be the name of an ACL in the
47792 configuration file; there are other possibilities. Having expanded the
47793 string, Exim searches for an ACL as follows:
47798 If the string begins with a slash, Exim uses it as a file name, and reads its
47799 contents as an ACL. The lines are processed in the same way as lines in the
47800 Exim configuration file. In particular, continuation lines are supported, blank
47801 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
47802 If the file does not exist or cannot be read, an error occurs (typically
47803 causing a temporary failure of whatever caused the ACL to be run). For example:
47805 <literallayout class="monospaced">
47806 acl_smtp_data = /etc/acls/\
47807 ${lookup{$sender_host_address}lsearch\
47808 {/etc/acllist}{$value}{default}}
47811 This looks up an ACL file to use on the basis of the host’s IP address, falling
47812 back to a default if the lookup fails. If an ACL is successfully read from a
47813 file, it is retained in memory for the duration of the Exim process, so that it
47814 can be re-used without having to re-read the file.
47819 If the string does not start with a slash, and does not contain any spaces,
47820 Exim searches the ACL section of the configuration for an ACL whose name
47821 matches the string.
47826 If no named ACL is found, or if the string contains spaces, Exim parses
47827 the string as an inline ACL. This can save typing in cases where you just
47828 want to have something like
47830 <literallayout class="monospaced">
47831 acl_smtp_vrfy = accept
47834 in order to allow free use of the VRFY command. Such a string may contain
47835 newlines; it is processed in the same way as an ACL that is read from a file.
47840 <section id="SECID196">
47841 <title>ACL return codes</title>
47843 <indexterm role="concept">
47844 <primary>access control lists (ACLs)</primary>
47845 <secondary>return codes</secondary>
47847 Except for the QUIT ACL, which does not affect the SMTP return code (see
47848 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
47849 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
47850 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
47851 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
47852 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
47853 This also causes a 4<emphasis>xx</emphasis> return code.
47856 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
47857 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
47858 submitters of non-SMTP messages.
47861 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
47862 has the effect of <quote>accept</quote>, but causes either the entire message or an
47863 individual recipient address to be discarded. In other words, it is a
47864 blackholing facility. Use it with care.
47867 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
47868 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
47869 RCPT ACL is to discard just the one recipient address. If there are no
47870 recipients left when the message’s data is received, the DATA ACL is not
47871 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
47872 remaining recipients. The <quote>discard</quote> return is not permitted for the
47873 <option>acl_smtp_predata</option> ACL.
47876 <indexterm role="concept">
47877 <primary><function>local_scan()</function> function</primary>
47878 <secondary>when all recipients discarded</secondary>
47880 The <function>local_scan()</function> function is always run, even if there are no remaining
47881 recipients; it may create new recipients.
47884 <section id="SECID197">
47885 <title>Unset ACL options</title>
47887 <indexterm role="concept">
47888 <primary>access control lists (ACLs)</primary>
47889 <secondary>unset options</secondary>
47891 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
47892 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
47893 not defined at all. For any defined ACL, the default action when control
47894 reaches the end of the ACL statements is <quote>deny</quote>.
47897 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
47898 these two are ACLs that are used only for their side effects. They cannot be
47899 used to accept or reject anything.
47902 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
47903 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
47904 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
47905 when the ACL is not defined is <quote>accept</quote>.
47908 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
47909 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
47910 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
47911 messages over an SMTP connection. For an example, see the ACL in the default
47912 configuration file.
47915 <section id="SECID198">
47916 <title>Data for message ACLs</title>
47918 <indexterm role="concept">
47919 <primary>access control lists (ACLs)</primary>
47920 <secondary>data for message ACL</secondary>
47922 <indexterm role="variable">
47923 <primary><varname>$domain</varname></primary>
47925 <indexterm role="variable">
47926 <primary><varname>$local_part</varname></primary>
47928 <indexterm role="variable">
47929 <primary><varname>$sender_address</varname></primary>
47931 <indexterm role="variable">
47932 <primary><varname>$sender_host_address</varname></primary>
47934 <indexterm role="variable">
47935 <primary><varname>$smtp_command</varname></primary>
47937 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
47938 that contain information about the host and the message’s sender (for example,
47939 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
47940 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
47941 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
47942 is available in <varname>$smtp_command</varname>.
47945 When an ACL for the AUTH parameter of MAIL is running, the variables that
47946 contain information about the host are set, but <varname>$sender_address</varname> is not yet
47947 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
47951 <indexterm role="variable">
47952 <primary><varname>$message_size</varname></primary>
47954 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
47955 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
47956 that parameter is not given. The value is updated to the true message size by
47957 the time the final DATA ACL is run (after the message data has been
47961 <indexterm role="variable">
47962 <primary><varname>$rcpt_count</varname></primary>
47964 <indexterm role="variable">
47965 <primary><varname>$recipients_count</varname></primary>
47967 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
47968 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
47969 accepted, so while an ACL for RCPT is being processed, it contains the number
47970 of previously accepted recipients. At DATA time (for both the DATA ACLs),
47971 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
47972 <varname>$recipients_count</varname> contains the total number of accepted recipients.
47975 <section id="SECTdatfornon">
47976 <title>Data for non-message ACLs</title>
47978 <indexterm role="concept">
47979 <primary>access control lists (ACLs)</primary>
47980 <secondary>data for non-message ACL</secondary>
47982 <indexterm role="variable">
47983 <primary><varname>$smtp_command_argument</varname></primary>
47985 <indexterm role="variable">
47986 <primary><varname>$smtp_command</varname></primary>
47988 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
47989 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
47990 and the entire SMTP command is available in <varname>$smtp_command</varname>.
47991 These variables can be tested using a <option>condition</option> condition. For example,
47992 here is an ACL for use with AUTH, which insists that either the session is
47993 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
47994 does not permit authentication methods that use cleartext passwords on
47995 unencrypted connections.
47997 <literallayout class="monospaced">
47999 accept encrypted = *
48000 accept condition = ${if eq{${uc:$smtp_command_argument}}\
48002 deny message = TLS encryption or CRAM-MD5 required
48005 (Another way of applying this restriction is to arrange for the authenticators
48006 that use cleartext passwords not to be advertised when the connection is not
48007 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
48008 option to do this.)
48011 <section id="SECID199">
48012 <title>Format of an ACL</title>
48014 <indexterm role="concept">
48015 <primary>access control lists (ACLs)</primary>
48016 <secondary>format of</secondary>
48018 <indexterm role="concept">
48019 <primary>access control lists (ACLs)</primary>
48020 <secondary>verbs, definition of</secondary>
48022 An individual ACL consists of a number of statements. Each statement starts
48023 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
48024 Modifiers can change the way the verb operates, define error and log messages,
48025 set variables, insert delays, and vary the processing of accepted messages.
48028 If all the conditions are met, the verb is obeyed. The same condition may be
48029 used (with different arguments) more than once in the same statement. This
48030 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
48033 <literallayout class="monospaced">
48034 deny dnslists = list1.example
48035 dnslists = list2.example
48038 If there are no conditions, the verb is always obeyed. Exim stops evaluating
48039 the conditions and modifiers when it reaches a condition that fails. What
48040 happens then depends on the verb (and in one case, on a special modifier). Not
48041 all the conditions make sense at every testing point. For example, you cannot
48042 test a sender address in the ACL that is run for a VRFY command.
48045 <section id="SECID200">
48046 <title>ACL verbs</title>
48048 The ACL verbs are as follows:
48053 <indexterm role="concept">
48054 <primary><option>accept</option> ACL verb</primary>
48056 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
48057 of the conditions are not met, what happens depends on whether <option>endpass</option>
48058 appears among the conditions (for syntax see below). If the failing condition
48059 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
48060 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
48061 check a RCPT command:
48063 <literallayout class="monospaced">
48064 accept domains = +local_domains
48069 If the recipient domain does not match the <option>domains</option> condition, control
48070 passes to the next statement. If it does match, the recipient is verified, and
48071 the command is accepted if verification succeeds. However, if verification
48072 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
48073 <option>endpass</option>.
48076 The <option>endpass</option> feature has turned out to be confusing to many people, so its
48077 use is not recommended nowadays. It is always possible to rewrite an ACL so
48078 that <option>endpass</option> is not needed, and it is no longer used in the default
48082 <indexterm role="concept">
48083 <primary><option>message</option> ACL modifier</primary>
48084 <secondary>with <option>accept</option></secondary>
48086 If a <option>message</option> modifier appears on an <option>accept</option> statement, its action
48087 depends on whether or not <option>endpass</option> is present. In the absence of <option>endpass</option>
48088 (when an <option>accept</option> verb either accepts or passes control to the next
48089 statement), <option>message</option> can be used to vary the message that is sent when an
48090 SMTP command is accepted. For example, in a RCPT ACL you could have:
48093 <literal>accept </literal><<emphasis>some conditions</emphasis>>
48094 <literal> message = OK, I will allow you through today</literal>
48097 You can specify an SMTP response code, optionally followed by an <quote>extended
48098 response code</quote> at the start of the message, but the first digit must be the
48099 same as would be sent by default, which is 2 for an <option>accept</option> verb.
48102 If <option>endpass</option> is present in an <option>accept</option> statement, <option>message</option> specifies
48103 an error message that is used when access is denied. This behaviour is retained
48104 for backward compatibility, but current <quote>best practice</quote> is to avoid the use
48105 of <option>endpass</option>.
48110 <indexterm role="concept">
48111 <primary><option>defer</option> ACL verb</primary>
48113 <option>defer</option>: If all the conditions are true, the ACL returns <quote>defer</quote> which, in
48114 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
48115 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
48116 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
48117 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
48118 be used in any ACL, and even for a recipient it might be a simpler approach.
48123 <indexterm role="concept">
48124 <primary><option>deny</option> ACL verb</primary>
48126 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
48127 the conditions are not met, control is passed to the next ACL statement. For
48130 <literallayout class="monospaced">
48131 deny dnslists = blackholes.mail-abuse.org
48134 rejects commands from hosts that are on a DNS black list.
48139 <indexterm role="concept">
48140 <primary><option>discard</option> ACL verb</primary>
48142 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
48143 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
48144 that are concerned with receiving messages. When all the conditions are true,
48145 the sending entity receives a <quote>success</quote> response. However, <option>discard</option> causes
48146 recipients to be discarded. If it is used in an ACL for RCPT, just the one
48147 recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
48148 message’s recipients are discarded. Recipients that are discarded before DATA
48149 do not appear in the log line when the <option>received_recipients</option> log selector is set.
48152 If the <option>log_message</option> modifier is set when <option>discard</option> operates,
48153 its contents are added to the line that is automatically written to the log.
48154 The <option>message</option> modifier operates exactly as it does for <option>accept</option>.
48159 <indexterm role="concept">
48160 <primary><option>drop</option> ACL verb</primary>
48162 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
48163 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
48165 <literallayout class="monospaced">
48166 drop message = I don't take more than 20 RCPTs
48167 condition = ${if > {$rcpt_count}{20}}
48170 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
48171 The connection is always dropped after sending a 550 response.
48176 <indexterm role="concept">
48177 <primary><option>require</option> ACL verb</primary>
48179 <option>require</option>: If all the conditions are met, control is passed to the next ACL
48180 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
48181 example, when checking a RCPT command,
48183 <literallayout class="monospaced">
48184 require message = Sender did not verify
48188 passes control to subsequent statements only if the message’s sender can be
48189 verified. Otherwise, it rejects the command. Note the positioning of the
48190 <option>message</option> modifier, before the <option>verify</option> condition. The reason for this is
48191 discussed in section <xref linkend="SECTcondmodproc"/>.
48196 <indexterm role="concept">
48197 <primary><option>warn</option> ACL verb</primary>
48199 <option>warn</option>: If all the conditions are true, a line specified by the
48200 <option>log_message</option> modifier is written to Exim’s main log. Control always passes
48201 to the next ACL statement. If any condition is false, the log line is not
48202 written. If an identical log line is requested several times in the same
48203 message, only one copy is actually written to the log. If you want to force
48204 duplicates to be written, use the <option>logwrite</option> modifier instead.
48207 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
48208 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
48209 <option>logwrite</option>, and <option>add_header</option>) that appear before the first failing
48210 condition. There is more about adding header lines in section
48211 <xref linkend="SECTaddheadacl"/>.
48214 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
48215 some sort of defer), the log line specified by <option>log_message</option> is not written.
48216 This does not include the case of a forced failure from a lookup, which
48217 is considered to be a successful completion. After a defer, no further
48218 conditions or modifiers in the <option>warn</option> statement are processed. The incident
48219 is logged, and the ACL continues to be processed, from the next statement
48223 <indexterm role="variable">
48224 <primary><varname>$acl_verify_message</varname></primary>
48226 When one of the <option>warn</option> conditions is an address verification that fails, the
48227 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
48228 want this logged, you must set it up explicitly. For example:
48230 <literallayout class="monospaced">
48231 warn !verify = sender
48232 log_message = sender verify failed: $acl_verify_message
48237 At the end of each ACL there is an implicit unconditional <option>deny</option>.
48240 As you can see from the examples above, the conditions and modifiers are
48241 written one to a line, with the first one on the same line as the verb, and
48242 subsequent ones on following lines. If you have a very long condition, you can
48243 continue it onto several physical lines by the usual backslash continuation
48244 mechanism. It is conventional to align the conditions vertically.
48247 <section id="SECTaclvariables">
48248 <title>ACL variables</title>
48250 <indexterm role="concept">
48251 <primary>access control lists (ACLs)</primary>
48252 <secondary>variables</secondary>
48254 There are some special variables that can be set during ACL processing. They
48255 can be used to pass information between different ACLs, different invocations
48256 of the same ACL in the same SMTP connection, and between ACLs and the routers,
48257 transports, and filters that are used to deliver a message. The names of these
48258 variables must begin with <varname>$acl_c</varname> or <varname>$acl_m</varname>, followed either by a digit or
48259 an underscore, but the remainder of the name can be any sequence of
48260 alphanumeric characters and underscores that you choose. There is no limit on
48261 the number of ACL variables. The two sets act as follows:
48266 The values of those variables whose names begin with <varname>$acl_c</varname> persist
48267 throughout an SMTP connection. They are never reset. Thus, a value that is set
48268 while receiving one message is still available when receiving the next message
48269 on the same SMTP connection.
48274 The values of those variables whose names begin with <varname>$acl_m</varname> persist only
48275 while a message is being received. They are reset afterwards. They are also
48276 reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session.
48281 When a message is accepted, the current values of all the ACL variables are
48282 preserved with the message and are subsequently made available at delivery
48283 time. The ACL variables are set by a modifier called <option>set</option>. For example:
48285 <literallayout class="monospaced">
48286 accept hosts = whatever
48287 set acl_m4 = some value
48288 accept authenticated = *
48289 set acl_c_auth = yes
48292 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
48293 be set. If you want to set a variable without taking any action, you can use a
48294 <option>warn</option> verb without any other modifiers or conditions.
48297 <indexterm role="option">
48298 <primary><option>strict_acl_vars</option></primary>
48300 What happens if a syntactically valid but undefined ACL variable is
48301 referenced depends on the setting of the <option>strict_acl_vars</option> option. If it is
48302 false (the default), an empty string is substituted; if it is true, an
48303 error is generated.
48306 Versions of Exim before 4.64 have a limited set of numbered variables, but
48307 their names are compatible, so there is no problem with upgrading.
48310 <section id="SECTcondmodproc">
48311 <title>Condition and modifier processing</title>
48313 <indexterm role="concept">
48314 <primary>access control lists (ACLs)</primary>
48315 <secondary>conditions; processing</secondary>
48317 <indexterm role="concept">
48318 <primary>access control lists (ACLs)</primary>
48319 <secondary>modifiers; processing</secondary>
48321 An exclamation mark preceding a condition negates its result. For example:
48323 <literallayout class="monospaced">
48324 deny domains = *.dom.example
48325 !verify = recipient
48328 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
48329 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
48330 negation can be used on the right-hand side of a condition. For example, these
48331 two statements are equivalent:
48333 <literallayout class="monospaced">
48334 deny hosts = !192.168.3.4
48335 deny !hosts = 192.168.3.4
48338 However, for many conditions (<option>verify</option> being a good example), only left-hand
48339 side negation of the whole condition is possible.
48342 The arguments of conditions and modifiers are expanded. A forced failure
48343 of an expansion causes a condition to be ignored, that is, it behaves as if the
48344 condition is true. Consider these two statements:
48346 <literallayout class="monospaced">
48347 accept senders = ${lookup{$host_name}lsearch\
48348 {/some/file}{$value}fail}
48349 accept senders = ${lookup{$host_name}lsearch\
48350 {/some/file}{$value}{}}
48353 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
48354 the returned list is searched, but if the lookup fails the behaviour is
48355 different in the two cases. The <option>fail</option> in the first statement causes the
48356 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
48357 therefore succeeds. The second statement, however, generates an empty list when
48358 the lookup fails. No sender can match an empty list, so the condition fails,
48359 and therefore the <option>accept</option> also fails.
48362 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
48363 specify actions that are taken as the conditions for a statement are checked;
48364 others specify text for messages that are used when access is denied or a
48365 warning is generated. The <option>control</option> modifier affects the way an incoming
48366 message is handled.
48369 The positioning of the modifiers in an ACL statement important, because the
48370 processing of a verb ceases as soon as its outcome is known. Only those
48371 modifiers that have already been encountered will take effect. For example,
48372 consider this use of the <option>message</option> modifier:
48374 <literallayout class="monospaced">
48375 require message = Can't verify sender
48377 message = Can't verify recipient
48379 message = This message cannot be used
48382 If sender verification fails, Exim knows that the result of the statement is
48383 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
48384 so its text is used as the error message. If sender verification succeeds, but
48385 recipient verification fails, the second message is used. If recipient
48386 verification succeeds, the third message becomes <quote>current</quote>, but is never used
48387 because there are no more conditions to cause failure.
48390 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
48391 modifier that is used, because all the conditions must be true for rejection to
48392 happen. Specifying more than one <option>message</option> modifier does not make sense, and
48393 the message can even be specified after all the conditions. For example:
48395 <literallayout class="monospaced">
48397 !senders = *@my.domain.example
48398 message = Invalid sender from client host
48401 The <quote>deny</quote> result does not happen until the end of the statement is reached,
48402 by which time Exim has set up the message.
48405 <section id="SECTACLmodi">
48406 <title>ACL modifiers</title>
48408 <indexterm role="concept">
48409 <primary>access control lists (ACLs)</primary>
48410 <secondary>modifiers; list of</secondary>
48412 The ACL modifiers are as follows:
48416 <term><emphasis role="bold">add_header</emphasis> = <<emphasis>text</emphasis>></term>
48419 This modifier specifies one or more header lines that are to be added to an
48420 incoming message, assuming, of course, that the message is ultimately
48421 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
48423 </listitem></varlistentry>
48425 <term><emphasis role="bold">continue</emphasis> = <<emphasis>text</emphasis>></term>
48428 <indexterm role="concept">
48429 <primary><option>continue</option> ACL modifier</primary>
48431 <indexterm role="concept">
48432 <primary>database</primary>
48433 <secondary>updating in ACL</secondary>
48435 This modifier does nothing of itself, and processing of the ACL always
48436 continues with the next condition or modifier. The value of <option>continue</option> is in
48437 the side effects of expanding its argument. Typically this could be used to
48438 update a database. It is really just a syntactic tidiness, to avoid having to
48439 write rather ugly lines like this:
48442 <literal>condition = ${if eq{0}{</literal><<emphasis>some expansion</emphasis>><literal>}{true}{true}}</literal>
48445 Instead, all you need is
48448 <literal>continue = </literal><<emphasis>some expansion</emphasis>>
48450 </listitem></varlistentry>
48452 <term><emphasis role="bold">control</emphasis> = <<emphasis>text</emphasis>></term>
48455 <indexterm role="concept">
48456 <primary><option>control</option> ACL modifier</primary>
48458 This modifier affects the subsequent processing of the SMTP connection or of an
48459 incoming message that is accepted. The effect of the first type of control
48460 lasts for the duration of the connection, whereas the effect of the second type
48461 lasts only until the current message has been received. The message-specific
48462 controls always apply to the whole message, not to individual recipients,
48463 even if the <option>control</option> modifier appears in a RCPT ACL.
48466 As there are now quite a few controls that can be applied, they are described
48467 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
48468 in several different ways. For example:
48473 It can be at the end of an <option>accept</option> statement:
48475 <literallayout class="monospaced">
48476 accept ...some conditions
48477 control = queue_only
48480 In this case, the control is applied when this statement yields <quote>accept</quote>, in
48481 other words, when the conditions are all true.
48486 It can be in the middle of an <option>accept</option> statement:
48488 <literallayout class="monospaced">
48489 accept ...some conditions...
48490 control = queue_only
48491 ...some more conditions...
48494 If the first set of conditions are true, the control is applied, even if the
48495 statement does not accept because one of the second set of conditions is false.
48496 In this case, some subsequent statement must yield <quote>accept</quote> for the control
48502 It can be used with <option>warn</option> to apply the control, leaving the
48503 decision about accepting or denying to a subsequent verb. For
48506 <literallayout class="monospaced">
48507 warn ...some conditions...
48512 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
48513 <option>logwrite</option>, so it does not add anything to the message and does not write a
48519 If you want to apply a control unconditionally, you can use it with a
48520 <option>require</option> verb. For example:
48522 <literallayout class="monospaced">
48523 require control = no_multiline_responses
48527 </listitem></varlistentry>
48529 <term><emphasis role="bold">delay</emphasis> = <<emphasis>time</emphasis>></term>
48532 <indexterm role="concept">
48533 <primary><option>delay</option> ACL modifier</primary>
48535 <indexterm role="option">
48536 <primary><option>-bh</option></primary>
48538 This modifier may appear in any ACL. It causes Exim to wait for the time
48539 interval before proceeding. However, when testing Exim using the <option>-bh</option>
48540 option, the delay is not actually imposed (an appropriate message is output
48541 instead). The time is given in the usual Exim notation, and the delay happens
48542 as soon as the modifier is processed. In an SMTP session, pending output is
48543 flushed before the delay is imposed.
48546 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
48549 <literallayout class="monospaced">
48550 deny ...some conditions...
48554 The delay happens if all the conditions are true, before the statement returns
48555 <quote>deny</quote>. Compare this with:
48557 <literallayout class="monospaced">
48559 ...some conditions...
48562 which waits for 30s before processing the conditions. The <option>delay</option> modifier
48563 can also be used with <option>warn</option> and together with <option>control</option>:
48565 <literallayout class="monospaced">
48566 warn ...some conditions...
48572 If <option>delay</option> is encountered when the SMTP PIPELINING extension is in use,
48573 responses to several commands are no longer buffered and sent in one packet (as
48574 they would normally be) because all output is flushed before imposing the
48575 delay. This optimization is disabled so that a number of small delays do not
48576 appear to the client as one large aggregated delay that might provoke an
48577 unwanted timeout. You can, however, disable output flushing for <option>delay</option> by
48578 using a <option>control</option> modifier to set <option>no_delay_flush</option>.
48580 </listitem></varlistentry>
48582 <term><emphasis role="bold">endpass</emphasis></term>
48585 <indexterm role="concept">
48586 <primary><option>endpass</option> ACL modifier</primary>
48588 This modifier, which has no argument, is recognized only in <option>accept</option> and
48589 <option>discard</option> statements. It marks the boundary between the conditions whose
48590 failure causes control to pass to the next statement, and the conditions whose
48591 failure causes the ACL to return <quote>deny</quote>. This concept has proved to be
48592 confusing to some people, so the use of <option>endpass</option> is no longer recommended as
48593 <quote>best practice</quote>. See the description of <option>accept</option> above for more details.
48595 </listitem></varlistentry>
48597 <term><emphasis role="bold">log_message</emphasis> = <<emphasis>text</emphasis>></term>
48600 <indexterm role="concept">
48601 <primary><option>log_message</option> ACL modifier</primary>
48603 This modifier sets up a message that is used as part of the log message if the
48604 ACL denies access or a <option>warn</option> statement’s conditions are true. For example:
48606 <literallayout class="monospaced">
48607 require log_message = wrong cipher suite $tls_cipher
48608 encrypted = DES-CBC3-SHA
48611 <option>log_message</option> is also used when recipients are discarded by <option>discard</option>. For
48615 <literal>discard </literal><<emphasis>some conditions</emphasis>>
48616 <literal> log_message = Discarded $local_part@$domain because...</literal>
48619 When access is denied, <option>log_message</option> adds to any underlying error message
48620 that may exist because of a condition failure. For example, while verifying a
48621 recipient address, a <emphasis>:fail:</emphasis> redirection might have already set up a
48625 The message may be defined before the conditions to which it applies, because
48626 the string expansion does not happen until Exim decides that access is to be
48627 denied. This means that any variables that are set by the condition are
48628 available for inclusion in the message. For example, the <varname>$dnslist_</varname><<emphasis>xxx</emphasis>>
48629 variables are set after a DNS black list lookup succeeds. If the expansion of
48630 <option>log_message</option> fails, or if the result is an empty string, the modifier is
48634 <indexterm role="variable">
48635 <primary><varname>$acl_verify_message</varname></primary>
48637 If you want to use a <option>warn</option> statement to log the result of an address
48638 verification, you can use <varname>$acl_verify_message</varname> to include the verification
48642 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
48643 the start of the logged message. If the same warning log message is requested
48644 more than once while receiving a single email message, only one copy is
48645 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
48646 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
48647 is logged for a successful <option>warn</option> statement.
48650 If <option>log_message</option> is not present and there is no underlying error message (for
48651 example, from the failure of address verification), but <option>message</option> is present,
48652 the <option>message</option> text is used for logging rejections. However, if any text for
48653 logging contains newlines, only the first line is logged. In the absence of
48654 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
48655 logging rejections.
48657 </listitem></varlistentry>
48659 <term><emphasis role="bold">log_reject_target</emphasis> = <<emphasis>log name list</emphasis>></term>
48662 <indexterm role="concept">
48663 <primary><option>log_reject_target</option> ACL modifier</primary>
48665 <indexterm role="concept">
48666 <primary>logging in ACL</primary>
48667 <secondary>specifying which log</secondary>
48669 This modifier makes it possible to specify which logs are used for messages
48670 about ACL rejections. Its argument is a colon-separated list of words that can
48671 be <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote>. The default is <literal>main:reject</literal>. The list
48672 may be empty, in which case a rejection is not logged at all. For example, this
48673 ACL fragment writes no logging information when access is denied:
48676 <literal>deny </literal><<emphasis>some conditions</emphasis>>
48677 <literal> log_reject_target =</literal>
48680 This modifier can be used in SMTP and non-SMTP ACLs. It applies to both
48681 permanent and temporary rejections. Its effect lasts for the rest of the
48684 </listitem></varlistentry>
48686 <term><emphasis role="bold">logwrite</emphasis> = <<emphasis>text</emphasis>></term>
48689 <indexterm role="concept">
48690 <primary><option>logwrite</option> ACL modifier</primary>
48692 <indexterm role="concept">
48693 <primary>logging in ACL</primary>
48694 <secondary>immediate</secondary>
48696 This modifier writes a message to a log file as soon as it is encountered when
48697 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
48698 <option>warn</option> and <option>discard</option>, is used only if the ACL statement denies
48699 access.) The <option>logwrite</option> modifier can be used to log special incidents in
48703 <literal>accept </literal><<emphasis>some special conditions</emphasis>>
48704 <literal> control = freeze</literal>
48705 <literal> logwrite = froze message because ...</literal>
48708 By default, the message is written to the main log. However, it may begin
48709 with a colon, followed by a comma-separated list of log names, and then
48710 another colon, to specify exactly which logs are to be written. For
48713 <literallayout class="monospaced">
48714 logwrite = :main,reject: text for main and reject logs
48715 logwrite = :panic: text for panic log only
48717 </listitem></varlistentry>
48719 <term><emphasis role="bold">message</emphasis> = <<emphasis>text</emphasis>></term>
48722 <indexterm role="concept">
48723 <primary><option>message</option> ACL modifier</primary>
48725 This modifier sets up a text string that is expanded and used as a response
48726 message when an ACL statement terminates the ACL with an <quote>accept</quote>, <quote>deny</quote>,
48727 or <quote>defer</quote> response. (In the case of the <option>accept</option> and <option>discard</option> verbs,
48728 there is some complication if <option>endpass</option> is involved; see the description of
48729 <option>accept</option> for details.)
48732 The expansion of the message happens at the time Exim decides that the ACL is
48733 to end, not at the time it processes <option>message</option>. If the expansion fails, or
48734 generates an empty string, the modifier is ignored. Here is an example where
48735 <option>message</option> must be specified first, because the ACL ends with a rejection if
48736 the <option>hosts</option> condition fails:
48738 <literallayout class="monospaced">
48739 require message = Host not recognized
48743 (Once a condition has failed, no further conditions or modifiers are
48747 <indexterm role="concept">
48748 <primary>SMTP</primary>
48749 <secondary>error codes</secondary>
48751 <indexterm role="option">
48752 <primary><option>smtp_banner</option></primary>
48754 For ACLs that are triggered by SMTP commands, the message is returned as part
48755 of the SMTP response. The use of <option>message</option> with <option>accept</option> (or <option>discard</option>)
48756 is meaningful only for SMTP, as no message is returned when a non-SMTP message
48757 is accepted. In the case of the connect ACL, accepting with a message modifier
48758 overrides the value of <option>smtp_banner</option>. For the EHLO/HELO ACL, a customized
48759 accept message may not contain more than one line (otherwise it will be
48760 truncated at the first newline and a panic logged), and it cannot affect the
48764 When SMTP is involved, the message may begin with an overriding response code,
48765 consisting of three digits optionally followed by an <quote>extended response code</quote>
48766 of the form <emphasis>n.n.n</emphasis>, each code being followed by a space. For example:
48768 <literallayout class="monospaced">
48769 deny message = 599 1.2.3 Host not welcome
48770 hosts = 192.168.34.0/24
48773 The first digit of the supplied response code must be the same as would be sent
48774 by default. A panic occurs if it is not. Exim uses a 550 code when it denies
48775 access, but for the predata ACL, note that the default success code is 354, not
48776 2<emphasis>xx</emphasis>.
48779 Notwithstanding the previous paragraph, for the QUIT ACL, unlike the others,
48780 the message modifier cannot override the 221 response code.
48783 The text in a <option>message</option> modifier is literal; any quotes are taken as
48784 literals, but because the string is expanded, backslash escapes are processed
48785 anyway. If the message contains newlines, this gives rise to a multi-line SMTP
48789 <indexterm role="variable">
48790 <primary><varname>$acl_verify_message</varname></primary>
48792 If <option>message</option> is used on a statement that verifies an address, the message
48793 specified overrides any message that is generated by the verification process.
48794 However, the original message is available in the variable
48795 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
48796 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
48797 routers to be passed back as part of the SMTP response, you should either not
48798 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
48801 For compatibility with previous releases of Exim, a <option>message</option> modifier that
48802 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
48803 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
48804 all the conditions are true, wherever it appears in an ACL command, whereas
48805 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
48806 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
48809 </listitem></varlistentry>
48811 <term><emphasis role="bold">set</emphasis> <<emphasis>acl_name</emphasis>> = <<emphasis>value</emphasis>></term>
48814 <indexterm role="concept">
48815 <primary><option>set</option> ACL modifier</primary>
48817 This modifier puts a value into one of the ACL variables (see section
48818 <xref linkend="SECTaclvariables"/>).
48820 </listitem></varlistentry>
48823 <section id="SECTcontrols">
48824 <title>Use of the control modifier</title>
48826 <indexterm role="concept">
48827 <primary><option>control</option> ACL modifier</primary>
48829 The <option>control</option> modifier supports the following settings:
48833 <term><emphasis role="bold">control = allow_auth_unadvertised</emphasis></term>
48836 This modifier allows a client host to use the SMTP AUTH command even when it
48837 has not been advertised in response to EHLO. Furthermore, because there are
48838 apparently some really broken clients that do this, Exim will accept AUTH after
48839 HELO (rather than EHLO) when this control is set. It should be used only if you
48840 really need it, and you should limit its use to those broken clients that do
48841 not work without it. For example:
48843 <literallayout class="monospaced">
48844 warn hosts = 192.168.34.25
48845 control = allow_auth_unadvertised
48848 Normally, when an Exim server receives an AUTH command, it checks the name of
48849 the authentication mechanism that is given in the command to ensure that it
48850 matches an advertised mechanism. When this control is set, the check that a
48851 mechanism has been advertised is bypassed. Any configured mechanism can be used
48852 by the client. This control is permitted only in the connection and HELO ACLs.
48854 </listitem></varlistentry>
48856 <term><emphasis role="bold">control = caseful_local_part</emphasis></term>
48857 <term><emphasis role="bold">control = caselower_local_part</emphasis></term>
48860 <indexterm role="concept">
48861 <primary>access control lists (ACLs)</primary>
48862 <secondary>case of local part in</secondary>
48864 <indexterm role="concept">
48865 <primary>case of local parts</primary>
48867 <indexterm role="variable">
48868 <primary><varname>$local_part</varname></primary>
48870 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
48871 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
48872 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
48873 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
48874 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
48878 These controls affect only the current recipient. Moreover, they apply only to
48879 local part handling that takes place directly in the ACL (for example, as a key
48880 in lookups). If a test to verify the recipient is obeyed, the case-related
48881 handling of the local part during the verification is controlled by the router
48882 configuration (see the <option>caseful_local_part</option> generic router option).
48885 This facility could be used, for example, to add a spam score to local parts
48886 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
48889 <literallayout class="monospaced">
48890 warn control = caseful_local_part
48891 set acl_m4 = ${eval:\
48893 ${if match{$local_part}{[A-Z]}{1}{0}}\
48895 control = caselower_local_part
48898 Notice that we put back the lower cased version afterwards, assuming that
48899 is what is wanted for subsequent tests.
48901 </listitem></varlistentry>
48903 <term><emphasis role="bold">control = enforce_sync</emphasis></term>
48904 <term><emphasis role="bold">control = no_enforce_sync</emphasis></term>
48907 <indexterm role="concept">
48908 <primary>SMTP</primary>
48909 <secondary>synchronization checking</secondary>
48911 <indexterm role="concept">
48912 <primary>synchronization checking in SMTP</primary>
48914 These controls make it possible to be selective about when SMTP synchronization
48915 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
48916 state of the switch (it is true by default). See the description of this option
48917 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
48920 The effect of these two controls lasts for the remainder of the SMTP
48921 connection. They can appear in any ACL except the one for the non-SMTP
48922 messages. The most straightforward place to put them is in the ACL defined by
48923 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
48924 before the first synchronization check. The expected use is to turn off the
48925 synchronization checks for badly-behaved hosts that you nevertheless need to
48928 </listitem></varlistentry>
48930 <term><emphasis role="bold">control = fakedefer/</emphasis><<emphasis>message</emphasis>></term>
48933 <indexterm role="concept">
48934 <primary>fake defer</primary>
48936 <indexterm role="concept">
48937 <primary>defer, fake</primary>
48939 This control works in exactly the same way as <option>fakereject</option> (described below)
48940 except that it causes an SMTP 450 response after the message data instead of a
48941 550 response. You must take care when using <option>fakedefer</option> because it causes the
48942 messages to be duplicated when the sender retries. Therefore, you should not
48943 use <option>fakedefer</option> if the message is to be delivered normally.
48945 </listitem></varlistentry>
48947 <term><emphasis role="bold">control = fakereject/</emphasis><<emphasis>message</emphasis>></term>
48950 <indexterm role="concept">
48951 <primary>fake rejection</primary>
48953 <indexterm role="concept">
48954 <primary>rejection, fake</primary>
48956 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
48957 words, only when an SMTP message is being received. If Exim accepts the
48958 message, instead the final 250 response, a 550 rejection message is sent.
48959 However, Exim proceeds to deliver the message as normal. The control applies
48960 only to the current message, not to any subsequent ones that may be received in
48961 the same SMTP connection.
48964 The text for the 550 response is taken from the <option>control</option> modifier. If no
48965 message is supplied, the following is used:
48967 <literallayout class="monospaced">
48968 550-Your message has been rejected but is being
48969 550-kept for evaluation.
48970 550-If it was a legitimate message, it may still be
48971 550 delivered to the target recipient(s).
48974 This facility should be used with extreme caution.
48976 </listitem></varlistentry>
48978 <term><emphasis role="bold">control = freeze</emphasis></term>
48981 <indexterm role="concept">
48982 <primary>frozen messages</primary>
48983 <secondary>forcing in ACL</secondary>
48985 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
48986 other words, only when a message is being received. If the message is accepted,
48987 it is placed on Exim’s queue and frozen. The control applies only to the
48988 current message, not to any subsequent ones that may be received in the same
48992 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
48993 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
48994 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
48995 are obeyed for the current message have the <literal>/no_tell</literal> option.
48997 </listitem></varlistentry>
48999 <term><emphasis role="bold">control = no_delay_flush</emphasis></term>
49002 <indexterm role="concept">
49003 <primary>SMTP</primary>
49004 <secondary>output flushing, disabling for delay</secondary>
49006 Exim normally flushes SMTP output before implementing a delay in an ACL, to
49007 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
49008 use. This control, as long as it is encountered before the <option>delay</option> modifier,
49009 disables such output flushing.
49011 </listitem></varlistentry>
49013 <term><emphasis role="bold">control = no_callout_flush</emphasis></term>
49016 <indexterm role="concept">
49017 <primary>SMTP</primary>
49018 <secondary>output flushing, disabling for callout</secondary>
49020 Exim normally flushes SMTP output before performing a callout in an ACL, to
49021 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
49022 use. This control, as long as it is encountered before the <option>verify</option> condition
49023 that causes the callout, disables such output flushing.
49025 </listitem></varlistentry>
49027 <term><emphasis role="bold">control = no_mbox_unspool</emphasis></term>
49030 This control is available when Exim is compiled with the content scanning
49031 extension. Content scanning may require a copy of the current message, or parts
49032 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
49033 or spam scanner. Normally, such copies are deleted when they are no longer
49034 needed. If this control is set, the copies are not deleted. The control applies
49035 only to the current message, not to any subsequent ones that may be received in
49036 the same SMTP connection. It is provided for debugging purposes and is unlikely
49037 to be useful in production.
49039 </listitem></varlistentry>
49041 <term><emphasis role="bold">control = no_multiline_responses</emphasis></term>
49044 <indexterm role="concept">
49045 <primary>multiline responses, suppressing</primary>
49047 This control is permitted for any ACL except the one for non-SMTP messages.
49048 It seems that there are broken clients in use that cannot handle multiline
49049 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
49052 If this control is set, multiline SMTP responses from ACL rejections are
49053 suppressed. One way of doing this would have been to put out these responses as
49054 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
49055 (<quote>use multiline responses for more</quote> it says – ha!), and some of the
49056 responses might get close to that. So this facility, which is after all only a
49057 sop to broken clients, is implemented by doing two very easy things:
49062 Extra information that is normally output as part of a rejection caused by
49063 sender verification failure is omitted. Only the final line (typically <quote>sender
49064 verification failed</quote>) is sent.
49069 If a <option>message</option> modifier supplies a multiline response, only the first
49075 The setting of the switch can, of course, be made conditional on the
49076 calling host. Its effect lasts until the end of the SMTP connection.
49078 </listitem></varlistentry>
49080 <term><emphasis role="bold">control = no_pipelining</emphasis></term>
49083 <indexterm role="concept">
49084 <primary>PIPELINING</primary>
49085 <secondary>suppressing advertising</secondary>
49087 This control turns off the advertising of the PIPELINING extension to SMTP in
49088 the current session. To be useful, it must be obeyed before Exim sends its
49089 response to an EHLO command. Therefore, it should normally appear in an ACL
49090 controlled by <option>acl_smtp_connect</option> or <option>acl_smtp_helo</option>. See also
49091 <option>pipelining_advertise_hosts</option>.
49093 </listitem></varlistentry>
49095 <term><emphasis role="bold">control = queue_only</emphasis></term>
49098 <indexterm role="option">
49099 <primary><option>queue_only</option></primary>
49101 <indexterm role="concept">
49102 <primary>queueing incoming messages</primary>
49104 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
49105 other words, only when a message is being received. If the message is accepted,
49106 it is placed on Exim’s queue and left there for delivery by a subsequent queue
49107 runner. No immediate delivery process is started. In other words, it has the
49108 effect as the <option>queue_only</option> global option. However, the control applies only
49109 to the current message, not to any subsequent ones that may be received in the
49110 same SMTP connection.
49112 </listitem></varlistentry>
49114 <term><emphasis role="bold">control = submission/</emphasis><<emphasis>options</emphasis>></term>
49117 <indexterm role="concept">
49118 <primary>message</primary>
49119 <secondary>submission</secondary>
49121 <indexterm role="concept">
49122 <primary>submission mode</primary>
49124 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
49125 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
49126 the current message is a submission from a local MUA. In this case, Exim
49127 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
49128 necessary. For example, it adds a <emphasis>Date:</emphasis> header line if one is not present.
49129 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
49130 late (the message has already been created).
49133 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
49134 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
49135 submission mode; the available options for this control are described there.
49136 The control applies only to the current message, not to any subsequent ones
49137 that may be received in the same SMTP connection.
49139 </listitem></varlistentry>
49141 <term><emphasis role="bold">control = suppress_local_fixups</emphasis></term>
49144 <indexterm role="concept">
49145 <primary>submission fixups, suppressing</primary>
49147 This control applies to locally submitted (non TCP/IP) messages, and is the
49148 complement of <literal>control = submission</literal>. It disables the fixups that are
49149 normally applied to locally-submitted messages. Specifically:
49154 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
49155 dynamic version of <option>local_sender_retain</option>).
49160 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
49165 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
49170 This control may be useful when a remotely-originated message is accepted,
49171 passed to some scanning program, and then re-submitted for delivery. It can be
49172 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
49173 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message’s
49177 <emphasis role="bold">Note:</emphasis> This control applies only to the current message, not to any others
49178 that are being submitted at the same time using <option>-bs</option> or <option>-bS</option>.
49180 </listitem></varlistentry>
49183 <section id="SECTsummesfix">
49184 <title>Summary of message fixup control</title>
49186 All four possibilities for message fixups can be specified:
49191 Locally submitted, fixups applied: the default.
49196 Locally submitted, no fixups applied: use
49197 <literal>control = suppress_local_fixups</literal>.
49202 Remotely submitted, no fixups applied: the default.
49207 Remotely submitted, fixups applied: use <literal>control = submission</literal>.
49212 <section id="SECTaddheadacl">
49213 <title>Adding header lines in ACLs</title>
49215 <indexterm role="concept">
49216 <primary>header lines</primary>
49217 <secondary>adding in an ACL</secondary>
49219 <indexterm role="concept">
49220 <primary>header lines</primary>
49221 <secondary>position of added lines</secondary>
49223 <indexterm role="concept">
49224 <primary><option>message</option> ACL modifier</primary>
49226 The <option>add_header</option> modifier can be used to add one or more extra header lines
49227 to an incoming message, as in this example:
49229 <literallayout class="monospaced">
49230 warn dnslists = sbl.spamhaus.org : \
49231 dialup.mail-abuse.org
49232 add_header = X-blacklisted-at: $dnslist_domain
49235 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
49236 MIME, and non-SMTP ACLs (in other words, those that are concerned with
49237 receiving a message). The message must ultimately be accepted for
49238 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
49239 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
49243 If the data for the <option>add_header</option> modifier contains one or more newlines that
49244 are not followed by a space or a tab, it is assumed to contain multiple header
49245 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
49246 front of any line that is not a valid header line.
49249 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
49250 They are added to the message before processing the DATA and MIME ACLs.
49251 However, if an identical header line is requested more than once, only one copy
49252 is actually added to the message. Further header lines may be accumulated
49253 during the DATA and MIME ACLs, after which they are added to the message, again
49254 with duplicates suppressed. Thus, it is possible to add two identical header
49255 lines to an SMTP message, but only if one is added before DATA and one after.
49256 In the case of non-SMTP messages, new headers are accumulated during the
49257 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
49258 message is rejected after DATA or by the non-SMTP ACL, all added header lines
49259 are included in the entry that is written to the reject log.
49262 <indexterm role="concept">
49263 <primary>header lines</primary>
49264 <secondary>added; visibility of</secondary>
49266 Header lines are not visible in string expansions until they are added to the
49267 message. It follows that header lines defined in the MAIL, RCPT, and predata
49268 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
49269 header lines that are added by the DATA or MIME ACLs are not visible in those
49270 ACLs. Because of this restriction, you cannot use header lines as a way of
49271 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
49272 this, you can use ACL variables, as described in section
49273 <xref linkend="SECTaclvariables"/>.
49276 The <option>add_header</option> modifier acts immediately it is encountered during the
49277 processing of an ACL. Notice the difference between these two cases:
49280 <literal>accept add_header = ADDED: some text</literal>
49281 <literal> </literal><<emphasis>some condition</emphasis>>
49283 <literal>accept </literal><<emphasis>some condition</emphasis>>
49284 <literal> add_header = ADDED: some text</literal>
49287 In the first case, the header line is always added, whether or not the
49288 condition is true. In the second case, the header line is added only if the
49289 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
49290 ACL statement. All those that are encountered before a condition fails are
49294 <indexterm role="concept">
49295 <primary><option>warn</option> ACL verb</primary>
49297 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
49298 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
49299 effect only if all the conditions are true, even if it appears before some of
49300 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
49301 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
49302 are present on a <option>warn</option> verb, both are processed according to their
49306 By default, new header lines are added to a message at the end of the existing
49307 header lines. However, you can specify that any particular header line should
49308 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
49309 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
49310 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
49313 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
49314 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
49315 header line, respectively. (Header text cannot start with a colon, as there has
49316 to be a header name first.) For example:
49318 <literallayout class="monospaced">
49319 warn add_header = \
49320 :after_received:X-My-Header: something or other...
49323 If more than one header line is supplied in a single <option>add_header</option> modifier,
49324 each one is treated independently and can therefore be placed differently. If
49325 you add more than one line at the start, or after the Received: block, they end
49326 up in reverse order.
49329 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
49330 added in an ACL. It does NOT work for header lines that are added in a
49331 system filter or in a router or transport.
49334 <section id="SECTaclconditions">
49335 <title>ACL conditions</title>
49337 <indexterm role="concept">
49338 <primary>access control lists (ACLs)</primary>
49339 <secondary>conditions; list of</secondary>
49341 Some of conditions listed in this section are available only when Exim is
49342 compiled with the content-scanning extension. They are included here briefly
49343 for completeness. More detailed descriptions can be found in the discussion on
49344 content scanning in chapter <xref linkend="CHAPexiscan"/>.
49347 Not all conditions are relevant in all circumstances. For example, testing
49348 senders and recipients does not make sense in an ACL that is being run as the
49349 result of the arrival of an ETRN command, and checks on message headers can be
49350 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
49351 can use the same condition (with different parameters) more than once in the
49352 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
49353 The conditions are as follows:
49357 <term><emphasis role="bold">acl = </emphasis><<emphasis>name of acl or ACL string or file name </emphasis>></term>
49360 <indexterm role="concept">
49361 <primary>access control lists (ACLs)</primary>
49362 <secondary>nested</secondary>
49364 <indexterm role="concept">
49365 <primary>access control lists (ACLs)</primary>
49366 <secondary>indirect</secondary>
49368 <indexterm role="concept">
49369 <primary><option>acl</option> ACL condition</primary>
49371 The possible values of the argument are the same as for the
49372 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
49373 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
49374 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
49375 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
49376 condition false. This means that further processing of the <option>warn</option> verb
49377 ceases, but processing of the ACL continues.
49380 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
49381 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
49382 <option>accept</option> or <option>discard</option>, and the action is taken immediately – no further
49383 conditions are tested.
49386 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
49387 loops. This condition allows you to use different ACLs in different
49388 circumstances. For example, different ACLs can be used to handle RCPT commands
49389 for different local users or different local domains.
49391 </listitem></varlistentry>
49393 <term><emphasis role="bold">authenticated = </emphasis><<emphasis>string list</emphasis>></term>
49396 <indexterm role="concept">
49397 <primary><option>authenticated</option> ACL condition</primary>
49399 <indexterm role="concept">
49400 <primary>authentication</primary>
49401 <secondary>ACL checking</secondary>
49403 <indexterm role="concept">
49404 <primary>access control lists (ACLs)</primary>
49405 <secondary>testing for authentication</secondary>
49407 If the SMTP connection is not authenticated, the condition is false. Otherwise,
49408 the name of the authenticator is tested against the list. To test for
49409 authentication by any authenticator, you can set
49411 <literallayout class="monospaced">
49414 </listitem></varlistentry>
49416 <term><emphasis role="bold">condition = </emphasis><<emphasis>string</emphasis>></term>
49419 <indexterm role="concept">
49420 <primary><option>condition</option> ACL condition</primary>
49422 <indexterm role="concept">
49423 <primary>customizing</primary>
49424 <secondary>ACL condition</secondary>
49426 <indexterm role="concept">
49427 <primary>access control lists (ACLs)</primary>
49428 <secondary>customized test</secondary>
49430 <indexterm role="concept">
49431 <primary>access control lists (ACLs)</primary>
49432 <secondary>testing, customized</secondary>
49434 This feature allows you to make up custom conditions. If the result of
49435 expanding the string is an empty string, the number zero, or one of the strings
49436 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
49437 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
49438 any other value, some error is assumed to have occurred, and the ACL returns
49439 <quote>defer</quote>. However, if the expansion is forced to fail, the condition is
49440 ignored. The effect is to treat it as true, whether it is positive or
49443 </listitem></varlistentry>
49445 <term><emphasis role="bold">decode = </emphasis><<emphasis>location</emphasis>></term>
49448 <indexterm role="concept">
49449 <primary><option>decode</option> ACL condition</primary>
49451 This condition is available only when Exim is compiled with the
49452 content-scanning extension, and it is allowed only in the ACL defined by
49453 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
49454 If all goes well, the condition is true. It is false only if there are
49455 problems such as a syntax error or a memory shortage. For more details, see
49456 chapter <xref linkend="CHAPexiscan"/>.
49458 </listitem></varlistentry>
49460 <term><emphasis role="bold">demime = </emphasis><<emphasis>extension list</emphasis>></term>
49463 <indexterm role="concept">
49464 <primary><option>demime</option> ACL condition</primary>
49466 This condition is available only when Exim is compiled with the
49467 content-scanning extension. Its use is described in section
49468 <xref linkend="SECTdemimecond"/>.
49470 </listitem></varlistentry>
49472 <term><emphasis role="bold">dnslists = </emphasis><<emphasis>list of domain names and other data</emphasis>></term>
49475 <indexterm role="concept">
49476 <primary><option>dnslists</option> ACL condition</primary>
49478 <indexterm role="concept">
49479 <primary>DNS list</primary>
49480 <secondary>in ACL</secondary>
49482 <indexterm role="concept">
49483 <primary>black list (DNS)</primary>
49485 <indexterm role="concept">
49486 <primary>access control lists (ACLs)</primary>
49487 <secondary>testing a DNS list</secondary>
49489 This condition checks for entries in DNS black lists. These are also known as
49490 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
49491 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
49492 different variants of this condition to describe briefly here. See sections
49493 <xref linkend="SECTmorednslists"/>–<xref linkend="SECTmorednslistslast"/> for details.
49495 </listitem></varlistentry>
49497 <term><emphasis role="bold">domains = </emphasis><<emphasis>domain list</emphasis>></term>
49500 <indexterm role="concept">
49501 <primary><option>domains</option> ACL condition</primary>
49503 <indexterm role="concept">
49504 <primary>domain</primary>
49505 <secondary>ACL checking</secondary>
49507 <indexterm role="concept">
49508 <primary>access control lists (ACLs)</primary>
49509 <secondary>testing a recipient domain</secondary>
49511 <indexterm role="variable">
49512 <primary><varname>$domain_data</varname></primary>
49514 This condition is relevant only after a RCPT command. It checks that the domain
49515 of the recipient address is in the domain list. If percent-hack processing is
49516 enabled, it is done before this test is done. If the check succeeds with a
49517 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
49518 <option>domains</option> test.
49521 <emphasis role="bold">Note carefully</emphasis> (because many people seem to fall foul of this): you cannot
49522 use <option>domains</option> in a DATA ACL.
49524 </listitem></varlistentry>
49526 <term><emphasis role="bold">encrypted = </emphasis><<emphasis>string list</emphasis>></term>
49529 <indexterm role="concept">
49530 <primary><option>encrypted</option> ACL condition</primary>
49532 <indexterm role="concept">
49533 <primary>encryption</primary>
49534 <secondary>checking in an ACL</secondary>
49536 <indexterm role="concept">
49537 <primary>access control lists (ACLs)</primary>
49538 <secondary>testing for encryption</secondary>
49540 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
49541 name of the cipher suite in use is tested against the list. To test for
49542 encryption without testing for any specific cipher suite(s), set
49544 <literallayout class="monospaced">
49547 </listitem></varlistentry>
49549 <term><emphasis role="bold">hosts = </emphasis><<emphasis> host list</emphasis>></term>
49552 <indexterm role="concept">
49553 <primary><option>hosts</option> ACL condition</primary>
49555 <indexterm role="concept">
49556 <primary>host</primary>
49557 <secondary>ACL checking</secondary>
49559 <indexterm role="concept">
49560 <primary>access control lists (ACLs)</primary>
49561 <secondary>testing the client host</secondary>
49563 This condition tests that the calling host matches the host list. If you have
49564 name lookups or wildcarded host names and IP addresses in the same host list,
49565 you should normally put the IP addresses first. For example, you could have:
49567 <literallayout class="monospaced">
49568 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
49571 The lookup in this example uses the host name for its key. This is implied by
49572 the lookup type <quote>dbm</quote>. (For a host address lookup you would use <quote>net-dbm</quote>
49573 and it wouldn’t matter which way round you had these two items.)
49576 The reason for the problem with host names lies in the left-to-right way that
49577 Exim processes lists. It can test IP addresses without doing any DNS lookups,
49578 but when it reaches an item that requires a host name, it fails if it cannot
49579 find a host name to compare with the pattern. If the above list is given in the
49580 opposite order, the <option>accept</option> statement fails for a host whose name cannot be
49581 found, even if its IP address is 10.9.8.7.
49584 If you really do want to do the name check first, and still recognize the IP
49585 address even if the name lookup fails, you can rewrite the ACL like this:
49587 <literallayout class="monospaced">
49588 accept hosts = dbm;/etc/friendly/hosts
49589 accept hosts = 10.9.8.7
49592 The default action on failing to find the host name is to assume that the host
49593 is not in the list, so the first <option>accept</option> statement fails. The second
49594 statement can then check the IP address.
49597 <indexterm role="variable">
49598 <primary><varname>$host_data</varname></primary>
49600 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
49601 of the lookup is made available in the <varname>$host_data</varname> variable. This
49602 allows you, for example, to set up a statement like this:
49604 <literallayout class="monospaced">
49605 deny hosts = net-lsearch;/some/file
49606 message = $host_data
49609 which gives a custom error message for each denied host.
49611 </listitem></varlistentry>
49613 <term><emphasis role="bold">local_parts = </emphasis><<emphasis>local part list</emphasis>></term>
49616 <indexterm role="concept">
49617 <primary><option>local_parts</option> ACL condition</primary>
49619 <indexterm role="concept">
49620 <primary>local part</primary>
49621 <secondary>ACL checking</secondary>
49623 <indexterm role="concept">
49624 <primary>access control lists (ACLs)</primary>
49625 <secondary>testing a local part</secondary>
49627 <indexterm role="variable">
49628 <primary><varname>$local_part_data</varname></primary>
49630 This condition is relevant only after a RCPT command. It checks that the local
49631 part of the recipient address is in the list. If percent-hack processing is
49632 enabled, it is done before this test. If the check succeeds with a lookup, the
49633 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
49634 the next <option>local_parts</option> test.
49636 </listitem></varlistentry>
49638 <term><emphasis role="bold">malware = </emphasis><<emphasis>option</emphasis>></term>
49641 <indexterm role="concept">
49642 <primary><option>malware</option> ACL condition</primary>
49644 <indexterm role="concept">
49645 <primary>access control lists (ACLs)</primary>
49646 <secondary>virus scanning</secondary>
49648 <indexterm role="concept">
49649 <primary>access control lists (ACLs)</primary>
49650 <secondary>scanning for viruses</secondary>
49652 This condition is available only when Exim is compiled with the
49653 content-scanning extension. It causes the incoming message to be scanned for
49654 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
49656 </listitem></varlistentry>
49658 <term><emphasis role="bold">mime_regex = </emphasis><<emphasis>list of regular expressions</emphasis>></term>
49661 <indexterm role="concept">
49662 <primary><option>mime_regex</option> ACL condition</primary>
49664 <indexterm role="concept">
49665 <primary>access control lists (ACLs)</primary>
49666 <secondary>testing by regex matching</secondary>
49668 This condition is available only when Exim is compiled with the
49669 content-scanning extension, and it is allowed only in the ACL defined by
49670 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
49671 with any of the regular expressions. For details, see chapter
49672 <xref linkend="CHAPexiscan"/>.
49674 </listitem></varlistentry>
49676 <term><emphasis role="bold">ratelimit = </emphasis><<emphasis>parameters</emphasis>></term>
49679 <indexterm role="concept">
49680 <primary>rate limiting</primary>
49682 This condition can be used to limit the rate at which a user or host submits
49683 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
49685 </listitem></varlistentry>
49687 <term><emphasis role="bold">recipients = </emphasis><<emphasis>address list</emphasis>></term>
49690 <indexterm role="concept">
49691 <primary><option>recipients</option> ACL condition</primary>
49693 <indexterm role="concept">
49694 <primary>recipient</primary>
49695 <secondary>ACL checking</secondary>
49697 <indexterm role="concept">
49698 <primary>access control lists (ACLs)</primary>
49699 <secondary>testing a recipient</secondary>
49701 This condition is relevant only after a RCPT command. It checks the entire
49702 recipient address against a list of recipients.
49704 </listitem></varlistentry>
49706 <term><emphasis role="bold">regex = </emphasis><<emphasis>list of regular expressions</emphasis>></term>
49709 <indexterm role="concept">
49710 <primary><option>regex</option> ACL condition</primary>
49712 <indexterm role="concept">
49713 <primary>access control lists (ACLs)</primary>
49714 <secondary>testing by regex matching</secondary>
49716 This condition is available only when Exim is compiled with the
49717 content-scanning extension, and is available only in the DATA, MIME, and
49718 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
49719 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
49721 </listitem></varlistentry>
49723 <term><emphasis role="bold">sender_domains = </emphasis><<emphasis>domain list</emphasis>></term>
49726 <indexterm role="concept">
49727 <primary><option>sender_domains</option> ACL condition</primary>
49729 <indexterm role="concept">
49730 <primary>sender</primary>
49731 <secondary>ACL checking</secondary>
49733 <indexterm role="concept">
49734 <primary>access control lists (ACLs)</primary>
49735 <secondary>testing a sender domain</secondary>
49737 <indexterm role="variable">
49738 <primary><varname>$domain</varname></primary>
49740 <indexterm role="variable">
49741 <primary><varname>$sender_address_domain</varname></primary>
49743 This condition tests the domain of the sender of the message against the given
49744 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
49745 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
49746 of this condition. This is an exception to the general rule for testing domain
49747 lists. It is done this way so that, if this condition is used in an ACL for a
49748 RCPT command, the recipient’s domain (which is in <varname>$domain</varname>) can be used to
49749 influence the sender checking.
49752 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
49753 relaying, because sender addresses are easily, and commonly, forged.
49755 </listitem></varlistentry>
49757 <term><emphasis role="bold">senders = </emphasis><<emphasis>address list</emphasis>></term>
49760 <indexterm role="concept">
49761 <primary><option>senders</option> ACL condition</primary>
49763 <indexterm role="concept">
49764 <primary>sender</primary>
49765 <secondary>ACL checking</secondary>
49767 <indexterm role="concept">
49768 <primary>access control lists (ACLs)</primary>
49769 <secondary>testing a sender</secondary>
49771 This condition tests the sender of the message against the given list. To test
49772 for a bounce message, which has an empty sender, set
49774 <literallayout class="monospaced">
49778 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
49779 relaying, because sender addresses are easily, and commonly, forged.
49781 </listitem></varlistentry>
49783 <term><emphasis role="bold">spam = </emphasis><<emphasis>username</emphasis>></term>
49786 <indexterm role="concept">
49787 <primary><option>spam</option> ACL condition</primary>
49789 <indexterm role="concept">
49790 <primary>access control lists (ACLs)</primary>
49791 <secondary>scanning for spam</secondary>
49793 This condition is available only when Exim is compiled with the
49794 content-scanning extension. It causes the incoming message to be scanned by
49795 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
49797 </listitem></varlistentry>
49799 <term><emphasis role="bold">verify = certificate</emphasis></term>
49802 <indexterm role="concept">
49803 <primary><option>verify</option> ACL condition</primary>
49805 <indexterm role="concept">
49806 <primary>TLS</primary>
49807 <secondary>client certificate verification</secondary>
49809 <indexterm role="concept">
49810 <primary>certificate</primary>
49811 <secondary>verification of client</secondary>
49813 <indexterm role="concept">
49814 <primary>access control lists (ACLs)</primary>
49815 <secondary>certificate verification</secondary>
49817 <indexterm role="concept">
49818 <primary>access control lists (ACLs)</primary>
49819 <secondary>testing a TLS certificate</secondary>
49821 This condition is true in an SMTP session if the session is encrypted, and a
49822 certificate was received from the client, and the certificate was verified. The
49823 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
49824 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
49826 </listitem></varlistentry>
49828 <term><emphasis role="bold">verify = csa</emphasis></term>
49831 <indexterm role="concept">
49832 <primary>CSA verification</primary>
49834 This condition checks whether the sending host (the client) is authorized to
49835 send email. Details of how this works are given in section
49836 <xref linkend="SECTverifyCSA"/>.
49838 </listitem></varlistentry>
49840 <term><emphasis role="bold">verify = header_sender/</emphasis><<emphasis>options</emphasis>></term>
49843 <indexterm role="concept">
49844 <primary><option>verify</option> ACL condition</primary>
49846 <indexterm role="concept">
49847 <primary>access control lists (ACLs)</primary>
49848 <secondary>verifying sender in the header</secondary>
49850 <indexterm role="concept">
49851 <primary>header lines</primary>
49852 <secondary>verifying the sender in</secondary>
49854 <indexterm role="concept">
49855 <primary>sender</primary>
49856 <secondary>verifying in header</secondary>
49858 <indexterm role="concept">
49859 <primary>verifying</primary>
49860 <secondary>sender in header</secondary>
49862 This condition is relevant only in an ACL that is run after a message has been
49863 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
49864 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
49865 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
49866 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
49867 However, an address that appears in one of these headers need not be an address
49868 that accepts bounce messages; only sender addresses in envelopes are required
49869 to accept bounces. Therefore, if you use the callout option on this check, you
49870 might want to arrange for a non-empty address in the MAIL command.
49873 Details of address verification and the options are given later, starting at
49874 section <xref linkend="SECTaddressverification"/> (callouts are described in section
49875 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
49876 condition to restrict it to bounce messages only:
49878 <literallayout class="monospaced">
49880 message = A valid sender header is required for bounces
49881 !verify = header_sender
49883 </listitem></varlistentry>
49885 <term><emphasis role="bold">verify = header_syntax</emphasis></term>
49888 <indexterm role="concept">
49889 <primary><option>verify</option> ACL condition</primary>
49891 <indexterm role="concept">
49892 <primary>access control lists (ACLs)</primary>
49893 <secondary>verifying header syntax</secondary>
49895 <indexterm role="concept">
49896 <primary>header lines</primary>
49897 <secondary>verifying syntax</secondary>
49899 <indexterm role="concept">
49900 <primary>verifying</primary>
49901 <secondary>header syntax</secondary>
49903 This condition is relevant only in an ACL that is run after a message has been
49904 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
49905 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
49906 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
49907 and <emphasis>Bcc:</emphasis>). Unqualified addresses (local parts without domains) are
49908 permitted only in locally generated messages and from hosts that match
49909 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
49913 Note that this condition is a syntax check only. However, a common spamming
49914 ploy used to be to send syntactically invalid headers such as
49916 <literallayout class="monospaced">
49920 and this condition can be used to reject such messages, though they are not as
49921 common as they used to be.
49923 </listitem></varlistentry>
49925 <term><emphasis role="bold">verify = helo</emphasis></term>
49928 <indexterm role="concept">
49929 <primary><option>verify</option> ACL condition</primary>
49931 <indexterm role="concept">
49932 <primary>access control lists (ACLs)</primary>
49933 <secondary>verifying HELO/EHLO</secondary>
49935 <indexterm role="concept">
49936 <primary>HELO</primary>
49937 <secondary>verifying</secondary>
49939 <indexterm role="concept">
49940 <primary>EHLO</primary>
49941 <secondary>verifying</secondary>
49943 <indexterm role="concept">
49944 <primary>verifying</primary>
49945 <secondary>EHLO</secondary>
49947 <indexterm role="concept">
49948 <primary>verifying</primary>
49949 <secondary>HELO</secondary>
49951 This condition is true if a HELO or EHLO command has been received from the
49952 client host, and its contents have been verified. If there has been no previous
49953 attempt to verify the HELO/EHLO contents, it is carried out when this
49954 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
49955 <option>helo_try_verify_hosts</option> options for details of how to request verification
49956 independently of this condition.
49959 For SMTP input that does not come over TCP/IP (the <option>-bs</option> command line
49960 option), this condition is always true.
49962 </listitem></varlistentry>
49964 <term><emphasis role="bold">verify = not_blind</emphasis></term>
49967 <indexterm role="concept">
49968 <primary>verifying</primary>
49969 <secondary>not blind</secondary>
49971 <indexterm role="concept">
49972 <primary>bcc recipients, verifying none</primary>
49974 This condition checks that there are no blind (bcc) recipients in the message.
49975 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
49976 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
49977 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
49978 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
49979 used only in a DATA or non-SMTP ACL.
49982 There are, of course, many legitimate messages that make use of blind (bcc)
49983 recipients. This check should not be used on its own for blocking messages.
49985 </listitem></varlistentry>
49987 <term><emphasis role="bold">verify = recipient/</emphasis><<emphasis>options</emphasis>></term>
49990 <indexterm role="concept">
49991 <primary><option>verify</option> ACL condition</primary>
49993 <indexterm role="concept">
49994 <primary>access control lists (ACLs)</primary>
49995 <secondary>verifying recipient</secondary>
49997 <indexterm role="concept">
49998 <primary>recipient</primary>
49999 <secondary>verifying</secondary>
50001 <indexterm role="concept">
50002 <primary>verifying</primary>
50003 <secondary>recipient</secondary>
50005 <indexterm role="variable">
50006 <primary><varname>$address_data</varname></primary>
50008 This condition is relevant only after a RCPT command. It verifies the current
50009 recipient. Details of address verification are given later, starting at section
50010 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
50011 of <varname>$address_data</varname> is the last value that was set while routing the address.
50012 This applies even if the verification fails. When an address that is being
50013 verified is redirected to a single address, verification continues with the new
50014 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
50015 value for the child address.
50017 </listitem></varlistentry>
50019 <term><emphasis role="bold">verify = reverse_host_lookup</emphasis></term>
50022 <indexterm role="concept">
50023 <primary><option>verify</option> ACL condition</primary>
50025 <indexterm role="concept">
50026 <primary>access control lists (ACLs)</primary>
50027 <secondary>verifying host reverse lookup</secondary>
50029 <indexterm role="concept">
50030 <primary>host</primary>
50031 <secondary>verifying reverse lookup</secondary>
50033 This condition ensures that a verified host name has been looked up from the IP
50034 address of the client host. (This may have happened already if the host name
50035 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
50036 Verification ensures that the host name obtained from a reverse DNS lookup, or
50037 one of its aliases, does, when it is itself looked up in the DNS, yield the
50038 original IP address.
50041 If this condition is used for a locally generated message (that is, when there
50042 is no client host involved), it always succeeds.
50044 </listitem></varlistentry>
50046 <term><emphasis role="bold">verify = sender/</emphasis><<emphasis>options</emphasis>></term>
50049 <indexterm role="concept">
50050 <primary><option>verify</option> ACL condition</primary>
50052 <indexterm role="concept">
50053 <primary>access control lists (ACLs)</primary>
50054 <secondary>verifying sender</secondary>
50056 <indexterm role="concept">
50057 <primary>sender</primary>
50058 <secondary>verifying</secondary>
50060 <indexterm role="concept">
50061 <primary>verifying</primary>
50062 <secondary>sender</secondary>
50064 This condition is relevant only after a MAIL or RCPT command, or after a
50065 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
50066 the message’s sender is empty (that is, this is a bounce message), the
50067 condition is true. Otherwise, the sender address is verified.
50070 <indexterm role="variable">
50071 <primary><varname>$address_data</varname></primary>
50073 <indexterm role="variable">
50074 <primary><varname>$sender_address_data</varname></primary>
50076 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
50077 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
50078 value can be used in subsequent conditions and modifiers in the same ACL
50079 statement. It does not persist after the end of the current statement. If you
50080 want to preserve the value for longer, you can save it in an ACL variable.
50083 Details of verification are given later, starting at section
50084 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
50085 to avoid doing it more than once per message.
50087 </listitem></varlistentry>
50089 <term><emphasis role="bold">verify = sender=</emphasis><<emphasis>address</emphasis>><emphasis role="bold">/</emphasis><<emphasis>options</emphasis>></term>
50092 <indexterm role="concept">
50093 <primary><option>verify</option> ACL condition</primary>
50095 This is a variation of the previous option, in which a modified address is
50096 verified as a sender.
50098 </listitem></varlistentry>
50101 <section id="SECTmorednslists">
50102 <title>Using DNS lists</title>
50104 <indexterm role="concept">
50105 <primary>DNS list</primary>
50106 <secondary>in ACL</secondary>
50108 <indexterm role="concept">
50109 <primary>black list (DNS)</primary>
50111 <indexterm role="concept">
50112 <primary>access control lists (ACLs)</primary>
50113 <secondary>testing a DNS list</secondary>
50115 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
50116 is on at least one of a number of DNS lists by looking up the inverted IP
50117 address in one or more DNS domains. (Note that DNS list domains are not mail
50118 domains, so the <literal>+</literal> syntax for named lists doesn’t work - it is used for
50119 special options instead.) For example, if the calling host’s IP
50120 address is 192.168.62.43, and the ACL statement is
50122 <literallayout class="monospaced">
50123 deny dnslists = blackholes.mail-abuse.org : \
50124 dialups.mail-abuse.org
50127 the following records are looked up:
50129 <literallayout class="monospaced">
50130 43.62.168.192.blackholes.mail-abuse.org
50131 43.62.168.192.dialups.mail-abuse.org
50134 As soon as Exim finds an existing DNS record, processing of the list stops.
50135 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
50136 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
50137 use two separate conditions:
50139 <literallayout class="monospaced">
50140 deny dnslists = blackholes.mail-abuse.org
50141 dnslists = dialups.mail-abuse.org
50144 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
50145 behaves as if the host does not match the list item, that is, as if the DNS
50146 record does not exist. If there are further items in the DNS list, they are
50150 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
50151 (which is the most common usage), because it prevents a DNS failure from
50152 blocking mail. However, you can change this behaviour by putting one of the
50153 following special items in the list:
50156 <literal>+include_unknown </literal> behave as if the item is on the list
50157 <literal>+exclude_unknown </literal> behave as if the item is not on the list (default)
50158 <literal>+defer_unknown </literal> give a temporary error
50161 <indexterm role="concept">
50162 <primary><literal>+include_unknown</literal></primary>
50164 <indexterm role="concept">
50165 <primary><literal>+exclude_unknown</literal></primary>
50167 <indexterm role="concept">
50168 <primary><literal>+defer_unknown</literal></primary>
50170 Each of these applies to any subsequent items on the list. For example:
50172 <literallayout class="monospaced">
50173 deny dnslists = +defer_unknown : foo.bar.example
50176 Testing the list of domains stops as soon as a match is found. If you want to
50177 warn for one list and block for another, you can use two different statements:
50179 <literallayout class="monospaced">
50180 deny dnslists = blackholes.mail-abuse.org
50181 warn message = X-Warn: sending host is on dialups list
50182 dnslists = dialups.mail-abuse.org
50185 DNS list lookups are cached by Exim for the duration of the SMTP session,
50186 so a lookup based on the IP address is done at most once for any incoming
50187 connection. Exim does not share information between multiple incoming
50188 connections (but your local name server cache should be active).
50191 <section id="SECID201">
50192 <title>Specifying the IP address for a DNS list lookup</title>
50194 <indexterm role="concept">
50195 <primary>DNS list</primary>
50196 <secondary>keyed by explicit IP address</secondary>
50198 By default, the IP address that is used in a DNS list lookup is the IP address
50199 of the calling host. However, you can specify another IP address by listing it
50200 after the domain name, introduced by a slash. For example:
50202 <literallayout class="monospaced">
50203 deny dnslists = black.list.tld/192.168.1.2
50206 This feature is not very helpful with explicit IP addresses; it is intended for
50207 use with IP addresses that are looked up, for example, the IP addresses of the
50208 MX hosts or nameservers of an email sender address. For an example, see section
50209 <xref linkend="SECTmulkeyfor"/> below.
50212 <section id="SECID202">
50213 <title>DNS lists keyed on domain names</title>
50215 <indexterm role="concept">
50216 <primary>DNS list</primary>
50217 <secondary>keyed by domain name</secondary>
50219 There are some lists that are keyed on domain names rather than inverted IP
50220 addresses (see for example the <emphasis>domain based zones</emphasis> link at
50221 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
50222 with these lists. You can change the name that is looked up in a DNS list by
50223 listing it after the domain name, introduced by a slash. For example,
50225 <literallayout class="monospaced">
50226 deny message = Sender's domain is listed at $dnslist_domain
50227 dnslists = dsn.rfc-ignorant.org/$sender_address_domain
50230 This particular example is useful only in ACLs that are obeyed after the
50231 RCPT or DATA commands, when a sender address is available. If (for
50232 example) the message’s sender is <emphasis>user@tld.example</emphasis> the name that is looked
50233 up by this example is
50235 <literallayout class="monospaced">
50236 tld.example.dsn.rfc-ignorant.org
50239 A single <option>dnslists</option> condition can contain entries for both names and IP
50240 addresses. For example:
50242 <literallayout class="monospaced">
50243 deny dnslists = sbl.spamhaus.org : \
50244 dsn.rfc-ignorant.org/$sender_address_domain
50247 The first item checks the sending host’s IP address; the second checks a domain
50248 name. The whole condition is true if either of the DNS lookups succeeds.
50251 <section id="SECTmulkeyfor">
50252 <title>Multiple explicit keys for a DNS list</title>
50254 <indexterm role="concept">
50255 <primary>DNS list</primary>
50256 <secondary>multiple keys for</secondary>
50258 The syntax described above for looking up explicitly-defined values (either
50259 names or IP addresses) in a DNS blacklist is a simplification. After the domain
50260 name for the DNS list, what follows the slash can in fact be a list of items.
50261 As with all lists in Exim, the default separator is a colon. However, because
50262 this is a sublist within the list of DNS blacklist domains, it is necessary
50263 either to double the separators like this:
50265 <literallayout class="monospaced">
50266 dnslists = black.list.tld/name.1::name.2
50269 or to change the separator character, like this:
50271 <literallayout class="monospaced">
50272 dnslists = black.list.tld/<;name.1;name.2
50275 If an item in the list is an IP address, it is inverted before the DNS
50276 blacklist domain is appended. If it is not an IP address, no inversion
50277 occurs. Consider this condition:
50279 <literallayout class="monospaced">
50280 dnslists = black.list.tld/<;192.168.1.2;a.domain
50283 The DNS lookups that occur are:
50285 <literallayout class="monospaced">
50286 2.1.168.192.black.list.tld
50287 a.domain.black.list.tld
50290 Once a DNS record has been found (that matches a specific IP return
50291 address, if specified – see section <xref linkend="SECTaddmatcon"/>), no further lookups
50292 are done. If there is a temporary DNS error, the rest of the sublist of domains
50293 or IP addresses is tried. A temporary error for the whole dnslists item occurs
50294 only if no other DNS lookup in this sublist succeeds. In other words, a
50295 successful lookup for any of the items in the sublist overrides a temporary
50296 error for a previous item.
50299 The ability to supply a list of items after the slash is in some sense just a
50300 syntactic convenience. These two examples have the same effect:
50302 <literallayout class="monospaced">
50303 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
50304 dnslists = black.list.tld/a.domain::b.domain
50307 However, when the data for the list is obtained from a lookup, the second form
50308 is usually much more convenient. Consider this example:
50310 <literallayout class="monospaced">
50311 deny message = The mail servers for the domain \
50312 $sender_address_domain \
50313 are listed at $dnslist_domain ($dnslist_value); \
50315 dnslists = sbl.spamhaus.org/<|${lookup dnsdb {>|a=<|\
50316 ${lookup dnsdb {>|mxh=\
50317 $sender_address_domain} }} }
50320 Note the use of <literal>>|</literal> in the dnsdb lookup to specify the separator for
50321 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
50322 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
50323 of expanding the condition might be something like this:
50325 <literallayout class="monospaced">
50326 dnslists = sbl.spahmaus.org/<|192.168.2.3|192.168.5.6|...
50329 Thus, this example checks whether or not the IP addresses of the sender
50330 domain’s mail servers are on the Spamhaus black list.
50333 The key that was used for a successful DNS list lookup is put into the variable
50334 <varname>$dnslist_matched</varname> (see section <xref linkend="SECID204"/>).
50337 <section id="SECID203">
50338 <title>Data returned by DNS lists</title>
50340 <indexterm role="concept">
50341 <primary>DNS list</primary>
50342 <secondary>data returned from</secondary>
50344 DNS lists are constructed using address records in the DNS. The original RBL
50345 just used the address 127.0.0.1 on the right hand side of each record, but the
50346 RBL+ list and some other lists use a number of values with different meanings.
50347 The values used on the RBL+ list are:
50352 127.1.0.3 DUL and RBL
50354 127.1.0.5 RSS and RBL
50355 127.1.0.6 RSS and DUL
50356 127.1.0.7 RSS and DUL and RBL
50359 Section <xref linkend="SECTaddmatcon"/> below describes how you can distinguish between
50360 different values. Some DNS lists may return more than one address record;
50361 see section <xref linkend="SECThanmuldnsrec"/> for details of how they are checked.
50364 <section id="SECID204">
50365 <title>Variables set from DNS lists</title>
50367 <indexterm role="concept">
50368 <primary>expansion</primary>
50369 <secondary>variables, set from DNS list</secondary>
50371 <indexterm role="concept">
50372 <primary>DNS list</primary>
50373 <secondary>variables set from</secondary>
50375 <indexterm role="variable">
50376 <primary><varname>$dnslist_domain</varname></primary>
50378 <indexterm role="variable">
50379 <primary><varname>$dnslist_matched</varname></primary>
50381 <indexterm role="variable">
50382 <primary><varname>$dnslist_text</varname></primary>
50384 <indexterm role="variable">
50385 <primary><varname>$dnslist_value</varname></primary>
50387 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname> contains
50388 the name of the overall domain that matched (for example,
50389 <literal>spamhaus.example</literal>), <varname>$dnslist_matched</varname> contains the key within that domain
50390 (for example, <literal>192.168.5.3</literal>), and <varname>$dnslist_value</varname> contains the data from
50391 the DNS record. When the key is an IP address, it is not reversed in
50392 <varname>$dnslist_matched</varname> (though it is, of course, in the actual lookup). In simple
50393 cases, for example:
50395 <literallayout class="monospaced">
50396 deny dnslists = spamhaus.example
50399 the key is also available in another variable (in this case,
50400 <varname>$sender_host_address</varname>). In more complicated cases, however, this is not true.
50401 For example, using a data lookup (as described in section <xref linkend="SECTmulkeyfor"/>)
50402 might generate a dnslists lookup like this:
50404 <literallayout class="monospaced">
50405 deny dnslists = spamhaus.example/<|192.168.1.2|192.168.6.7|...
50408 If this condition succeeds, the value in <varname>$dnslist_matched</varname> might be
50409 <literal>192.168.6.7</literal> (for example).
50412 If more than one address record is returned by the DNS lookup, all the IP
50413 addresses are included in <varname>$dnslist_value</varname>, separated by commas and spaces.
50414 The variable <varname>$dnslist_text</varname> contains the contents of any associated TXT
50415 record. For lists such as RBL+ the TXT record for a merged entry is often not
50416 very meaningful. See section <xref linkend="SECTmordetinf"/> for a way of obtaining more
50420 You can use the DNS list variables in <option>message</option> or <option>log_message</option> modifiers
50421 – although these appear before the condition in the ACL, they are not
50422 expanded until after it has failed. For example:
50424 <literallayout class="monospaced">
50425 deny hosts = !+local_networks
50426 message = $sender_host_address is listed \
50428 dnslists = rbl-plus.mail-abuse.example
50431 <section id="SECTaddmatcon">
50432 <title>Additional matching conditions for DNS lists</title>
50434 <indexterm role="concept">
50435 <primary>DNS list</primary>
50436 <secondary>matching specific returned data</secondary>
50438 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
50439 in order to restrict its action to DNS records with a matching right hand side.
50442 <literallayout class="monospaced">
50443 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
50446 rejects only those hosts that yield 127.0.0.2. Without this additional data,
50447 any address record is considered to be a match. For the moment, we assume
50448 that the DNS lookup returns just one record. Section <xref linkend="SECThanmuldnsrec"/>
50449 describes how multiple records are handled.
50452 More than one IP address may be given for checking, using a comma as a
50453 separator. These are alternatives – if any one of them matches, the
50454 <option>dnslists</option> condition is true. For example:
50456 <literallayout class="monospaced">
50457 deny dnslists = a.b.c=127.0.0.2,127.0.0.3
50460 If you want to specify a constraining address list and also specify names or IP
50461 addresses to be looked up, the constraining address list must be specified
50462 first. For example:
50464 <literallayout class="monospaced">
50465 deny dnslists = dsn.rfc-ignorant.org\
50466 =127.0.0.2/$sender_address_domain
50469 If the character <literal>&</literal> is used instead of <literal>=</literal>, the comparison for each
50470 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
50471 In other words, the listed addresses are used as bit masks. The comparison is
50472 true if all the bits in the mask are present in the address that is being
50473 tested. For example:
50475 <literallayout class="monospaced">
50476 dnslists = a.b.c&0.0.0.3
50479 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
50480 want to test whether one bit or another bit is present (as opposed to both
50481 being present), you must use multiple values. For example:
50483 <literallayout class="monospaced">
50484 dnslists = a.b.c&0.0.0.1,0.0.0.2
50487 matches if the final component of the address is an odd number or two times
50491 <section id="SECID205">
50492 <title>Negated DNS matching conditions</title>
50494 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
50497 <literallayout class="monospaced">
50498 deny dnslists = a.b.c=127.0.0.2,127.0.0.3
50501 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
50502 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
50504 <literallayout class="monospaced">
50505 deny dnslists = a.b.c!=127.0.0.2,127.0.0.3
50508 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
50509 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
50510 words, the result of the test is inverted if an exclamation mark appears before
50511 the <literal>=</literal> (or the <literal>&</literal>) sign.
50514 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
50515 host, or address list (which is why the syntax is different).
50518 If you are using just one list, the negation syntax does not gain you much. The
50519 previous example is precisely equivalent to
50521 <literallayout class="monospaced">
50522 deny dnslists = a.b.c
50523 !dnslists = a.b.c=127.0.0.2,127.0.0.3
50526 However, if you are using multiple lists, the negation syntax is clearer.
50527 Consider this example:
50529 <literallayout class="monospaced">
50530 deny dnslists = sbl.spamhaus.org : \
50532 dnsbl.njabl.org!=127.0.0.3 : \
50536 Using only positive lists, this would have to be:
50538 <literallayout class="monospaced">
50539 deny dnslists = sbl.spamhaus.org : \
50541 deny dnslists = dnsbl.njabl.org
50542 !dnslists = dnsbl.njabl.org=127.0.0.3
50543 deny dnslists = relays.ordb.org
50546 which is less clear, and harder to maintain.
50549 <section id="SECThanmuldnsrec">
50550 <title>Handling multiple DNS records from a DNS list</title>
50552 A DNS lookup for a <option>dnslists</option> condition may return more than one DNS record,
50553 thereby providing more than one IP address. When an item in a <option>dnslists</option> list
50554 is followed by <literal>=</literal> or <literal>&</literal> and a list of IP addresses, in order to restrict
50555 the match to specific results from the DNS lookup, there are two ways in which
50556 the checking can be handled. For example, consider the condition:
50558 <literallayout class="monospaced">
50559 dnslists = a.b.c=127.0.0.1
50562 What happens if the DNS lookup for the incoming IP address yields both
50563 127.0.0.1 and 127.0.0.2 by means of two separate DNS records? Is the
50564 condition true because at least one given value was found, or is it false
50565 because at least one of the found values was not listed? And how does this
50566 affect negated conditions? Both possibilities are provided for with the help of
50567 additional separators <literal>==</literal> and <literal>=&</literal>.
50572 If <literal>=</literal> or <literal>&</literal> is used, the condition is true if any one of the looked up
50573 IP addresses matches one of the listed addresses. For the example above, the
50574 condition is true because 127.0.0.1 matches.
50579 If <literal>==</literal> or <literal>=&</literal> is used, the condition is true only if every one of the
50580 looked up IP addresses matches one of the listed addresses. If the condition is
50583 <literallayout class="monospaced">
50584 dnslists = a.b.c==127.0.0.1
50587 and the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
50588 false because 127.0.0.2 is not listed. You would need to have:
50590 <literallayout class="monospaced">
50591 dnslists = a.b.c==127.0.0.1,127.0.0.2
50594 for the condition to be true.
50599 When <literal>!</literal> is used to negate IP address matching, it inverts the result, giving
50600 the precise opposite of the behaviour above. Thus:
50605 If <literal>!=</literal> or <literal>!&</literal> is used, the condition is true if none of the looked up IP
50606 addresses matches one of the listed addresses. Consider:
50608 <literallayout class="monospaced">
50609 dnslists = a.b.c!&0.0.0.1
50612 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
50613 false because 127.0.0.1 matches.
50618 If <literal>!==</literal> or <literal>!=&</literal> is used, the condition is true there is at least one
50619 looked up IP address that does not match. Consider:
50621 <literallayout class="monospaced">
50622 dnslists = a.b.c!=&0.0.0.1
50625 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
50626 true, because 127.0.0.2 does not match. You would need to have:
50628 <literallayout class="monospaced">
50629 dnslists = a.b.c!=&0.0.0.1,0.0.0.2
50632 for the condition to be false.
50637 When the DNS lookup yields only a single IP address, there is no difference
50638 between <literal>=</literal> and <literal>==</literal> and between <literal>&</literal> and <literal>=&</literal>.
50641 <section id="SECTmordetinf">
50642 <title>Detailed information from merged DNS lists</title>
50644 <indexterm role="concept">
50645 <primary>DNS list</primary>
50646 <secondary>information from merged</secondary>
50648 When the facility for restricting the matching IP values in a DNS list is used,
50649 the text from the TXT record that is set in <varname>$dnslist_text</varname> may not reflect
50650 the true reason for rejection. This happens when lists are merged and the IP
50651 address in the A record is used to distinguish them; unfortunately there is
50652 only one TXT record. One way round this is not to use merged lists, but that
50653 can be inefficient because it requires multiple DNS lookups where one would do
50654 in the vast majority of cases when the host of interest is not on any of the
50658 A less inefficient way of solving this problem is available. If
50659 two domain names, comma-separated, are given, the second is used first to
50660 do an initial check, making use of any IP value restrictions that are set.
50661 If there is a match, the first domain is used, without any IP value
50662 restrictions, to get the TXT record. As a byproduct of this, there is also
50663 a check that the IP being tested is indeed on the first list. The first
50664 domain is the one that is put in <varname>$dnslist_domain</varname>. For example:
50666 <literallayout class="monospaced">
50668 rejected because $sender_host_address is blacklisted \
50669 at $dnslist_domain\n$dnslist_text
50671 sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \
50672 dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
50675 For the first blacklist item, this starts by doing a lookup in
50676 <emphasis>sbl-xbl.spamhaus.org</emphasis> and testing for a 127.0.0.2 return. If there is a
50677 match, it then looks in <emphasis>sbl.spamhaus.org</emphasis>, without checking the return
50678 value, and as long as something is found, it looks for the corresponding TXT
50679 record. If there is no match in <emphasis>sbl-xbl.spamhaus.org</emphasis>, nothing more is done.
50680 The second blacklist item is processed similarly.
50683 If you are interested in more than one merged list, the same list must be
50684 given several times, but because the results of the DNS lookups are cached,
50685 the DNS calls themselves are not repeated. For example:
50687 <literallayout class="monospaced">
50688 reject dnslists = \
50689 http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \
50690 socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \
50691 misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \
50692 dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
50695 In this case there is one lookup in <emphasis>dnsbl.sorbs.net</emphasis>, and if none of the IP
50696 values matches (or if no record is found), this is the only lookup that is
50697 done. Only if there is a match is one of the more specific lists consulted.
50700 <section id="SECTmorednslistslast">
50701 <title>DNS lists and IPv6</title>
50703 <indexterm role="concept">
50704 <primary>IPv6</primary>
50705 <secondary>DNS black lists</secondary>
50707 <indexterm role="concept">
50708 <primary>DNS list</primary>
50709 <secondary>IPv6 usage</secondary>
50711 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
50712 nibble by nibble. For example, if the calling host’s IP address is
50713 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
50715 <literallayout class="monospaced">
50716 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
50717 f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
50720 (split over two lines here to fit on the page). Unfortunately, some of the DNS
50721 lists contain wildcard records, intended for IPv4, that interact badly with
50722 IPv6. For example, the DNS entry
50724 <literallayout class="monospaced">
50725 *.3.some.list.example. A 127.0.0.1
50728 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
50729 Unfortunately, it also matches the entire 3::/4 IPv6 network.
50732 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
50733 <option>condition</option> condition, as in this example:
50735 <literallayout class="monospaced">
50736 deny condition = ${if isip4{$sender_host_address}}
50737 dnslists = some.list.example
50740 <section id="SECTratelimiting">
50741 <title>Rate limiting incoming messages</title>
50743 <indexterm role="concept">
50744 <primary>rate limiting</primary>
50745 <secondary>client sending</secondary>
50747 <indexterm role="concept">
50748 <primary>limiting client sending rates</primary>
50750 <indexterm role="option">
50751 <primary><option>smtp_ratelimit_*</option></primary>
50753 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
50754 which clients can send email. This is more powerful than the
50755 <option>smtp_ratelimit_*</option> options, because those options control the rate of
50756 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
50757 works across all connections (concurrent and sequential) from the same client
50758 host. The syntax of the <option>ratelimit</option> condition is:
50761 <literal>ratelimit =</literal> <<emphasis>m</emphasis>> <literal>/</literal> <<emphasis>p</emphasis>> <literal>/</literal> <<emphasis>options</emphasis>> <literal>/</literal> <<emphasis>key</emphasis>>
50764 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
50765 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
50768 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
50769 <varname>$sender_rate</varname> to the client’s computed rate, <varname>$sender_rate_limit</varname> to the
50770 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
50771 of <emphasis>p</emphasis>.
50774 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
50775 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
50776 means that it takes Exim longer to forget a client’s past behaviour. The
50777 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
50778 send in each time interval. It also specifies the number of messages permitted
50779 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
50780 constant, you can allow a client to send more messages in a burst without
50781 changing its long-term sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
50782 both small, messages must be sent at an even rate.
50785 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
50786 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
50787 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
50788 instructions when it is run with no arguments.
50791 The key is used to look up the data for calculating the client’s average
50792 sending rate. This data is stored in Exim’s spool directory, alongside the
50793 retry and other hints databases. The default key is <varname>$sender_host_address</varname>,
50794 which means Exim computes the sending rate of each client host IP address.
50795 By changing the key you can change how Exim identifies clients for the purpose
50796 of ratelimiting. For example, to limit the sending rate of each authenticated
50797 user, independent of the computer they are sending from, set the key to
50798 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
50799 example, <varname>$authenticated_id</varname> is only meaningful if the client has
50800 authenticated (which you can check with the <option>authenticated</option> ACL condition).
50803 The lookup key does not have to identify clients: If you want to limit the
50804 rate at which a recipient receives messages, you can use the key
50805 <literal>$local_part@$domain</literal> with the <option>per_rcpt</option> option (see below) in a RCPT
50809 Internally, Exim appends the smoothing constant <emphasis>p</emphasis> and the options onto the
50810 lookup key because they alter the meaning of the stored data. This is not true
50811 for the limit <emphasis>m</emphasis>, so you can alter the configured maximum rate and Exim will
50812 still remember clients’ past behaviour, but if you alter the other ratelimit
50813 parameters Exim forgets past behaviour.
50816 Each <option>ratelimit</option> condition can have up to three options. One option
50817 specifies what Exim measures the rate of, and the second specifies how Exim
50818 handles excessively fast clients. The third option can be <literal>noupdate</literal>, to
50819 disable updating of the ratelimiting database (see section <xref linkend="rearatdat"/>).
50820 The options are separated by a slash, like the other parameters. They may
50821 appear in any order.
50824 <section id="ratoptmea">
50825 <title>Ratelimit options for what is being measured</title>
50827 The <option>per_conn</option> option limits the client’s connection rate.
50830 The <option>per_mail</option> option limits the client’s rate of sending messages. This is
50831 the default if none of the <option>per_*</option> options is specified.
50834 The <option>per_byte</option> option limits the sender’s email bandwidth. Note that it is
50835 best to use this option in the DATA ACL; if it is used in an earlier ACL it
50836 relies on the SIZE parameter specified by the client in its MAIL command,
50837 which may be inaccurate or completely missing. You can follow the limit <emphasis>m</emphasis>
50838 in the configuration with K, M, or G to specify limits in kilobytes,
50839 megabytes, or gigabytes, respectively.
50842 The <option>per_rcpt</option> option causes Exim to limit the rate at which
50843 recipients are accepted. To be effective, it would need to be used in
50844 either the <option>acl_smtp_rcpt</option> or the <option>acl_not_smtp</option> ACL. In the
50845 <option>acl_smtp_rcpt</option> ACL, the number of recipients is incremented by one.
50846 In the case of a locally submitted message in the <option>acl_not_smtp</option> ACL,
50847 the number of recipients is incremented by the <option>$recipients_count</option>
50848 for the entire message. Note that in either case the rate limiting
50849 engine will see a message with many recipients as a large high-speed
50853 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
50854 condition is processed. This can be used to limit the SMTP command rate.
50855 This command is essentially an alias of <option>per_rcpt</option> to make it clear
50856 that the effect is to limit the rate at which individual commands,
50857 rather than recipients, are accepted.
50860 <section id="ratophanfas">
50861 <title>Ratelimit options for handling fast clients</title>
50863 If a client’s average rate is greater than the maximum, the rate limiting
50864 engine can react in two possible ways, depending on the presence of the
50865 <option>strict</option> or <option>leaky</option> options. This is independent of the other
50866 counter-measures (such as rejecting the message) that may be specified by the
50867 rest of the ACL. The default mode is leaky, which avoids a sender’s
50868 over-aggressive retry rate preventing it from getting any email through.
50871 The <option>strict</option> option means that the client’s recorded rate is always
50872 updated. The effect of this is that Exim measures the client’s average rate
50873 of attempts to send email, which can be much higher than the maximum it is
50874 actually allowed. If the client is over the limit it may be subjected to
50875 counter-measures by the ACL until it slows down below the maximum rate. If
50876 the client stops attempting to send email for the time specified in the <emphasis>p</emphasis>
50877 parameter then its computed rate will decay exponentially to 37% of its peak
50878 value. You can work out the time (the number of smoothing periods) that a
50879 client is subjected to counter-measures after an over-limit burst with this
50882 <literallayout class="monospaced">
50883 ln(peakrate/maxrate)
50886 The <option>leaky</option> (default) option means that the client’s recorded rate is not
50887 updated if it is above the limit. The effect of this is that Exim measures the
50888 client’s average rate of successfully sent email, which cannot be greater than
50889 the maximum allowed. If the client is over the limit it may suffer some
50890 counter-measures (as specified in the ACL), but it will still be able to send
50891 email at the configured maximum rate, whatever the rate of its attempts. This
50892 is generally the better choice if you have clients that retry automatically.
50895 <section id="useratlim">
50896 <title>Using rate limiting</title>
50898 Exim’s other ACL facilities are used to define what counter-measures are taken
50899 when the rate limit is exceeded. This might be anything from logging a warning
50900 (for example, while measuring existing sending rates in order to define
50901 policy), through time delays to slow down fast senders, up to rejecting the
50902 message. For example:
50904 <literallayout class="monospaced">
50905 # Log all senders' rates
50906 warn ratelimit = 0 / 1h / strict
50907 log_message = Sender rate $sender_rate / $sender_rate_period
50909 # Slow down fast senders; note the need to truncate $sender_rate
50910 # at the decimal point.
50911 warn ratelimit = 100 / 1h / per_rcpt / strict
50912 delay = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
50913 $sender_rate_limit }s
50915 # Keep authenticated users under control
50916 deny authenticated = *
50917 ratelimit = 100 / 1d / strict / $authenticated_id
50919 # System-wide rate limit
50920 defer message = Sorry, too busy. Try again later.
50921 ratelimit = 10 / 1s / $primary_hostname
50923 # Restrict incoming rate from each host, with a default
50924 # set using a macro and special cases looked up in a table.
50925 defer message = Sender rate exceeds $sender_rate_limit \
50926 messages per $sender_rate_period
50927 ratelimit = ${lookup {$sender_host_address} \
50928 cdb {DB/ratelimits.cdb} \
50929 {$value} {RATELIMIT} }
50932 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
50933 especially with the <option>per_rcpt</option> option, you may suffer from a performance
50934 bottleneck caused by locking on the ratelimit hints database. Apart from
50935 making your ACLs less complicated, you can reduce the problem by using a
50936 RAM disk for Exim’s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
50937 this means that Exim will lose its hints data after a reboot (including retry
50938 hints, the callout cache, and ratelimit data).
50941 <section id="rearatdat">
50942 <title>Reading ratelimit data without updating</title>
50944 <indexterm role="concept">
50945 <primary>rate limitint</primary>
50946 <secondary>reading data without updating</secondary>
50948 If the <option>noupdate</option> option is present on a <option>ratelimit</option> ACL condition, Exim
50949 computes the rate and checks the limit as normal, but it does not update the
50950 saved data. This means that, in relevant ACLs, it is possible to lookup the
50951 existence of a specified (or auto-generated) ratelimit key without incrementing
50952 the ratelimit counter for that key. In order for this to be useful, another ACL
50953 entry must set the rate for the same key (otherwise it will always be zero).
50956 <literallayout class="monospaced">
50958 deny ratelimit = 100 / 5m / strict / per_cmd / noupdate
50959 log_message = RATE: $sender_rate/$sender_rate_period \
50960 (max $sender_rate_limit)
50963 <emphasis>... some other logic and tests...</emphasis>
50965 <literallayout class="monospaced">
50967 warn ratelimit = 100 / 5m / strict / per_cmd
50968 condition = ${if le{$sender_rate}{$sender_rate_limit}}
50969 logwrite = RATE UPDATE: $sender_rate/$sender_rate_period \
50970 (max $sender_rate_limit)
50973 In this example, the rate is tested and used to deny access (when it is too
50974 high) in the connect ACL, but the actual computation of the remembered rate
50975 happens later, on a per-command basis, in another ACL.
50978 <section id="SECTaddressverification">
50979 <title>Address verification</title>
50981 <indexterm role="concept">
50982 <primary>verifying address</primary>
50983 <secondary>options for</secondary>
50985 <indexterm role="concept">
50986 <primary>policy control</primary>
50987 <secondary>address verification</secondary>
50989 Several of the <option>verify</option> conditions described in section
50990 <xref linkend="SECTaclconditions"/> cause addresses to be verified. Section
50991 <xref linkend="SECTsenaddver"/> discusses the reporting of sender verification failures.
50992 The verification conditions can be followed by options that modify the
50993 verification process. The options are separated from the keyword and from each
50994 other by slashes, and some of them contain parameters. For example:
50996 <literallayout class="monospaced">
50997 verify = sender/callout
50998 verify = recipient/defer_ok/callout=10s,defer_ok
51001 The first stage of address verification, which always happens, is to run the
51002 address through the routers, in <quote>verify mode</quote>. Routers can detect the
51003 difference between verification and routing for delivery, and their actions can
51004 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
51005 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
51006 The available options are as follows:
51011 If the <option>callout</option> option is specified, successful routing to one or more
51012 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
51013 check. Callouts and their sub-options are discussed in the next section.
51018 If there is a defer error while doing verification routing, the ACL
51019 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
51020 options, the condition is forced to be true instead. Note that this is a main
51021 verification option as well as a suboption for callouts.
51026 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
51027 discusses the reporting of sender address verification failures.
51032 The <option>success_on_redirect</option> option causes verification always to succeed
51033 immediately after a successful redirection. By default, if a redirection
51034 generates just one address, that address is also verified. See further
51035 discussion in section <xref linkend="SECTredirwhilveri"/>.
51040 <indexterm role="concept">
51041 <primary>verifying address</primary>
51042 <secondary>differentiating failures</secondary>
51044 <indexterm role="variable">
51045 <primary><varname>$recipient_verify_failure</varname></primary>
51047 <indexterm role="variable">
51048 <primary><varname>$sender_verify_failure</varname></primary>
51050 <indexterm role="variable">
51051 <primary><varname>$acl_verify_message</varname></primary>
51053 After an address verification failure, <varname>$acl_verify_message</varname> contains the
51054 error message that is associated with the failure. It can be preserved by
51057 <literallayout class="monospaced">
51058 warn !verify = sender
51059 set acl_m0 = $acl_verify_message
51062 If you are writing your own custom rejection message or log message when
51063 denying access, you can use this variable to include information about the
51064 verification failure.
51067 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
51068 appropriate) contains one of the following words:
51073 <option>qualify</option>: The address was unqualified (no domain), and the message
51074 was neither local nor came from an exempted host.
51079 <option>route</option>: Routing failed.
51084 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
51085 occurred at or before the MAIL command (that is, on initial
51086 connection, HELO, or MAIL).
51091 <option>recipient</option>: The RCPT command in a callout was rejected.
51096 <option>postmaster</option>: The postmaster check in a callout was rejected.
51101 The main use of these variables is expected to be to distinguish between
51102 rejections of MAIL and rejections of RCPT in callouts.
51105 <section id="SECTcallver">
51106 <title>Callout verification</title>
51108 <indexterm role="concept">
51109 <primary>verifying address</primary>
51110 <secondary>by callout</secondary>
51112 <indexterm role="concept">
51113 <primary>callout</primary>
51114 <secondary>verification</secondary>
51116 <indexterm role="concept">
51117 <primary>SMTP</primary>
51118 <secondary>callout verification</secondary>
51120 For non-local addresses, routing verifies the domain, but is unable to do any
51121 checking of the local part. There are situations where some means of verifying
51122 the local part is desirable. One way this can be done is to make an SMTP
51123 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
51124 a subsequent host for a recipient address, to see if the host accepts the
51125 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
51126 sender address, the callback is not to the client host that is trying to
51127 deliver the message, but to one of the hosts that accepts incoming mail for the
51128 sender’s domain.
51131 Exim does not do callouts by default. If you want them to happen, you must
51132 request them by setting appropriate options on the <option>verify</option> condition, as
51133 described below. This facility should be used with care, because it can add a
51134 lot of resource usage to the cost of verifying an address. However, Exim does
51135 cache the results of callouts, which helps to reduce the cost. Details of
51136 caching are in section <xref linkend="SECTcallvercache"/>.
51139 Recipient callouts are usually used only between hosts that are controlled by
51140 the same administration. For example, a corporate gateway host could use
51141 callouts to check for valid recipients on an internal mailserver. A successful
51142 callout does not guarantee that a real delivery to the address would succeed;
51143 on the other hand, a failing callout does guarantee that a delivery would fail.
51146 If the <option>callout</option> option is present on a condition that verifies an address, a
51147 second stage of verification occurs if the address is successfully routed to
51148 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
51149 <command>manualroute</command> router, where the router specifies the hosts. However, if a
51150 router that does not set up hosts routes to an <command>smtp</command> transport with a
51151 <option>hosts</option> setting, the transport’s hosts are used. If an <command>smtp</command> transport has
51152 <option>hosts_override</option> set, its hosts are always used, whether or not the router
51153 supplies a host list.
51156 The port that is used is taken from the transport, if it is specified and is a
51157 remote transport. (For routers that do verification only, no transport need be
51158 specified.) Otherwise, the default SMTP port is used. If a remote transport
51159 specifies an outgoing interface, this is used; otherwise the interface is not
51160 specified. Likewise, the text that is used for the HELO command is taken from
51161 the transport’s <option>helo_data</option> option; if there is no transport, the value of
51162 <varname>$smtp_active_hostname</varname> is used.
51165 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
51166 test whether a bounce message could be delivered to the sender address. The
51167 following SMTP commands are sent:
51170 <literal>HELO </literal><<emphasis>local host name</emphasis>>
51171 <literal>MAIL FROM:<></literal>
51172 <literal>RCPT TO:</literal><<emphasis>the address to be tested</emphasis>>
51173 <literal>QUIT</literal>
51176 LHLO is used instead of HELO if the transport’s <option>protocol</option> option is
51177 set to <quote>lmtp</quote>.
51180 A recipient callout check is similar. By default, it also uses an empty address
51181 for the sender. This default is chosen because most hosts do not make use of
51182 the sender address when verifying a recipient. Using the same address means
51183 that a single cache entry can be used for each recipient. Some sites, however,
51184 do make use of the sender address when verifying. These are catered for by the
51185 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
51188 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
51189 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
51190 Exim tries the next host, if any. If there is a problem with all the remote
51191 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
51192 <option>callout</option> option is given, in which case the condition is forced to succeed.
51195 <indexterm role="concept">
51196 <primary>SMTP</primary>
51197 <secondary>output flushing, disabling for callout</secondary>
51199 A callout may take a little time. For this reason, Exim normally flushes SMTP
51200 output before performing a callout in an ACL, to avoid unexpected timeouts in
51201 clients when the SMTP PIPELINING extension is in use. The flushing can be
51202 disabled by using a <option>control</option> modifier to set <option>no_callout_flush</option>.
51205 <section id="CALLaddparcall">
51206 <title>Additional parameters for callouts</title>
51208 <indexterm role="concept">
51209 <primary>callout</primary>
51210 <secondary>additional parameters for</secondary>
51212 The <option>callout</option> option can be followed by an equals sign and a number of
51213 optional parameters, separated by commas. For example:
51215 <literallayout class="monospaced">
51216 verify = recipient/callout=10s,defer_ok
51219 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
51220 separate verify options, is retained for backwards compatibility, but is now
51221 deprecated. The additional parameters for <option>callout</option> are as follows:
51225 <term><<emphasis>a time interval</emphasis>></term>
51228 <indexterm role="concept">
51229 <primary>callout</primary>
51230 <secondary>timeout, specifying</secondary>
51232 This specifies the timeout that applies for the callout attempt to each host.
51235 <literallayout class="monospaced">
51236 verify = sender/callout=5s
51239 The default is 30 seconds. The timeout is used for each response from the
51240 remote host. It is also used for the initial connection, unless overridden by
51241 the <option>connect</option> parameter.
51243 </listitem></varlistentry>
51245 <term><emphasis role="bold">connect = </emphasis><<emphasis>time interval</emphasis>></term>
51248 <indexterm role="concept">
51249 <primary>callout</primary>
51250 <secondary>connection timeout, specifying</secondary>
51252 This parameter makes it possible to set a different (usually smaller) timeout
51253 for making the SMTP connection. For example:
51255 <literallayout class="monospaced">
51256 verify = sender/callout=5s,connect=1s
51259 If not specified, this timeout defaults to the general timeout value.
51261 </listitem></varlistentry>
51263 <term><emphasis role="bold">defer_ok</emphasis></term>
51266 <indexterm role="concept">
51267 <primary>callout</primary>
51268 <secondary>defer, action on</secondary>
51270 When this parameter is present, failure to contact any host, or any other kind
51271 of temporary error, is treated as success by the ACL. However, the cache is not
51272 updated in this circumstance.
51274 </listitem></varlistentry>
51276 <term><emphasis role="bold">fullpostmaster</emphasis></term>
51279 <indexterm role="concept">
51280 <primary>callout</primary>
51281 <secondary>full postmaster check</secondary>
51283 This operates like the <option>postmaster</option> option (see below), but if the check for
51284 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
51285 accordance with the specification in RFC 2821. The RFC states that the
51286 unqualified address <emphasis>postmaster</emphasis> should be accepted.
51288 </listitem></varlistentry>
51290 <term><emphasis role="bold">mailfrom = </emphasis><<emphasis>email address</emphasis>></term>
51293 <indexterm role="concept">
51294 <primary>callout</primary>
51295 <secondary>sender when verifying header</secondary>
51297 When verifying addresses in header lines using the <option>header_sender</option>
51298 verification option, Exim behaves by default as if the addresses are envelope
51299 sender addresses from a message. Callout verification therefore tests to see
51300 whether a bounce message could be delivered, by using an empty address in the
51301 MAIL command. However, it is arguable that these addresses might never be used
51302 as envelope senders, and could therefore justifiably reject bounce messages
51303 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
51304 address to use in the MAIL command. For example:
51306 <literallayout class="monospaced">
51307 require verify = header_sender/callout=mailfrom=abcd@x.y.z
51310 This parameter is available only for the <option>header_sender</option> verification option.
51312 </listitem></varlistentry>
51314 <term><emphasis role="bold">maxwait = </emphasis><<emphasis>time interval</emphasis>></term>
51317 <indexterm role="concept">
51318 <primary>callout</primary>
51319 <secondary>overall timeout, specifying</secondary>
51321 This parameter sets an overall timeout for performing a callout verification.
51324 <literallayout class="monospaced">
51325 verify = sender/callout=5s,maxwait=30s
51328 This timeout defaults to four times the callout timeout for individual SMTP
51329 commands. The overall timeout applies when there is more than one host that can
51330 be tried. The timeout is checked before trying the next host. This prevents
51331 very long delays if there are a large number of hosts and all are timing out
51332 (for example, when network connections are timing out).
51334 </listitem></varlistentry>
51336 <term><emphasis role="bold">no_cache</emphasis></term>
51339 <indexterm role="concept">
51340 <primary>callout</primary>
51341 <secondary>cache, suppressing</secondary>
51343 <indexterm role="concept">
51344 <primary>caching callout, suppressing</primary>
51346 When this parameter is given, the callout cache is neither read nor updated.
51348 </listitem></varlistentry>
51350 <term><emphasis role="bold">postmaster</emphasis></term>
51353 <indexterm role="concept">
51354 <primary>callout</primary>
51355 <secondary>postmaster; checking</secondary>
51357 When this parameter is set, a successful callout check is followed by a similar
51358 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
51359 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
51360 the postmaster check is recorded in a cache record; if it is a failure, this is
51361 used to fail subsequent callouts for the domain without a connection being
51362 made, until the cache record expires.
51364 </listitem></varlistentry>
51366 <term><emphasis role="bold">postmaster_mailfrom = </emphasis><<emphasis>email address</emphasis>></term>
51369 The postmaster check uses an empty sender in the MAIL command by default.
51370 You can use this parameter to do a postmaster check using a different address.
51373 <literallayout class="monospaced">
51374 require verify = sender/callout=postmaster_mailfrom=abc@x.y.z
51377 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
51378 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
51380 <literallayout class="monospaced">
51381 require verify = sender/callout=postmaster_mailfrom=
51384 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
51385 account of the sender address. It is assumed that either the empty address or
51386 a fixed non-empty address will be used. All that Exim remembers is that the
51387 postmaster check for the domain succeeded or failed.
51389 </listitem></varlistentry>
51391 <term><emphasis role="bold">random</emphasis></term>
51394 <indexterm role="concept">
51395 <primary>callout</primary>
51396 <secondary><quote>random</quote> check</secondary>
51398 When this parameter is set, before doing the normal callout check, Exim does a
51399 check for a <quote>random</quote> local part at the same domain. The local part is not
51400 really random – it is defined by the expansion of the option
51401 <option>callout_random_local_part</option>, which defaults to
51403 <literallayout class="monospaced">
51404 $primary_host_name-$tod_epoch-testing
51407 The idea here is to try to determine whether the remote host accepts all local
51408 parts without checking. If it does, there is no point in doing callouts for
51409 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
51410 a cache record, and used to force the current and subsequent callout checks to
51411 succeed without a connection being made, until the cache record expires.
51413 </listitem></varlistentry>
51415 <term><emphasis role="bold">use_postmaster</emphasis></term>
51418 <indexterm role="concept">
51419 <primary>callout</primary>
51420 <secondary>sender for recipient check</secondary>
51422 This parameter applies to recipient callouts only. For example:
51424 <literallayout class="monospaced">
51425 deny !verify = recipient/callout=use_postmaster
51428 <indexterm role="variable">
51429 <primary><varname>$qualify_domain</varname></primary>
51431 It causes a non-empty postmaster address to be used in the MAIL command when
51432 performing the callout for the recipient, and also for a <quote>random</quote> check if
51433 that is configured. The local part of the address is <literal>postmaster</literal> and the
51434 domain is the contents of <varname>$qualify_domain</varname>.
51436 </listitem></varlistentry>
51438 <term><emphasis role="bold">use_sender</emphasis></term>
51441 This option applies to recipient callouts only. For example:
51443 <literallayout class="monospaced">
51444 require verify = recipient/callout=use_sender
51447 It causes the message’s actual sender address to be used in the MAIL
51448 command when performing the callout, instead of an empty address. There is no
51449 need to use this option unless you know that the called hosts make use of the
51450 sender when checking recipients. If used indiscriminately, it reduces the
51451 usefulness of callout caching.
51453 </listitem></varlistentry>
51456 If you use any of the parameters that set a non-empty sender for the MAIL
51457 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
51458 <option>use_sender</option>), you should think about possible loops. Recipient checking is
51459 usually done between two hosts that are under the same management, and the host
51460 that receives the callouts is not normally configured to do callouts itself.
51461 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
51462 these circumstances.
51465 However, if you use a non-empty sender address for a callout to an arbitrary
51466 host, there is the likelihood that the remote host will itself initiate a
51467 callout check back to your host. As it is checking what appears to be a message
51468 sender, it is likely to use an empty address in MAIL, thus avoiding a
51469 callout loop. However, to be on the safe side it would be best to set up your
51470 own ACLs so that they do not do sender verification checks when the recipient
51471 is the address you use for header sender or postmaster callout checking.
51474 Another issue to think about when using non-empty senders for callouts is
51475 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
51476 by the sender/recipient combination; thus, for any given recipient, many more
51477 actual callouts are performed than when an empty sender or postmaster is used.
51480 <section id="SECTcallvercache">
51481 <title>Callout caching</title>
51483 <indexterm role="concept">
51484 <primary>hints database</primary>
51485 <secondary>callout cache</secondary>
51487 <indexterm role="concept">
51488 <primary>callout</primary>
51489 <secondary>cache, description of</secondary>
51491 <indexterm role="concept">
51492 <primary>caching</primary>
51493 <secondary>callout</secondary>
51495 Exim caches the results of callouts in order to reduce the amount of resources
51496 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
51497 option. A hints database called <quote>callout</quote> is used for the cache. Two
51498 different record types are used: one records the result of a callout check for
51499 a specific address, and the other records information that applies to the
51500 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
51503 When an original callout fails, a detailed SMTP error message is given about
51504 the failure. However, for subsequent failures use the cache data, this message
51508 The expiry times for negative and positive address cache records are
51509 independent, and can be set by the global options <option>callout_negative_expire</option>
51510 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
51513 If a host gives a negative response to an SMTP connection, or rejects any
51514 commands up to and including
51516 <literallayout class="monospaced">
51520 (but not including the MAIL command with a non-empty address),
51521 any callout attempt is bound to fail. Exim remembers such failures in a
51522 domain cache record, which it uses to fail callouts for the domain without
51523 making new connections, until the domain record times out. There are two
51524 separate expiry times for domain cache records:
51525 <option>callout_domain_negative_expire</option> (default 3h) and
51526 <option>callout_domain_positive_expire</option> (default 7d).
51529 Domain records expire when the negative expiry time is reached if callouts
51530 cannot be made for the domain, or if the postmaster check failed.
51531 Otherwise, they expire when the positive expiry time is reached. This
51532 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
51533 will eventually be noticed.
51536 The callout caching mechanism is based on the domain of the address that is
51537 being tested. If the domain routes to several hosts, it is assumed that their
51538 behaviour will be the same.
51541 <section id="SECTsenaddver">
51542 <title>Sender address verification reporting</title>
51544 <indexterm role="concept">
51545 <primary>verifying</primary>
51546 <secondary>suppressing error details</secondary>
51548 See section <xref linkend="SECTaddressverification"/> for a general discussion of
51549 verification. When sender verification fails in an ACL, the details of the
51550 failure are given as additional output lines before the 550 response to the
51551 relevant SMTP command (RCPT or DATA). For example, if sender callout is in use,
51554 <literallayout class="monospaced">
51555 MAIL FROM:<xyz@abc.example>
51557 RCPT TO:<pqr@def.example>
51558 550-Verification failed for <xyz@abc.example>
51559 550-Called: 192.168.34.43
51560 550-Sent: RCPT TO:<xyz@abc.example>
51561 550-Response: 550 Unknown local part xyz in <xyz@abc.example>
51562 550 Sender verification failed
51565 If more than one RCPT command fails in the same way, the details are given
51566 only for the first of them. However, some administrators do not want to send
51567 out this much information. You can suppress the details by adding
51568 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
51571 <literallayout class="monospaced">
51572 verify = sender/no_details
51575 <section id="SECTredirwhilveri">
51576 <title>Redirection while verifying</title>
51578 <indexterm role="concept">
51579 <primary>verifying</primary>
51580 <secondary>redirection while</secondary>
51582 <indexterm role="concept">
51583 <primary>address redirection</primary>
51584 <secondary>while verifying</secondary>
51586 A dilemma arises when a local address is redirected by aliasing or forwarding
51587 during verification: should the generated addresses themselves be verified,
51588 or should the successful expansion of the original address be enough to verify
51589 it? By default, Exim takes the following pragmatic approach:
51594 When an incoming address is redirected to just one child address, verification
51595 continues with the child address, and if that fails to verify, the original
51596 verification also fails.
51601 When an incoming address is redirected to more than one child address,
51602 verification does not continue. A success result is returned.
51607 This seems the most reasonable behaviour for the common use of aliasing as a
51608 way of redirecting different local parts to the same mailbox. It means, for
51609 example, that a pair of alias entries of the form
51611 <literallayout class="monospaced">
51613 aw123: :fail: Gone away, no forwarding address
51616 work as expected, with both local parts causing verification failure. When a
51617 redirection generates more than one address, the behaviour is more like a
51618 mailing list, where the existence of the alias itself is sufficient for
51619 verification to succeed.
51622 It is possible, however, to change the default behaviour so that all successful
51623 redirections count as successful verifications, however many new addresses are
51624 generated. This is specified by the <option>success_on_redirect</option> verification
51625 option. For example:
51627 <literallayout class="monospaced">
51628 require verify = recipient/success_on_redirect/callout=10s
51631 In this example, verification succeeds if a router generates a new address, and
51632 the callout does not occur, because no address was routed to a remote host.
51635 When verification is being tested via the <option>-bv</option> option, the treatment of
51636 redirections is as just described, unless the <option>-v</option> or any debugging option is
51637 also specified. In that case, full verification is done for every generated
51638 address and a report is output for each of them.
51641 <section id="SECTverifyCSA">
51642 <title>Client SMTP authorization (CSA)</title>
51644 <indexterm role="concept">
51645 <primary>CSA</primary>
51646 <secondary>verifying</secondary>
51648 Client SMTP Authorization is a system that allows a site to advertise
51649 which machines are and are not permitted to send email. This is done by placing
51650 special SRV records in the DNS; these are looked up using the client’s HELO
51651 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
51652 Authorization checks in Exim are performed by the ACL condition:
51654 <literallayout class="monospaced">
51658 This fails if the client is not authorized. If there is a DNS problem, or if no
51659 valid CSA SRV record is found, or if the client is authorized, the condition
51660 succeeds. These three cases can be distinguished using the expansion variable
51661 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
51662 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
51663 be likely to cause problems for legitimate email.
51666 The error messages produced by the CSA code include slightly more
51667 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
51668 looking up the CSA SRV record, or problems looking up the CSA target
51669 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
51674 The client’s host name is explicitly not authorized.
51679 The client’s IP address does not match any of the CSA target IP addresses.
51684 The client’s host name is authorized but it has no valid target IP addresses
51685 (for example, the target’s addresses are IPv6 and the client is using IPv4).
51690 The client’s host name has no CSA SRV record but a parent domain has asserted
51691 that all subdomains must be explicitly authorized.
51696 The <option>csa</option> verification condition can take an argument which is the domain to
51697 use for the DNS query. The default is:
51699 <literallayout class="monospaced">
51700 verify = csa/$sender_helo_name
51703 This implementation includes an extension to CSA. If the query domain
51704 is an address literal such as [192.0.2.95], or if it is a bare IP
51705 address, Exim searches for CSA SRV records in the reverse DNS as if
51706 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
51709 <literallayout class="monospaced">
51710 verify = csa/$sender_host_address
51713 In fact, this is the check that Exim performs if the client does not say HELO.
51714 This extension can be turned off by setting the main configuration option
51715 <option>dns_csa_use_reverse</option> to be false.
51718 If a CSA SRV record is not found for the domain itself, a search
51719 is performed through its parent domains for a record which might be
51720 making assertions about subdomains. The maximum depth of this search is limited
51721 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
51722 default. Exim does not look for CSA SRV records in a top level domain, so the
51723 default settings handle HELO domains as long as seven
51724 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
51725 of legitimate HELO domains.
51728 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
51729 direct SRV lookups, this is not sufficient because of the extra parent domain
51730 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
51731 addresses into lookups in the reverse DNS space. The result of a successful
51734 <literallayout class="monospaced">
51735 ${lookup dnsdb {csa=$sender_helo_name}}
51738 has two space-separated fields: an authorization code and a target host name.
51739 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
51740 authorization required but absent, or <quote>?</quote> for unknown.
51743 <section id="SECTverifyPRVS">
51744 <title>Bounce address tag validation</title>
51746 <indexterm role="concept">
51747 <primary>BATV, verifying</primary>
51749 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
51750 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
51751 Genuine incoming bounce messages should therefore always be addressed to
51752 recipients that have a valid tag. This scheme is a way of detecting unwanted
51753 bounce messages caused by sender address forgeries (often called <quote>collateral
51754 spam</quote>), because the recipients of such messages do not include valid tags.
51757 There are two expansion items to help with the implementation of the BATV
51758 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
51759 the original envelope sender address by using a simple key to add a hash of the
51760 address and some time-based randomizing information. The <option>prvs</option> expansion
51761 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
51762 The syntax of these expansion items is described in section
51763 <xref linkend="SECTexpansionitems"/>.
51766 As an example, suppose the secret per-address keys are stored in an MySQL
51767 database. A query to look up the key for an address could be defined as a macro
51770 <literallayout class="monospaced">
51771 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
51772 WHERE sender='${quote_mysql:$prvscheck_address}'\
51776 Suppose also that the senders who make use of BATV are defined by an address
51777 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
51780 <literallayout class="monospaced">
51781 # Bounces: drop unsigned addresses for BATV senders
51782 deny message = This address does not send an unsigned reverse path
51784 recipients = +batv_senders
51786 # Bounces: In case of prvs-signed address, check signature.
51787 deny message = Invalid reverse path signature.
51789 condition = ${prvscheck {$local_part@$domain}\
51790 {PRVSCHECK_SQL}{1}}
51791 !condition = $prvscheck_result
51794 The first statement rejects recipients for bounce messages that are addressed
51795 to plain BATV sender addresses, because it is known that BATV senders do not
51796 send out messages with plain sender addresses. The second statement rejects
51797 recipients that are prvs-signed, but with invalid signatures (either because
51798 the key is wrong, or the signature has timed out).
51801 A non-prvs-signed address is not rejected by the second statement, because the
51802 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
51803 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
51804 the first argument is a syntactically valid prvs-signed address, the yield is
51805 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
51806 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
51807 of the checks (empty for failure, <quote>1</quote> for success).
51809 <para revisionflag="changed">
51810 There is one more issue you must consider when implementing prvs-signing:
51811 you have to ensure that the routers accept prvs-signed addresses and
51812 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
51813 router to remove the signature with a configuration along these lines:
51815 <literallayout class="monospaced">
51818 data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
51821 This works because, if the third argument of <option>prvscheck</option> is empty, the result
51822 of the expansion of a prvs-signed address is the decoded value of the original
51823 address. This router should probably be the first of your routers that handles
51827 To create BATV-signed addresses in the first place, a transport of this form
51830 <literallayout class="monospaced">
51831 external_smtp_batv:
51833 return_path = ${prvs {$return_path} \
51834 {${lookup mysql{SELECT \
51835 secret FROM batv_prvs WHERE \
51836 sender='${quote_mysql:$sender_address}'} \
51840 If no key can be found for the existing return path, no signing takes place.
51843 <section id="SECTrelaycontrol">
51844 <title>Using an ACL to control relaying</title>
51846 <indexterm role="concept">
51847 <primary>access control lists (ACLs)</primary>
51848 <secondary>relay control</secondary>
51850 <indexterm role="concept">
51851 <primary>relaying</primary>
51852 <secondary>control by ACL</secondary>
51854 <indexterm role="concept">
51855 <primary>policy control</primary>
51856 <secondary>relay control</secondary>
51858 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
51859 delivers it directly to another host as a result of a remote address contained
51860 within it. Redirecting a local address via an alias or forward file and then
51861 passing the message on to another host is not relaying,
51862 <indexterm role="concept">
51863 <primary><quote>percent hack</quote></primary>
51865 but a redirection as a result of the <quote>percent hack</quote> is.
51868 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
51869 A host which is acting as a gateway or an MX backup is concerned with incoming
51870 relaying from arbitrary hosts to a specific set of domains. On the other hand,
51871 a host which is acting as a smart host for a number of clients is concerned
51872 with outgoing relaying from those clients to the Internet at large. Often the
51873 same host is fulfilling both functions,
51874 but in principle these two kinds of relaying are entirely independent. What is
51875 not wanted is the transmission of mail from arbitrary remote hosts through your
51876 system to arbitrary domains.
51879 You can implement relay control by means of suitable statements in the ACL that
51880 runs for each RCPT command. For convenience, it is often easiest to use
51881 Exim’s named list facility to define the domains and hosts involved. For
51882 example, suppose you want to do the following:
51887 Deliver a number of domains to mailboxes on the local host (or process them
51888 locally in some other way). Let’s say these are <emphasis>my.dom1.example</emphasis> and
51889 <emphasis>my.dom2.example</emphasis>.
51894 Relay mail for a number of other domains for which you are the secondary MX.
51895 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
51900 Relay mail from the hosts on your local LAN, to whatever domains are involved.
51901 Suppose your LAN is 192.168.45.0/24.
51906 In the main part of the configuration, you put the following definitions:
51908 <literallayout class="monospaced">
51909 domainlist local_domains = my.dom1.example : my.dom2.example
51910 domainlist relay_domains = friend1.example : friend2.example
51911 hostlist relay_hosts = 192.168.45.0/24
51914 Now you can use these definitions in the ACL that is run for every RCPT
51917 <literallayout class="monospaced">
51919 accept domains = +local_domains : +relay_domains
51920 accept hosts = +relay_hosts
51923 The first statement accepts any RCPT command that contains an address in
51924 the local or relay domains. For any other domain, control passes to the second
51925 statement, which accepts the command only if it comes from one of the relay
51926 hosts. In practice, you will probably want to make your ACL more sophisticated
51927 than this, for example, by including sender and recipient verification. The
51928 default configuration includes a more comprehensive example, which is described
51929 in chapter <xref linkend="CHAPdefconfil"/>.
51932 <section id="SECTcheralcon">
51933 <title>Checking a relay configuration</title>
51935 <indexterm role="concept">
51936 <primary>relaying</primary>
51937 <secondary>checking control of</secondary>
51939 You can check the relay characteristics of your configuration in the same way
51940 that you can test any ACL behaviour for an incoming SMTP connection, by using
51941 the <option>-bh</option> option to run a fake SMTP session with which you interact.
51944 For specifically testing for unwanted relaying, the host
51945 <emphasis>relay-test.mail-abuse.org</emphasis> provides a useful service. If you telnet to this
51946 host from the host on which Exim is running, using the normal telnet port, you
51947 will see a normal telnet connection message and then quite a long delay. Be
51948 patient. The remote host is making an SMTP connection back to your host, and
51949 trying a number of common probes to test for open relay vulnerability. The
51950 results of the tests will eventually appear on your terminal.
51951 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
51956 <chapter id="CHAPexiscan">
51957 <title>Content scanning at ACL time</title>
51959 <indexterm role="concept" id="IIDcosca" class="startofrange">
51960 <primary>content scanning</primary>
51961 <secondary>at ACL time</secondary>
51963 The extension of Exim to include content scanning at ACL time, formerly known
51964 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
51965 was integrated into the main source for Exim release 4.50, and Tom continues to
51966 maintain it. Most of the wording of this chapter is taken from Tom’s
51970 It is also possible to scan the content of messages at other times. The
51971 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
51972 scanning after all the ACLs have run. A transport filter can be used to scan
51973 messages at delivery time (see the <option>transport_filter</option> option, described in
51974 chapter <xref linkend="CHAPtransportgeneric"/>).
51977 If you want to include the ACL-time content-scanning features when you compile
51978 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
51979 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
51984 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
51985 for all MIME parts for SMTP and non-SMTP messages, respectively.
51990 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
51991 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
51992 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
51997 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
51998 of messages, or parts of messages, for debugging purposes.
52003 Additional expansion variables that are set in the new ACL and by the new
52009 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
52014 There is another content-scanning configuration option for <filename>Local/Makefile</filename>,
52015 called WITH_OLD_DEMIME. If this is set, the old, deprecated <option>demime</option> ACL
52016 condition is compiled, in addition to all the other content-scanning features.
52019 Content-scanning is continually evolving, and new features are still being
52020 added. While such features are still unstable and liable to incompatible
52021 changes, they are made available in Exim by setting options whose names begin
52022 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
52023 this manual. You can find out about them by reading the file called
52024 <filename>doc/experimental.txt</filename>.
52027 All the content-scanning facilities work on a MBOX copy of the message that is
52028 temporarily created in a file called:
52031 <<emphasis>spool_directory</emphasis>><literal>/scan/</literal><<emphasis>message_id</emphasis>>/<<emphasis>message_id</emphasis>><literal>.eml</literal>
52034 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
52035 expect an MBOX-like structure inside that file. The file is created when the
52036 first content scanning facility is called. Subsequent calls to content
52037 scanning conditions open the same file again. The directory is recursively
52038 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
52040 <literallayout class="monospaced">
52041 control = no_mbox_unspool
52044 has been encountered. When the MIME ACL decodes files, they are put into the
52045 same directory by default.
52047 <section id="SECTscanvirus">
52048 <title>Scanning for viruses</title>
52050 <indexterm role="concept">
52051 <primary>virus scanning</primary>
52053 <indexterm role="concept">
52054 <primary>content scanning</primary>
52055 <secondary>for viruses</secondary>
52057 <indexterm role="concept">
52058 <primary>content scanning</primary>
52059 <secondary>the <option>malware</option> condition</secondary>
52061 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
52062 It supports a <quote>generic</quote> interface to scanners called via the shell, and
52063 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
52064 in memory and thus are much faster.
52067 <indexterm role="option">
52068 <primary><option>av_scanner</option></primary>
52070 You can set the <option>av_scanner</option> option in first part of the Exim configuration
52071 file to specify which scanner to use, together with any additional options that
52072 are needed. The basic syntax is as follows:
52075 <literal>av_scanner = <</literal><emphasis>scanner-type</emphasis><literal>>:<</literal><emphasis>option1</emphasis><literal>>:<</literal><emphasis>option2</emphasis><literal>>:[...]</literal>
52078 If you do not set <option>av_scanner</option>, it defaults to
52080 <literallayout class="monospaced">
52081 av_scanner = sophie:/var/run/sophie
52084 If the value of <option>av_scanner</option> starts with dollar character, it is expanded
52085 before use. The following scanner types are supported in this release:
52089 <term><option>aveserver</option></term>
52092 <indexterm role="concept">
52093 <primary>virus scanners</primary>
52094 <secondary>Kaspersky</secondary>
52096 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
52097 at <emphasis role="bold"><ulink url="http://www.kaspersky.com">http://www.kaspersky.com</ulink></emphasis>. This scanner type takes one option,
52098 which is the path to the daemon’s UNIX socket. The default is shown in this
52101 <literallayout class="monospaced">
52102 av_scanner = aveserver:/var/run/aveserver
52104 </listitem></varlistentry>
52106 <term><option>clamd</option></term>
52109 <indexterm role="concept">
52110 <primary>virus scanners</primary>
52111 <secondary>clamd</secondary>
52113 This daemon-type scanner is GPL and free. You can get it at
52114 <emphasis role="bold"><ulink url="http://www.clamav.net/">http://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
52115 unpack MIME containers, so it used to be recommended to unpack MIME attachments
52116 in the MIME ACL. This no longer believed to be necessary. One option is
52117 required: either the path and name of a UNIX socket file, or a hostname or IP
52118 number, and a port, separated by space, as in the second of these examples:
52120 <literallayout class="monospaced">
52121 av_scanner = clamd:/opt/clamd/socket
52122 av_scanner = clamd:192.168.2.100 1234
52125 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
52126 contributing the code for this scanner.
52128 </listitem></varlistentry>
52130 <term><option>cmdline</option></term>
52133 <indexterm role="concept">
52134 <primary>virus scanners</primary>
52135 <secondary>command line interface</secondary>
52137 This is the keyword for the generic command line scanner interface. It can be
52138 used to attach virus scanners that are invoked from the shell. This scanner
52139 type takes 3 mandatory options:
52141 <orderedlist numeration="arabic">
52144 The full path and name of the scanner binary, with all command line options,
52145 and a placeholder (<literal>%s</literal>) for the directory to scan.
52150 A regular expression to match against the STDOUT and STDERR output of the
52151 virus scanner. If the expression matches, a virus was found. You must make
52152 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
52153 the <quote>trigger</quote> expression.
52158 Another regular expression, containing exactly one pair of parentheses, to
52159 match the name of the virus found in the scanners output. This is called the
52160 <quote>name</quote> expression.
52165 For example, Sophos Sweep reports a virus on a line like this:
52167 <literallayout class="monospaced">
52168 Virus 'W32/Magistr-B' found in file ./those.bat
52171 For the trigger expression, we can match the phrase <quote>found in file</quote>. For the
52172 name expression, we want to extract the W32/Magistr-B string, so we can match
52173 for the single quotes left and right of it. Altogether, this makes the
52174 configuration setting:
52176 <literallayout class="monospaced">
52177 av_scanner = cmdline:\
52178 /path/to/sweep -ss -all -rec -archive %s:\
52179 found in file:'(.+)'
52181 </listitem></varlistentry>
52183 <term><option>drweb</option></term>
52186 <indexterm role="concept">
52187 <primary>virus scanners</primary>
52188 <secondary>DrWeb</secondary>
52190 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="http://www.sald.com/">http://www.sald.com/</ulink></emphasis>) interface takes one
52191 argument, either a full path to a UNIX socket, or an IP address and port
52192 separated by white space, as in these examples:
52194 <literallayout class="monospaced">
52195 av_scanner = drweb:/var/run/drwebd.sock
52196 av_scanner = drweb:192.168.2.20 31337
52199 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
52200 is used. Thanks to Alex Miller for contributing the code for this scanner.
52202 </listitem></varlistentry>
52204 <term><option>fsecure</option></term>
52207 <indexterm role="concept">
52208 <primary>virus scanners</primary>
52209 <secondary>F-Secure</secondary>
52211 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="http://www.f-secure.com">http://www.f-secure.com</ulink></emphasis>) takes one
52212 argument which is the path to a UNIX socket. For example:
52214 <literallayout class="monospaced">
52215 av_scanner = fsecure:/path/to/.fsav
52218 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
52219 Thelmen for contributing the code for this scanner.
52221 </listitem></varlistentry>
52223 <term><option>kavdaemon</option></term>
52226 <indexterm role="concept">
52227 <primary>virus scanners</primary>
52228 <secondary>Kaspersky</secondary>
52230 This is the scanner daemon of Kaspersky Version 4. This version of the
52231 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
52232 scanner type takes one option, which is the path to the daemon’s UNIX socket.
52235 <literallayout class="monospaced">
52236 av_scanner = kavdaemon:/opt/AVP/AvpCtl
52239 The default path is <filename>/var/run/AvpCtl</filename>.
52241 </listitem></varlistentry>
52243 <term><option>mksd</option></term>
52246 <indexterm role="concept">
52247 <primary>virus scanners</primary>
52248 <secondary>mksd</secondary>
52250 This is a daemon type scanner that is aimed mainly at Polish users, though some
52251 parts of documentation are now available in English. You can get it at
52252 <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
52253 the maximum number of processes used simultaneously to scan the attachments,
52254 provided that the demime facility is employed and also provided that mksd has
52255 been run with at least the same number of child processes. For example:
52257 <literallayout class="monospaced">
52258 av_scanner = mksd:2
52261 You can safely omit this option (the default value is 1).
52263 </listitem></varlistentry>
52265 <term><option>sophie</option></term>
52268 <indexterm role="concept">
52269 <primary>virus scanners</primary>
52270 <secondary>Sophos and Sophie</secondary>
52272 Sophie is a daemon that uses Sophos’ <option>libsavi</option> library to scan for viruses.
52273 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
52274 for this scanner type is the path to the UNIX socket that Sophie uses for
52275 client communication. For example:
52277 <literallayout class="monospaced">
52278 av_scanner = sophie:/tmp/sophie
52281 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
52284 </listitem></varlistentry>
52287 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
52288 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
52292 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
52293 makes it possible to use different scanners. See further below for an example.
52294 The <option>malware</option> condition caches its results, so when you use it multiple times
52295 for the same message, the actual scanning process is only carried out once.
52296 However, using expandable items in <option>av_scanner</option> disables this caching, in
52297 which case each use of the <option>malware</option> condition causes a new scan of the
52301 The <option>malware</option> condition takes a right-hand argument that is expanded before
52302 use. It can then be one of
52307 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
52308 The condition succeeds if a virus was found, and fail otherwise. This is the
52314 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
52315 the condition fails immediately.
52320 A regular expression, in which case the message is scanned for viruses. The
52321 condition succeeds if a virus is found and its name matches the regular
52322 expression. This allows you to take special actions on certain types of virus.
52327 You can append <literal>/defer_ok</literal> to the <option>malware</option> condition to accept messages
52328 even if there is a problem with the virus scanner. Otherwise, such a problem
52329 causes the ACL to defer.
52332 <indexterm role="variable">
52333 <primary><varname>$malware_name</varname></primary>
52335 When a virus is found, the condition sets up an expansion variable called
52336 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
52337 <option>message</option> modifier that specifies the error returned to the sender, and/or in
52341 If your virus scanner cannot unpack MIME and TNEF containers itself, you should
52342 use the <option>demime</option> condition (see section <xref linkend="SECTdemimecond"/>) before the
52343 <option>malware</option> condition.
52346 Here is a very simple scanning example:
52348 <literallayout class="monospaced">
52349 deny message = This message contains malware ($malware_name)
52354 The next example accepts messages when there is a problem with the scanner:
52356 <literallayout class="monospaced">
52357 deny message = This message contains malware ($malware_name)
52359 malware = */defer_ok
52362 The next example shows how to use an ACL variable to scan with both sophie and
52363 aveserver. It assumes you have set:
52365 <literallayout class="monospaced">
52366 av_scanner = $acl_m0
52369 in the main Exim configuration.
52371 <literallayout class="monospaced">
52372 deny message = This message contains malware ($malware_name)
52373 set acl_m0 = sophie
52376 deny message = This message contains malware ($malware_name)
52377 set acl_m0 = aveserver
52381 <section id="SECTscanspamass">
52382 <title>Scanning with SpamAssassin</title>
52384 <indexterm role="concept">
52385 <primary>content scanning</primary>
52386 <secondary>for spam</secondary>
52388 <indexterm role="concept">
52389 <primary>spam scanning</primary>
52391 <indexterm role="concept">
52392 <primary>SpamAssassin</primary>
52394 The <option>spam</option> ACL condition calls SpamAssassin’s <option>spamd</option> daemon to get a spam
52395 score and a report for the message. You can get SpamAssassin at
52396 <emphasis role="bold"><ulink url="http://www.spamassassin.org">http://www.spamassassin.org</ulink></emphasis>, or, if you have a working Perl
52397 installation, you can use CPAN by running:
52399 <literallayout class="monospaced">
52400 perl -MCPAN -e 'install Mail::SpamAssassin'
52403 SpamAssassin has its own set of configuration files. Please review its
52404 documentation to see how you can tweak it. The default installation should work
52408 <indexterm role="option">
52409 <primary><option>spamd_address</option></primary>
52411 After having installed and configured SpamAssassin, start the <option>spamd</option> daemon.
52412 By default, it listens on 127.0.0.1, TCP port 783. If you use another host or
52413 port for <option>spamd</option>, you must set the <option>spamd_address</option> option in the global
52414 part of the Exim configuration as follows (example):
52416 <literallayout class="monospaced">
52417 spamd_address = 192.168.99.45 387
52420 You do not need to set this option if you use the default. As of version 2.60,
52421 <option>spamd</option> also supports communication over UNIX sockets. If you want to use
52422 these, supply <option>spamd_address</option> with an absolute file name instead of a
52425 <literallayout class="monospaced">
52426 spamd_address = /var/run/spamd_socket
52429 You can have multiple <option>spamd</option> servers to improve scalability. These can
52430 reside on other hardware reachable over the network. To specify multiple
52431 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
52432 option, separated with colons:
52434 <literallayout class="monospaced">
52435 spamd_address = 192.168.2.10 783 : \
52436 192.168.2.11 783 : \
52440 Up to 32 <option>spamd</option> servers are supported. The servers are queried in a random
52441 fashion. When a server fails to respond to the connection attempt, all other
52442 servers are tried until one succeeds. If no server responds, the <option>spam</option>
52446 <emphasis role="bold">Warning</emphasis>: It is not possible to use the UNIX socket connection method with
52447 multiple <option>spamd</option> servers.
52450 The <option>spamd_address</option> variable is expanded before use if it starts with
52451 a dollar sign. In this case, the expansion may return a string that is
52452 used as the list so that multiple spamd servers can be the result of an
52456 <section id="SECID206">
52457 <title>Calling SpamAssassin from an Exim ACL</title>
52459 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
52461 <literallayout class="monospaced">
52462 deny message = This message was classified as SPAM
52466 The right-hand side of the <option>spam</option> condition specifies a name. This is
52467 relevant if you have set up multiple SpamAssassin profiles. If you do not want
52468 to scan using a specific profile, but rather use the SpamAssassin system-wide
52469 default profile, you can scan for an unknown name, or simply use <quote>nobody</quote>.
52470 However, you must put something on the right-hand side.
52473 The name allows you to use per-domain or per-user antispam profiles in
52474 principle, but this is not straightforward in practice, because a message may
52475 have multiple recipients, not necessarily all in the same domain. Because the
52476 <option>spam</option> condition has to be called from a DATA ACL in order to be able to
52477 read the contents of the message, the variables <varname>$local_part</varname> and <varname>$domain</varname>
52481 The right-hand side of the <option>spam</option> condition is expanded before being used, so
52482 you can put lookups or conditions there. When the right-hand side evaluates to
52483 <quote>0</quote> or <quote>false</quote>, no scanning is done and the condition fails immediately.
52486 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
52487 large ones may cause significant performance degradation. As most spam messages
52488 are quite small, it is recommended that you do not scan the big ones. For
52491 <literallayout class="monospaced">
52492 deny message = This message was classified as SPAM
52493 condition = ${if < {$message_size}{10K}}
52497 The <option>spam</option> condition returns true if the threshold specified in the user’s
52498 SpamAssassin profile has been matched or exceeded. If you want to use the
52499 <option>spam</option> condition for its side effects (see the variables below), you can make
52500 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
52503 <indexterm role="concept">
52504 <primary>spam scanning</primary>
52505 <secondary>returned variables</secondary>
52507 When the <option>spam</option> condition is run, it sets up a number of expansion
52508 variables. With the exception of <varname>$spam_score_int</varname>, these are usable only
52509 within ACLs; their values are not retained with the message and so cannot be
52510 used at delivery time.
52514 <term><varname>$spam_score</varname></term>
52517 The spam score of the message, for example <quote>3.4</quote> or <quote>30.5</quote>. This is useful
52518 for inclusion in log or reject messages.
52520 </listitem></varlistentry>
52522 <term><varname>$spam_score_int</varname></term>
52525 The spam score of the message, multiplied by ten, as an integer value. For
52526 example <quote>34</quote> or <quote>305</quote>. It may appear to disagree with <varname>$spam_score</varname>
52527 because <varname>$spam_score</varname> is rounded and <varname>$spam_score_int</varname> is truncated.
52528 The integer value is useful for numeric comparisons in
52529 conditions. This variable is special; its value is saved with the message, and
52530 written to Exim’s spool file. This means that it can be used during the whole
52531 life of the message on your Exim system, in particular, in routers or
52532 transports during the later delivery phase.
52534 </listitem></varlistentry>
52536 <term><varname>$spam_bar</varname></term>
52539 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
52540 integer part of the spam score value. A spam score of 4.4 would have a
52541 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
52542 headers, since MUAs can match on such strings.
52544 </listitem></varlistentry>
52546 <term><varname>$spam_report</varname></term>
52549 A multiline text table, containing the full SpamAssassin report for the
52550 message. Useful for inclusion in headers or reject messages.
52552 </listitem></varlistentry>
52555 The <option>spam</option> condition caches its results unless expansion in
52556 spamd_address was used. If you call it again with the same user name, it
52557 does not scan again, but rather returns the same values as before.
52560 The <option>spam</option> condition returns DEFER if there is any error while running
52561 the message through SpamAssassin or if the expansion of spamd_address
52562 failed. If you want to treat DEFER as FAIL (to pass on to the next ACL
52563 statement block), append <literal>/defer_ok</literal> to the right-hand side of the
52564 spam condition, like this:
52566 <literallayout class="monospaced">
52567 deny message = This message was classified as SPAM
52568 spam = joe/defer_ok
52571 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
52574 Here is a longer, commented example of the use of the <option>spam</option>
52577 <literallayout class="monospaced">
52578 # put headers in all messages (no matter if spam or not)
52579 warn spam = nobody:true
52580 add_header = X-Spam-Score: $spam_score ($spam_bar)
52581 add_header = X-Spam-Report: $spam_report
52583 # add second subject line with *SPAM* marker when message
52584 # is over threshold
52586 add_header = Subject: *SPAM* $h_Subject:
52588 # reject spam at high scores (> 12)
52589 deny message = This message scored $spam_score spam points.
52591 condition = ${if >{$spam_score_int}{120}{1}{0}}
52594 <section id="SECTscanmimepart">
52595 <title>Scanning MIME parts</title>
52597 <indexterm role="concept">
52598 <primary>content scanning</primary>
52599 <secondary>MIME parts</secondary>
52601 <indexterm role="concept">
52602 <primary>MIME content scanning</primary>
52604 <indexterm role="option">
52605 <primary><option>acl_smtp_mime</option></primary>
52607 <indexterm role="option">
52608 <primary><option>acl_not_smtp_mime</option></primary>
52610 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
52611 each MIME part of an SMTP message, including multipart types, in the sequence
52612 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
52613 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
52614 options may both refer to the same ACL if you want the same processing in both
52618 These ACLs are called (possibly many times) just before the <option>acl_smtp_data</option>
52619 ACL in the case of an SMTP message, or just before the <option>acl_not_smtp</option> ACL in
52620 the case of a non-SMTP message. However, a MIME ACL is called only if the
52621 message contains a <emphasis>Content-Type:</emphasis> header line. When a call to a MIME
52622 ACL does not yield <quote>accept</quote>, ACL processing is aborted and the appropriate
52623 result code is sent to the client. In the case of an SMTP message, the
52624 <option>acl_smtp_data</option> ACL is not called when this happens.
52627 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
52628 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
52629 condition to match against the raw MIME part. You can also use the
52630 <option>mime_regex</option> condition to match against the decoded MIME part (see section
52631 <xref linkend="SECTscanregex"/>).
52634 At the start of a MIME ACL, a number of variables are set from the header
52635 information for the relevant MIME part. These are described below. The contents
52636 of the MIME part are not by default decoded into a disk file except for MIME
52637 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
52638 part into a disk file, you can use the <option>decode</option> condition. The general
52642 <literal>decode = [/</literal><<emphasis>path</emphasis>><literal>/]</literal><<emphasis>filename</emphasis>>
52645 The right hand side is expanded before use. After expansion,
52648 <orderedlist numeration="arabic">
52651 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
52656 The string <quote>default</quote>. In that case, the file is put in the temporary
52657 <quote>default</quote> directory <<emphasis>spool_directory</emphasis>><filename>/scan/</filename><<emphasis>message_id</emphasis>><filename>/</filename> with
52658 a sequential file name consisting of the message id and a sequence number. The
52659 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
52664 A full path name starting with a slash. If the full name is an existing
52665 directory, it is used as a replacement for the default directory. The filename
52666 is then sequentially assigned. If the path does not exist, it is used as
52667 the full path and file name.
52672 If the string does not start with a slash, it is used as the
52673 filename, and the default path is then used.
52678 The <option>decode</option> condition normally succeeds. It is only false for syntax
52679 errors or unusual circumstances such as memory shortages. You can easily decode
52680 a file with its original, proposed filename using
52682 <literallayout class="monospaced">
52683 decode = $mime_filename
52686 However, you should keep in mind that <varname>$mime_filename</varname> might contain
52687 anything. If you place files outside of the default path, they are not
52688 automatically unlinked.
52691 For RFC822 attachments (these are messages attached to messages, with a
52692 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
52693 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
52694 variable is set (see below). Attached messages are always decoded to disk
52695 before being checked, and the files are unlinked once the check is done.
52698 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
52699 used to match regular expressions against raw and decoded MIME parts,
52700 respectively. They are described in section <xref linkend="SECTscanregex"/>.
52703 <indexterm role="concept">
52704 <primary>MIME content scanning</primary>
52705 <secondary>returned variables</secondary>
52707 The following list describes all expansion variables that are
52708 available in the MIME ACL:
52712 <term><varname>$mime_boundary</varname></term>
52715 If the current part is a multipart (see <varname>$mime_is_multipart</varname>) below, it should
52716 have a boundary string, which is stored in this variable. If the current part
52717 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
52718 contains the empty string.
52720 </listitem></varlistentry>
52722 <term><varname>$mime_charset</varname></term>
52725 This variable contains the character set identifier, if one was found in the
52726 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
52728 <literallayout class="monospaced">
52734 Please note that this value is not normalized, so you should do matches
52735 case-insensitively.
52737 </listitem></varlistentry>
52739 <term><varname>$mime_content_description</varname></term>
52742 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
52743 header. It can contain a human-readable description of the parts content. Some
52744 implementations repeat the filename for attachments here, but they are usually
52745 only used for display purposes.
52747 </listitem></varlistentry>
52749 <term><varname>$mime_content_disposition</varname></term>
52752 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
52753 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
52755 </listitem></varlistentry>
52757 <term><varname>$mime_content_id</varname></term>
52760 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
52761 This is a unique ID that can be used to reference a part from another part.
52763 </listitem></varlistentry>
52765 <term><varname>$mime_content_size</varname></term>
52768 This variable is set only after the <option>decode</option> modifier (see above) has been
52769 successfully run. It contains the size of the decoded part in kilobytes. The
52770 size is always rounded up to full kilobytes, so only a completely empty part
52771 has a <varname>$mime_content_size</varname> of zero.
52773 </listitem></varlistentry>
52775 <term><varname>$mime_content_transfer_encoding</varname></term>
52778 This variable contains the normalized content of the
52779 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
52780 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
52782 </listitem></varlistentry>
52784 <term><varname>$mime_content_type</varname></term>
52787 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
52788 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
52789 are some examples of popular MIME types, as they may appear in this variable:
52791 <literallayout class="monospaced">
52794 application/octet-stream
52799 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
52802 </listitem></varlistentry>
52804 <term><varname>$mime_decoded_filename</varname></term>
52807 This variable is set only after the <option>decode</option> modifier (see above) has been
52808 successfully run. It contains the full path and file name of the file
52809 containing the decoded data.
52811 </listitem></varlistentry>
52814 <indexterm role="concept">
52815 <primary>RFC 2047</primary>
52820 <term><varname>$mime_filename</varname></term>
52823 This is perhaps the most important of the MIME variables. It contains a
52824 proposed filename for an attachment, if one was found in either the
52825 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
52826 RFC2047 decoded, but no additional sanity checks are done. If no filename was
52827 found, this variable contains the empty string.
52829 </listitem></varlistentry>
52831 <term><varname>$mime_is_coverletter</varname></term>
52834 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
52835 attached data. It can be used to clamp down on flashy or unnecessarily encoded
52836 content in the cover letter, while not restricting attachments at all.
52839 The variable contains 1 (true) for a MIME part believed to be part of the
52840 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
52843 <orderedlist numeration="arabic">
52846 The outermost MIME part of a message is always a cover letter.
52851 If a multipart/alternative or multipart/related MIME part is a cover letter,
52852 so are all MIME subparts within that multipart.
52857 If any other multipart is a cover letter, the first subpart is a cover letter,
52858 and the rest are attachments.
52863 All parts contained within an attachment multipart are attachments.
52868 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
52869 alternative plain text), while allowing HTML files to be attached. HTML
52870 coverletter mail attached to non-HMTL coverletter mail will also be allowed:
52872 <literallayout class="monospaced">
52873 deny message = HTML mail is not accepted here
52874 !condition = $mime_is_rfc822
52875 condition = $mime_is_coverletter
52876 condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
52878 </listitem></varlistentry>
52880 <term><varname>$mime_is_multipart</varname></term>
52883 This variable has the value 1 (true) when the current part has the main type
52884 <quote>multipart</quote>, for example <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
52885 Since multipart entities only serve as containers for other parts, you may not
52886 want to carry out specific actions on them.
52888 </listitem></varlistentry>
52890 <term><varname>$mime_is_rfc822</varname></term>
52893 This variable has the value 1 (true) if the current part is not a part of the
52894 checked message itself, but part of an attached message. Attached message
52895 decoding is fully recursive.
52897 </listitem></varlistentry>
52899 <term><varname>$mime_part_count</varname></term>
52902 This variable is a counter that is raised for each processed MIME part. It
52903 starts at zero for the very first part (which is usually a multipart). The
52904 counter is per-message, so it is reset when processing RFC822 attachments (see
52905 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
52906 complete, so you can use it in the DATA ACL to determine the number of MIME
52907 parts of a message. For non-MIME messages, this variable contains the value -1.
52909 </listitem></varlistentry>
52912 <section id="SECTscanregex">
52913 <title>Scanning with regular expressions</title>
52915 <indexterm role="concept">
52916 <primary>content scanning</primary>
52917 <secondary>with regular expressions</secondary>
52919 <indexterm role="concept">
52920 <primary>regular expressions</primary>
52921 <secondary>content scanning with</secondary>
52923 You can specify your own custom regular expression matches on the full body of
52924 the message, or on individual MIME parts.
52927 The <option>regex</option> condition takes one or more regular expressions as arguments and
52928 matches them against the full message (when called in the DATA ACL) or a raw
52929 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
52930 linewise, with a maximum line length of 32K characters. That means you cannot
52931 have multiline matches with the <option>regex</option> condition.
52934 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
52935 to 32K of decoded content (the whole content at once, not linewise). If the
52936 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
52937 is decoded automatically when <option>mime_regex</option> is executed (using default path
52938 and filename values). If the decoded data is larger than 32K, only the first
52939 32K characters are checked.
52942 The regular expressions are passed as a colon-separated list. To include a
52943 literal colon, you must double it. Since the whole right-hand side string is
52944 expanded before being used, you must also escape dollar signs and backslashes
52945 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
52946 Here is a simple example that contains two regular expressions:
52948 <literallayout class="monospaced">
52949 deny message = contains blacklisted regex ($regex_match_string)
52950 regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
52953 The conditions returns true if any one of the regular expressions matches. The
52954 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
52955 matching regular expression.
52958 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
52962 <section id="SECTdemimecond">
52963 <title>The demime condition</title>
52965 <indexterm role="concept">
52966 <primary>content scanning</primary>
52967 <secondary>MIME checking</secondary>
52969 <indexterm role="concept">
52970 <primary>MIME content scanning</primary>
52972 The <option>demime</option> ACL condition provides MIME unpacking, sanity checking and file
52973 extension blocking. It is usable only in the DATA and non-SMTP ACLs. The
52974 <option>demime</option> condition uses a simpler interface to MIME decoding than the MIME
52975 ACL functionality, but provides no additional facilities. Please note that this
52976 condition is deprecated and kept only for backward compatibility. You must set
52977 the WITH_OLD_DEMIME option in <filename>Local/Makefile</filename> at build time to be able to
52978 use the <option>demime</option> condition.
52981 The <option>demime</option> condition unpacks MIME containers in the message. It detects
52982 errors in MIME containers and can match file extensions found in the message
52983 against a list. Using this facility produces files containing the unpacked MIME
52984 parts of the message in the temporary scan directory. If you do antivirus
52985 scanning, it is recommended that you use the <option>demime</option> condition before the
52986 antivirus (<option>malware</option>) condition.
52989 On the right-hand side of the <option>demime</option> condition you can pass a
52990 colon-separated list of file extensions that it should match against. For
52993 <literallayout class="monospaced">
52994 deny message = Found blacklisted file attachment
52995 demime = vbs:com:bat:pif:prf:lnk
52998 If one of the file extensions is found, the condition is true, otherwise it is
52999 false. If there is a temporary error while demimeing (for example, <quote>disk
53000 full</quote>), the condition defers, and the message is temporarily rejected (unless
53001 the condition is on a <option>warn</option> verb).
53004 The right-hand side is expanded before being treated as a list, so you can have
53005 conditions and lookups there. If it expands to an empty string, <quote>false</quote>, or
53006 zero (<quote>0</quote>), no demimeing is done and the condition is false.
53009 The <option>demime</option> condition set the following variables:
53013 <term><varname>$demime_errorlevel</varname></term>
53016 <indexterm role="variable">
53017 <primary><varname>$demime_errorlevel</varname></primary>
53019 When an error is detected in a MIME container, this variable contains the
53020 severity of the error, as an integer number. The higher the value, the more
53021 severe the error (the current maximum value is 3). If this variable is unset or
53022 zero, no error occurred.
53024 </listitem></varlistentry>
53026 <term><varname>$demime_reason</varname></term>
53029 <indexterm role="variable">
53030 <primary><varname>$demime_reason</varname></primary>
53032 When <varname>$demime_errorlevel</varname> is greater than zero, this variable contains a
53033 human-readable text string describing the MIME error that occurred.
53035 </listitem></varlistentry>
53039 <term><varname>$found_extension</varname></term>
53042 <indexterm role="variable">
53043 <primary><varname>$found_extension</varname></primary>
53045 When the <option>demime</option> condition is true, this variable contains the file
53046 extension it found.
53048 </listitem></varlistentry>
53051 Both <varname>$demime_errorlevel</varname> and <varname>$demime_reason</varname> are set by the first call of
53052 the <option>demime</option> condition, and are not changed on subsequent calls.
53055 If you do not want to check for file extensions, but rather use the <option>demime</option>
53056 condition for unpacking or error checking purposes, pass <quote>*</quote> as the
53057 right-hand side value. Here is a more elaborate example of how to use this
53060 <literallayout class="monospaced">
53061 # Reject messages with serious MIME container errors
53062 deny message = Found MIME error ($demime_reason).
53064 condition = ${if >{$demime_errorlevel}{2}{1}{0}}
53066 # Reject known virus spreading file extensions.
53067 # Accepting these is pretty much braindead.
53068 deny message = contains $found_extension file (blacklisted).
53069 demime = com:vbs:bat:pif:scr
53071 # Freeze .exe and .doc files. Postmaster can
53072 # examine them and eventually thaw them.
53073 deny log_message = Another $found_extension file.
53078 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
53083 <chapter id="CHAPlocalscan">
53084 <title>Adding a local scan function to Exim</title>
53085 <titleabbrev>Local scan function</titleabbrev>
53087 <indexterm role="concept" id="IIDlosca" class="startofrange">
53088 <primary><function>local_scan()</function> function</primary>
53089 <secondary>description of</secondary>
53091 <indexterm role="concept">
53092 <primary>customizing</primary>
53093 <secondary>input scan using C function</secondary>
53095 <indexterm role="concept">
53096 <primary>policy control</primary>
53097 <secondary>by local scan function</secondary>
53099 In these days of email worms, viruses, and ever-increasing spam, some sites
53100 want to apply a lot of checking to messages before accepting them.
53103 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
53104 passing messages to external virus and spam scanning software. You can also do
53105 a certain amount in Exim itself through string expansions and the <option>condition</option>
53106 condition in the ACL that runs after the SMTP DATA command or the ACL for
53107 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
53110 To allow for further customization to a site’s own requirements, there is the
53111 possibility of linking Exim with a private message scanning function, written
53112 in C. If you want to run code that is written in something other than C, you
53113 can of course use a little C stub to call it.
53116 The local scan function is run once for every incoming message, at the point
53117 when Exim is just about to accept the message.
53118 It can therefore be used to control non-SMTP messages from local processes as
53119 well as messages arriving via SMTP.
53122 Exim applies a timeout to calls of the local scan function, and there is an
53123 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
53124 Zero means <quote>no timeout</quote>.
53125 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
53126 before calling the local scan function, so that the most common types of crash
53127 are caught. If the timeout is exceeded or one of those signals is caught, the
53128 incoming message is rejected with a temporary error if it is an SMTP message.
53129 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
53130 code. The incident is logged on the main and reject logs.
53132 <section id="SECID207">
53133 <title>Building Exim to use a local scan function</title>
53135 <indexterm role="concept">
53136 <primary><function>local_scan()</function> function</primary>
53137 <secondary>building Exim to use</secondary>
53139 To make use of the local scan function feature, you must tell Exim where your
53140 function is before building Exim, by setting LOCAL_SCAN_SOURCE in your
53141 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
53142 directory, so you might set
53144 <literallayout class="monospaced">
53145 LOCAL_SCAN_SOURCE=Local/local_scan.c
53148 for example. The function must be called <function>local_scan()</function>. It is called by
53149 Exim after it has received a message, when the success return code is about to
53150 be sent. This is after all the ACLs have been run. The return code from your
53151 function controls whether the message is actually accepted or not. There is a
53152 commented template function (that just accepts the message) in the file
53153 _src/local_scan.c_.
53156 If you want to make use of Exim’s run time configuration file to set options
53157 for your <function>local_scan()</function> function, you must also set
53159 <literallayout class="monospaced">
53160 LOCAL_SCAN_HAS_OPTIONS=yes
53163 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
53166 <section id="SECTapiforloc">
53167 <title>API for local_scan()</title>
53169 <indexterm role="concept">
53170 <primary><function>local_scan()</function> function</primary>
53171 <secondary>API description</secondary>
53173 You must include this line near the start of your code:
53175 <literallayout class="monospaced">
53176 #include "local_scan.h"
53179 This header file defines a number of variables and other values, and the
53180 prototype for the function itself. Exim is coded to use unsigned char values
53181 almost exclusively, and one of the things this header defines is a shorthand
53182 for <literal>unsigned char</literal> called <literal>uschar</literal>.
53183 It also contains the following macro definitions, to simplify casting character
53184 strings and pointers to character strings:
53186 <literallayout class="monospaced">
53187 #define CS (char *)
53188 #define CCS (const char *)
53189 #define CSS (char **)
53190 #define US (unsigned char *)
53191 #define CUS (const unsigned char *)
53192 #define USS (unsigned char **)
53195 The function prototype for <function>local_scan()</function> is:
53197 <literallayout class="monospaced">
53198 extern int local_scan(int fd, uschar **return_text);
53201 The arguments are as follows:
53206 <option>fd</option> is a file descriptor for the file that contains the body of the message
53207 (the -D file). The file is open for reading and writing, but updating it is not
53208 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
53211 The descriptor is positioned at character 19 of the file, which is the first
53212 character of the body itself, because the first 19 characters are the message
53213 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
53214 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
53215 case this changes in some future version.
53220 <option>return_text</option> is an address which you can use to return a pointer to a text
53221 string at the end of the function. The value it points to on entry is NULL.
53226 The function must return an <option>int</option> value which is one of the following macros:
53230 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
53233 <indexterm role="variable">
53234 <primary><varname>$local_scan_data</varname></primary>
53236 The message is accepted. If you pass back a string of text, it is saved with
53237 the message, and made available in the variable <varname>$local_scan_data</varname>. No
53238 newlines are permitted (if there are any, they are turned into spaces) and the
53239 maximum length of text is 1000 characters.
53241 </listitem></varlistentry>
53243 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
53246 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
53247 queued without immediate delivery, and is frozen.
53249 </listitem></varlistentry>
53251 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
53254 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
53255 queued without immediate delivery.
53257 </listitem></varlistentry>
53259 <term><literal>LOCAL_SCAN_REJECT</literal></term>
53262 The message is rejected; the returned text is used as an error message which is
53263 passed back to the sender and which is also logged. Newlines are permitted –
53264 they cause a multiline response for SMTP rejections, but are converted to
53265 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
53268 </listitem></varlistentry>
53270 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
53273 The message is temporarily rejected; the returned text is used as an error
53274 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
53275 problem</quote> is used.
53277 </listitem></varlistentry>
53279 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
53282 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
53283 message is not written to the reject log. It has the effect of unsetting the
53284 <option>rejected_header</option> log selector for just this rejection. If
53285 <option>rejected_header</option> is already unset (see the discussion of the
53286 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
53287 same as LOCAL_SCAN_REJECT.
53289 </listitem></varlistentry>
53291 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
53294 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
53295 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
53297 </listitem></varlistentry>
53300 If the message is not being received by interactive SMTP, rejections are
53301 reported by writing to <option>stderr</option> or by sending an email, as configured by the
53302 <option>-oe</option> command line options.
53305 <section id="SECTconoptloc">
53306 <title>Configuration options for local_scan()</title>
53308 <indexterm role="concept">
53309 <primary><function>local_scan()</function> function</primary>
53310 <secondary>configuration options</secondary>
53312 It is possible to have option settings in the main configuration file
53313 that set values in static variables in the <function>local_scan()</function> module. If you
53314 want to do this, you must have the line
53316 <literallayout class="monospaced">
53317 LOCAL_SCAN_HAS_OPTIONS=yes
53320 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
53321 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
53322 file, you must define static variables to hold the option values, and a table
53326 The table must be a vector called <option>local_scan_options</option>, of type
53327 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
53328 and a pointer to the variable that holds the value. The entries must appear in
53329 alphabetical order. Following <option>local_scan_options</option> you must also define a
53330 variable called <option>local_scan_options_count</option> that contains the number of
53331 entries in the table. Here is a short example, showing two kinds of option:
53333 <literallayout class="monospaced">
53334 static int my_integer_option = 42;
53335 static uschar *my_string_option = US"a default string";
53337 optionlist local_scan_options[] = {
53338 { "my_integer", opt_int, &my_integer_option },
53339 { "my_string", opt_stringptr, &my_string_option }
53342 int local_scan_options_count =
53343 sizeof(local_scan_options)/sizeof(optionlist);
53346 The values of the variables can now be changed from Exim’s runtime
53347 configuration file by including a local scan section as in this example:
53349 <literallayout class="monospaced">
53352 my_string = some string of text...
53355 The available types of option data are as follows:
53359 <term><emphasis role="bold">opt_bool</emphasis></term>
53362 This specifies a boolean (true/false) option. The address should point to a
53363 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
53364 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
53365 whether such a variable has been set at all, you can initialize it to
53366 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
53369 </listitem></varlistentry>
53371 <term><emphasis role="bold">opt_fixed</emphasis></term>
53374 This specifies a fixed point number, such as is used for load averages.
53375 The address should point to a variable of type <literal>int</literal>. The value is stored
53376 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
53378 </listitem></varlistentry>
53380 <term><emphasis role="bold">opt_int</emphasis></term>
53383 This specifies an integer; the address should point to a variable of type
53384 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
53387 </listitem></varlistentry>
53389 <term><emphasis role="bold">opt_mkint</emphasis></term>
53392 This is the same as <option>opt_int</option>, except that when such a value is output in a
53393 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
53394 printed with the suffix K or M.
53396 </listitem></varlistentry>
53398 <term><emphasis role="bold">opt_octint</emphasis></term>
53401 This also specifies an integer, but the value is always interpreted as an
53402 octal integer, whether or not it starts with the digit zero, and it is
53403 always output in octal.
53405 </listitem></varlistentry>
53407 <term><emphasis role="bold">opt_stringptr</emphasis></term>
53410 This specifies a string value; the address must be a pointer to a
53411 variable that points to a string (for example, of type <literal>uschar *</literal>).
53413 </listitem></varlistentry>
53415 <term><emphasis role="bold">opt_time</emphasis></term>
53418 This specifies a time interval value. The address must point to a variable of
53419 type <literal>int</literal>. The value that is placed there is a number of seconds.
53421 </listitem></varlistentry>
53424 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
53425 out the values of all the <function>local_scan()</function> options.
53428 <section id="SECID208">
53429 <title>Available Exim variables</title>
53431 <indexterm role="concept">
53432 <primary><function>local_scan()</function> function</primary>
53433 <secondary>available Exim variables</secondary>
53435 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
53436 are the only ones that are guaranteed to be maintained from release to release.
53437 Note, however, that you can obtain the value of any Exim expansion variable,
53438 including <varname>$recipients</varname>, by calling <emphasis>expand_string()</emphasis>. The exported
53439 C variables are as follows:
53443 <term><emphasis role="bold">int body_linecount</emphasis></term>
53446 This variable contains the number of lines in the message’s body.
53448 </listitem></varlistentry>
53450 <term><emphasis role="bold">int body_zerocount</emphasis></term>
53453 This variable contains the number of binary zero bytes in the message’s body.
53455 </listitem></varlistentry>
53457 <term><emphasis role="bold">unsigned int debug_selector</emphasis></term>
53460 This variable is set to zero when no debugging is taking place. Otherwise, it
53461 is a bitmap of debugging selectors. Two bits are identified for use in
53462 <function>local_scan()</function>; they are defined as macros:
53467 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
53468 testing option that is not privileged – any caller may set it. All the
53469 other selector bits can be set only by admin users.
53474 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
53475 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
53481 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
53482 selected, you should use code like this:
53484 <literallayout class="monospaced">
53485 if ((debug_selector & D_local_scan) != 0)
53486 debug_printf("xxx", ...);
53488 </listitem></varlistentry>
53490 <term><emphasis role="bold">uschar *expand_string_message</emphasis></term>
53493 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
53494 variable <option>expand_string_message</option> contains the error message, zero-terminated.
53496 </listitem></varlistentry>
53498 <term><emphasis role="bold">header_line *header_list</emphasis></term>
53501 A pointer to a chain of header lines. The <option>header_line</option> structure is
53504 </listitem></varlistentry>
53506 <term><emphasis role="bold">header_line *header_last</emphasis></term>
53509 A pointer to the last of the header lines.
53511 </listitem></varlistentry>
53513 <term><emphasis role="bold">uschar *headers_charset</emphasis></term>
53516 The value of the <option>headers_charset</option> configuration option.
53518 </listitem></varlistentry>
53520 <term><emphasis role="bold">BOOL host_checking</emphasis></term>
53523 This variable is TRUE during a host checking session that is initiated by the
53524 <option>-bh</option> command line option.
53526 </listitem></varlistentry>
53528 <term><emphasis role="bold">uschar *interface_address</emphasis></term>
53531 The IP address of the interface that received the message, as a string. This
53532 is NULL for locally submitted messages.
53534 </listitem></varlistentry>
53536 <term><emphasis role="bold">int interface_port</emphasis></term>
53539 The port on which this message was received. When testing with the <option>-bh</option>
53540 command line option, the value of this variable is -1 unless a port has been
53541 specified via the <option>-oMi</option> option.
53543 </listitem></varlistentry>
53545 <term><emphasis role="bold">uschar *message_id</emphasis></term>
53548 This variable contains Exim’s message id for the incoming message (the value of
53549 <varname>$message_exim_id</varname>) as a zero-terminated string.
53551 </listitem></varlistentry>
53553 <term><emphasis role="bold">uschar *received_protocol</emphasis></term>
53556 The name of the protocol by which the message was received.
53558 </listitem></varlistentry>
53560 <term><emphasis role="bold">int recipients_count</emphasis></term>
53563 The number of accepted recipients.
53565 </listitem></varlistentry>
53567 <term><emphasis role="bold">recipient_item *recipients_list</emphasis></term>
53570 <indexterm role="concept">
53571 <primary>recipient</primary>
53572 <secondary>adding in local scan</secondary>
53574 <indexterm role="concept">
53575 <primary>recipient</primary>
53576 <secondary>removing in local scan</secondary>
53578 The list of accepted recipients, held in a vector of length
53579 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
53580 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
53581 below). You can delete recipients by removing them from the vector and
53582 adjusting the value in <option>recipients_count</option>. In particular, by setting
53583 <option>recipients_count</option> to zero you remove all recipients. If you then return the
53584 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
53585 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
53586 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
53588 </listitem></varlistentry>
53590 <term><emphasis role="bold">uschar *sender_address</emphasis></term>
53593 The envelope sender address. For bounce messages this is the empty string.
53595 </listitem></varlistentry>
53597 <term><emphasis role="bold">uschar *sender_host_address</emphasis></term>
53600 The IP address of the sending host, as a string. This is NULL for
53601 locally-submitted messages.
53603 </listitem></varlistentry>
53605 <term><emphasis role="bold">uschar *sender_host_authenticated</emphasis></term>
53608 The name of the authentication mechanism that was used, or NULL if the message
53609 was not received over an authenticated SMTP connection.
53611 </listitem></varlistentry>
53613 <term><emphasis role="bold">uschar *sender_host_name</emphasis></term>
53616 The name of the sending host, if known.
53618 </listitem></varlistentry>
53620 <term><emphasis role="bold">int sender_host_port</emphasis></term>
53623 The port on the sending host.
53625 </listitem></varlistentry>
53627 <term><emphasis role="bold">BOOL smtp_input</emphasis></term>
53630 This variable is TRUE for all SMTP input, including BSMTP.
53632 </listitem></varlistentry>
53634 <term><emphasis role="bold">BOOL smtp_batched_input</emphasis></term>
53637 This variable is TRUE for BSMTP input.
53639 </listitem></varlistentry>
53641 <term><emphasis role="bold">int store_pool</emphasis></term>
53644 The contents of this variable control which pool of memory is used for new
53645 requests. See section <xref linkend="SECTmemhanloc"/> for details.
53647 </listitem></varlistentry>
53650 <section id="SECID209">
53651 <title>Structure of header lines</title>
53653 The <option>header_line</option> structure contains the members listed below.
53654 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
53655 (see below). You can cause header lines to be ignored (deleted) by setting
53660 <term><emphasis role="bold">struct header_line *next</emphasis></term>
53663 A pointer to the next header line, or NULL for the last line.
53665 </listitem></varlistentry>
53667 <term><emphasis role="bold">int type</emphasis></term>
53670 A code identifying certain headers that Exim recognizes. The codes are printing
53671 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
53672 Notice in particular that any header line whose type is * is not transmitted
53673 with the message. This flagging is used for header lines that have been
53674 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
53675 lines.) Effectively, * means <quote>deleted</quote>.
53677 </listitem></varlistentry>
53679 <term><emphasis role="bold">int slen</emphasis></term>
53682 The number of characters in the header line, including the terminating and any
53685 </listitem></varlistentry>
53687 <term><emphasis role="bold">uschar *text</emphasis></term>
53690 A pointer to the text of the header. It always ends with a newline, followed by
53691 a zero byte. Internal newlines are preserved.
53693 </listitem></varlistentry>
53696 <section id="SECID210">
53697 <title>Structure of recipient items</title>
53699 The <option>recipient_item</option> structure contains these members:
53703 <term><emphasis role="bold">uschar *address</emphasis></term>
53706 This is a pointer to the recipient address as it was received.
53708 </listitem></varlistentry>
53710 <term><emphasis role="bold">int pno</emphasis></term>
53713 This is used in later Exim processing when top level addresses are created by
53714 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
53715 and must always contain -1 at this stage.
53717 </listitem></varlistentry>
53719 <term><emphasis role="bold">uschar *errors_to</emphasis></term>
53722 If this value is not NULL, bounce messages caused by failing to deliver to the
53723 recipient are sent to the address it contains. In other words, it overrides the
53724 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
53725 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
53726 an unqualified address, Exim qualifies it using the domain from
53727 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
53728 is NULL for all recipients.
53730 </listitem></varlistentry>
53733 <section id="SECID211">
53734 <title>Available Exim functions</title>
53736 <indexterm role="concept">
53737 <primary><function>local_scan()</function> function</primary>
53738 <secondary>available Exim functions</secondary>
53740 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
53741 These are the only ones that are guaranteed to be maintained from release to
53746 <term><emphasis role="bold">pid_t child_open(uschar **argv, uschar **envp, int newumask, int *infdptr, int *outfdptr, BOOL make_leader)</emphasis></term>
53749 This function creates a child process that runs the command specified by
53750 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
53751 be NULL if no environment variables are to be passed. A new umask is supplied
53752 for the process in <option>newumask</option>.
53755 Pipes to the standard input and output of the new process are set up
53756 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
53757 standard error is cloned to the standard output. If there are any file
53758 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
53759 argument is TRUE, the new process is made into a process group leader.
53762 The function returns the pid of the new process, or -1 if things go wrong.
53764 </listitem></varlistentry>
53766 <term><emphasis role="bold">int child_close(pid_t pid, int timeout)</emphasis></term>
53769 This function waits for a child process to terminate, or for a timeout (in
53770 seconds) to expire. A timeout value of zero means wait as long as it takes. The
53771 return value is as follows:
53779 The process terminated by a normal exit and the value is the process
53785 < 0 and > –256
53788 The process was terminated by a signal and the value is the negation of the
53797 The process timed out.
53805 The was some other error in wait(); <option>errno</option> is still set.
53809 </listitem></varlistentry>
53811 <term><emphasis role="bold">pid_t child_open_exim(int *fd)</emphasis></term>
53814 This function provide you with a means of submitting a new message to
53815 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
53816 want, but this packages it all up for you.) The function creates a pipe,
53817 forks a subprocess that is running
53819 <literallayout class="monospaced">
53820 exim -t -oem -oi -f <>
53823 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
53824 that is connected to the standard input. The yield of the function is the PID
53825 of the subprocess. You can then write a message to the file descriptor, with
53826 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
53829 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
53830 finish and to collect its ending status. A timeout value of zero is usually
53831 fine in this circumstance. Unless you have made a mistake with the recipient
53832 addresses, you should get a return code of zero.
53834 </listitem></varlistentry>
53836 <term><emphasis role="bold">pid_t child_open_exim2(int *fd, uschar *sender, uschar *sender_authentication)</emphasis></term>
53839 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
53843 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
53846 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
53848 </listitem></varlistentry>
53850 <term><emphasis role="bold">void debug_printf(char *, ...)</emphasis></term>
53853 This is Exim’s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
53854 output is written to the standard error stream. If no debugging is selected,
53855 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
53856 conditional on the <literal>local_scan</literal> debug selector by coding like this:
53858 <literallayout class="monospaced">
53859 if ((debug_selector & D_local_scan) != 0)
53860 debug_printf("xxx", ...);
53862 </listitem></varlistentry>
53864 <term><emphasis role="bold">uschar *expand_string(uschar *string)</emphasis></term>
53867 This is an interface to Exim’s string expansion code. The return value is the
53868 expanded string, or NULL if there was an expansion failure.
53869 The C variable <option>expand_string_message</option> contains an error message after an
53870 expansion failure. If expansion does not change the string, the return value is
53871 the pointer to the input string. Otherwise, the return value points to a new
53872 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
53873 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
53875 </listitem></varlistentry>
53877 <term><emphasis role="bold">void header_add(int type, char *format, ...)</emphasis></term>
53880 This function allows you to an add additional header line at the end of the
53881 existing ones. The first argument is the type, and should normally be a space
53882 character. The second argument is a format string and any number of
53883 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
53884 if you want, and you must ensure that the string ends with a newline.
53886 </listitem></varlistentry>
53888 <term><emphasis role="bold">void header_add_at_position(BOOL after, uschar *name, BOOL topnot, int type, char *format, ...)</emphasis></term>
53891 This function adds a new header line at a specified point in the header
53892 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
53895 If <option>name</option> is NULL, the new header is added at the end of the chain if
53896 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
53897 NULL, the header lines are searched for the first non-deleted header that
53898 matches the name. If one is found, the new header is added before it if
53899 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
53900 found header and any adjacent subsequent ones with the same name (even if
53901 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
53902 option controls where the header is added. If it is true, addition is at the
53903 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
53904 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
53906 <literallayout class="monospaced">
53907 header_add_at_position(TRUE, US"Received", TRUE,
53908 ' ', "X-xxx: ...");
53911 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
53912 there may not be if <option>received_header_text</option> expands to an empty string.
53914 </listitem></varlistentry>
53916 <term><emphasis role="bold">void header_remove(int occurrence, uschar *name)</emphasis></term>
53919 This function removes header lines. If <option>occurrence</option> is zero or negative, all
53920 occurrences of the header are removed. If occurrence is greater than zero, that
53921 particular instance of the header is removed. If no header(s) can be found that
53922 match the specification, the function does nothing.
53924 </listitem></varlistentry>
53926 <term><emphasis role="bold">BOOL header_testname(header_line *hdr, uschar *name, int length, BOOL notdel)</emphasis></term>
53929 This function tests whether the given header has the given name. It is not just
53930 a string comparison, because white space is permitted between the name and the
53931 colon. If the <option>notdel</option> argument is true, a false return is forced for all
53932 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
53934 <literallayout class="monospaced">
53935 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
53937 </listitem></varlistentry>
53939 <term><emphasis role="bold">uschar *lss_b64encode(uschar *cleartext, int length)</emphasis></term>
53942 <indexterm role="concept">
53943 <primary>base64 encoding</primary>
53944 <secondary>functions for <function>local_scan()</function> use</secondary>
53946 This function base64-encodes a string, which is passed by address and length.
53947 The text may contain bytes of any value, including zero. The result is passed
53948 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
53951 </listitem></varlistentry>
53953 <term><emphasis role="bold">int lss_b64decode(uschar *codetext, uschar **cleartext)</emphasis></term>
53956 This function decodes a base64-encoded string. Its arguments are a
53957 zero-terminated base64-encoded string and the address of a variable that is set
53958 to point to the result, which is in dynamic memory. The length of the decoded
53959 string is the yield of the function. If the input is invalid base64 data, the
53960 yield is -1. A zero byte is added to the end of the output string to make it
53961 easy to interpret as a C string (assuming it contains no zeros of its own). The
53962 added zero byte is not included in the returned count.
53964 </listitem></varlistentry>
53966 <term><emphasis role="bold">int lss_match_domain(uschar *domain, uschar *list)</emphasis></term>
53969 This function checks for a match in a domain list. Domains are always
53970 matched caselessly. The return value is one of the following:
53973 <literal>OK </literal> match succeeded
53974 <literal>FAIL </literal> match failed
53975 <literal>DEFER </literal> match deferred
53978 DEFER is usually caused by some kind of lookup defer, such as the
53979 inability to contact a database.
53981 </listitem></varlistentry>
53983 <term><emphasis role="bold">int lss_match_local_part(uschar *localpart, uschar *list, BOOL caseless)</emphasis></term>
53986 This function checks for a match in a local part list. The third argument
53987 controls case-sensitivity. The return values are as for
53988 <emphasis>lss_match_domain()</emphasis>.
53990 </listitem></varlistentry>
53992 <term><emphasis role="bold">int lss_match_address(uschar *address, uschar *list, BOOL caseless)</emphasis></term>
53995 This function checks for a match in an address list. The third argument
53996 controls the case-sensitivity of the local part match. The domain is always
53997 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
53999 </listitem></varlistentry>
54001 <term><emphasis role="bold">int lss_match_host(uschar *host_name, uschar *host_address, uschar *list)</emphasis></term>
54004 This function checks for a match in a host list. The most common usage is
54007 <literallayout class="monospaced">
54008 lss_match_host(sender_host_name, sender_host_address, ...)
54011 <indexterm role="variable">
54012 <primary><varname>$sender_host_address</varname></primary>
54014 An empty address field matches an empty item in the host list. If the host name
54015 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
54016 looked up if a host name is required to match an item in the list. The return
54017 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
54018 returns ERROR in the case when it had to look up a host name, but the lookup
54021 </listitem></varlistentry>
54023 <term><emphasis role="bold">void log_write(unsigned int selector, int which, char *format, ...)</emphasis></term>
54026 This function writes to Exim’s log files. The first argument should be zero (it
54027 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
54028 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
54029 them. It specifies to which log or logs the message is written. The remaining
54030 arguments are a format and relevant insertion arguments. The string should not
54031 contain any newlines, not even at the end.
54033 </listitem></varlistentry>
54035 <term><emphasis role="bold">void receive_add_recipient(uschar *address, int pno)</emphasis></term>
54038 This function adds an additional recipient to the message. The first argument
54039 is the recipient address. If it is unqualified (has no domain), it is qualified
54040 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
54043 This function does not allow you to specify a private <option>errors_to</option> address (as
54044 described with the structure of <option>recipient_item</option> above), because it pre-dates
54045 the addition of that field to the structure. However, it is easy to add such a
54046 value afterwards. For example:
54048 <literallayout class="monospaced">
54049 receive_add_recipient(US"monitor@mydom.example", -1);
54050 recipients_list[recipients_count-1].errors_to =
54051 US"postmaster@mydom.example";
54053 </listitem></varlistentry>
54055 <term><emphasis role="bold">BOOL receive_remove_recipient(uschar *recipient)</emphasis></term>
54058 This is a convenience function to remove a named recipient from the list of
54059 recipients. It returns true if a recipient was removed, and false if no
54060 matching recipient could be found. The argument must be a complete email
54063 </listitem></varlistentry>
54066 <indexterm role="concept">
54067 <primary>RFC 2047</primary>
54072 <term><emphasis role="bold">uschar rfc2047_decode(uschar *string, BOOL lencheck, uschar *target, int zeroval, int *lenptr, uschar **error)</emphasis></term>
54075 This function decodes strings that are encoded according to RFC 2047. Typically
54076 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
54077 from the Q or B encoding into a byte-string. Then, if provided with the name of
54078 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
54079 made to translate the result to the named character set. If this fails, the
54080 binary string is returned with an error message.
54083 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
54084 maximum MIME word length is enforced. The third argument is the target
54085 encoding, or NULL if no translation is wanted.
54088 <indexterm role="concept">
54089 <primary>binary zero</primary>
54090 <secondary>in RFC 2047 decoding</secondary>
54092 <indexterm role="concept">
54093 <primary>RFC 2047</primary>
54094 <secondary>binary zero in</secondary>
54096 If a binary zero is encountered in the decoded string, it is replaced by the
54097 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
54098 not be 0 because header lines are handled as zero-terminated strings.
54101 The function returns the result of processing the string, zero-terminated; if
54102 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
54103 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
54106 If an error is encountered, the function returns NULL and uses the <option>error</option>
54107 argument to return an error message. The variable pointed to by <option>error</option> is
54108 set to NULL if there is no error; it may be set non-NULL even when the function
54109 returns a non-NULL value if decoding was successful, but there was a problem
54112 </listitem></varlistentry>
54114 <term><emphasis role="bold">int smtp_fflush(void)</emphasis></term>
54117 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
54120 </listitem></varlistentry>
54122 <term><emphasis role="bold">void smtp_printf(char *, ...)</emphasis></term>
54125 The arguments of this function are like <function>printf()</function>; it writes to the SMTP
54126 output stream. You should use this function only when there is an SMTP output
54127 stream, that is, when the incoming message is being received via interactive
54128 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
54129 is FALSE. If you want to test for an incoming message from another host (as
54130 opposed to a local process that used the <option>-bs</option> command line option), you can
54131 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
54135 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
54136 output function, so it can be used for all forms of SMTP connection.
54139 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
54140 must start with an appropriate response code: 550 if you are going to return
54141 LOCAL_SCAN_REJECT, 451 if you are going to return
54142 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
54143 initial lines of a multi-line response, the code must be followed by a hyphen
54144 to indicate that the line is not the final response line. You must also ensure
54145 that the lines you write terminate with CRLF. For example:
54147 <literallayout class="monospaced">
54148 smtp_printf("550-this is some extra info\r\n");
54149 return LOCAL_SCAN_REJECT;
54152 Note that you can also create multi-line responses by including newlines in
54153 the data returned via the <option>return_text</option> argument. The added value of using
54154 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
54155 multiple output lines.
54158 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
54159 does not automatically flush pending output, and therefore does not test
54160 the state of the stream. (In the main code of Exim, flushing and error
54161 detection is done when Exim is ready for the next SMTP input command.) If
54162 you want to flush the output and check for an error (for example, the
54163 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
54164 arguments. It flushes the output stream, and returns a non-zero value if there
54167 </listitem></varlistentry>
54169 <term><emphasis role="bold">void *store_get(int)</emphasis></term>
54172 This function accesses Exim’s internal store (memory) manager. It gets a new
54173 chunk of memory whose size is given by the argument. Exim bombs out if it ever
54174 runs out of memory. See the next section for a discussion of memory handling.
54176 </listitem></varlistentry>
54178 <term><emphasis role="bold">void *store_get_perm(int)</emphasis></term>
54181 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
54182 permanent pool. See the next section for a discussion of memory handling.
54184 </listitem></varlistentry>
54186 <term><emphasis role="bold">uschar *string_copy(uschar *string)</emphasis></term>
54191 </listitem></varlistentry>
54193 <term><emphasis role="bold">uschar *string_copyn(uschar *string, int length)</emphasis></term>
54198 </listitem></varlistentry>
54200 <term><emphasis role="bold">uschar *string_sprintf(char *format, ...)</emphasis></term>
54203 These three functions create strings using Exim’s dynamic memory facilities.
54204 The first makes a copy of an entire string. The second copies up to a maximum
54205 number of characters, indicated by the second argument. The third uses a format
54206 and insertion arguments to create a new string. In each case, the result is a
54207 pointer to a new string in the current memory pool. See the next section for
54210 </listitem></varlistentry>
54213 <section id="SECTmemhanloc">
54214 <title>More about Exim’s memory handling</title>
54216 <indexterm role="concept">
54217 <primary><function>local_scan()</function> function</primary>
54218 <secondary>memory handling</secondary>
54220 No function is provided for freeing memory, because that is never needed.
54221 The dynamic memory that Exim uses when receiving a message is automatically
54222 recycled if another message is received by the same process (this applies only
54223 to incoming SMTP connections – other input methods can supply only one
54224 message at a time). After receiving the last message, a reception process
54228 Because it is recycled, the normal dynamic memory cannot be used for holding
54229 data that must be preserved over a number of incoming messages on the same SMTP
54230 connection. However, Exim in fact uses two pools of dynamic memory; the second
54231 one is not recycled, and can be used for this purpose.
54234 If you want to allocate memory that remains available for subsequent messages
54235 in the same SMTP connection, you should set
54237 <literallayout class="monospaced">
54238 store_pool = POOL_PERM
54241 before calling the function that does the allocation. There is no need to
54242 restore the value if you do not need to; however, if you do want to revert to
54243 the normal pool, you can either restore the previous value of <option>store_pool</option> or
54244 set it explicitly to POOL_MAIN.
54247 The pool setting applies to all functions that get dynamic memory, including
54248 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
54249 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
54250 block of memory from the permanent pool while preserving the value of
54251 <option>store_pool</option>.
54252 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
54257 <chapter id="CHAPsystemfilter">
54258 <title>System-wide message filtering</title>
54260 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
54261 <primary>filter</primary>
54262 <secondary>system filter</secondary>
54264 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
54265 <primary>filtering all mail</primary>
54267 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
54268 <primary>system filter</primary>
54270 The previous chapters (on ACLs and the local scan function) describe checks
54271 that can be applied to messages before they are accepted by a host. There is
54272 also a mechanism for checking messages once they have been received, but before
54273 they are delivered. This is called the <emphasis>system filter</emphasis>.
54276 The system filter operates in a similar manner to users’ filter files, but it
54277 is run just once per message (however many recipients the message has).
54278 It should not normally be used as a substitute for routing, because <option>deliver</option>
54279 commands in a system router provide new envelope recipient addresses.
54280 The system filter must be an Exim filter. It cannot be a Sieve filter.
54283 The system filter is run at the start of a delivery attempt, before any routing
54284 is done. If a message fails to be completely delivered at the first attempt,
54285 the system filter is run again at the start of every retry.
54286 If you want your filter to do something only once per message, you can make use
54287 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
54288 prevent it happening on retries.
54291 <indexterm role="variable">
54292 <primary><varname>$domain</varname></primary>
54294 <indexterm role="variable">
54295 <primary><varname>$local_part</varname></primary>
54297 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
54298 specific to individual recipient addresses, such as <varname>$local_part</varname> and
54299 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
54300 you want to run a centrally-specified filter for each recipient address
54301 independently, you can do so by setting up a suitable <command>redirect</command> router, as
54302 described in section <xref linkend="SECTperaddfil"/> below.
54304 <section id="SECID212">
54305 <title>Specifying a system filter</title>
54307 <indexterm role="concept">
54308 <primary>uid (user id)</primary>
54309 <secondary>system filter</secondary>
54311 <indexterm role="concept">
54312 <primary>gid (group id)</primary>
54313 <secondary>system filter</secondary>
54315 The name of the file that contains the system filter must be specified by
54316 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
54317 other than root, you must also set <option>system_filter_user</option> and
54318 <option>system_filter_group</option> as appropriate. For example:
54320 <literallayout class="monospaced">
54321 system_filter = /etc/mail/exim.filter
54322 system_filter_user = exim
54325 If a system filter generates any deliveries directly to files or pipes (via the
54326 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
54327 specified by setting <option>system_filter_file_transport</option> and
54328 <option>system_filter_pipe_transport</option>, respectively. Similarly,
54329 <option>system_filter_reply_transport</option> must be set to handle any messages generated
54330 by the <option>reply</option> command.
54333 <section id="SECID213">
54334 <title>Testing a system filter</title>
54336 You can run simple tests of a system filter in the same way as for a user
54337 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
54338 are permitted only in system filters are recognized.
54341 If you want to test the combined effect of a system filter and a user filter,
54342 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
54345 <section id="SECID214">
54346 <title>Contents of a system filter</title>
54348 The language used to specify system filters is the same as for users’ filter
54349 files. It is described in the separate end-user document <emphasis>Exim’s interface to
54350 mail filtering</emphasis>. However, there are some additional features that are
54351 available only in system filters; these are described in subsequent sections.
54352 If they are encountered in a user’s filter file or when testing with <option>-bf</option>,
54356 <indexterm role="concept">
54357 <primary>frozen messages</primary>
54358 <secondary>manual thaw; testing in filter</secondary>
54360 There are two special conditions which, though available in users’ filter
54361 files, are designed for use in system filters. The condition <option>first_delivery</option>
54362 is true only for the first attempt at delivering a message, and
54363 <option>manually_thawed</option> is true only if the message has been frozen, and
54364 subsequently thawed by an admin user. An explicit forced delivery counts as a
54365 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
54368 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
54369 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
54370 succeed, it will not be tried again.
54371 If you want Exim to retry an unseen delivery until it succeeds, you should
54372 arrange to set it up every time the filter runs.
54375 When a system filter finishes running, the values of the variables <varname>$n0</varname> –
54376 <varname>$n9</varname> are copied into <varname>$sn0</varname> – <varname>$sn9</varname> and are thereby made available to
54377 users’ filter files. Thus a system filter can, for example, set up <quote>scores</quote>
54378 to which users’ filter files can refer.
54381 <section id="SECID215">
54382 <title>Additional variable for system filters</title>
54384 <indexterm role="variable">
54385 <primary><varname>$recipients</varname></primary>
54387 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
54388 of the message (separated by commas and white space), is available in system
54389 filters. It is not available in users’ filters for privacy reasons.
54392 <section id="SECID216">
54393 <title>Defer, freeze, and fail commands for system filters</title>
54395 <indexterm role="concept">
54396 <primary>freezing messages</primary>
54398 <indexterm role="concept">
54399 <primary>message</primary>
54400 <secondary>freezing</secondary>
54402 <indexterm role="concept">
54403 <primary>message</primary>
54404 <secondary>forced failure</secondary>
54406 <indexterm role="concept">
54407 <primary><option>fail</option></primary>
54408 <secondary>in system filter</secondary>
54410 <indexterm role="concept">
54411 <primary><option>freeze</option> in system filter</primary>
54413 <indexterm role="concept">
54414 <primary><option>defer</option> in system filter</primary>
54416 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
54417 always available in system filters, but are not normally enabled in users’
54418 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
54419 for the <command>redirect</command> router.) These commands can optionally be followed by the
54420 word <option>text</option> and a string containing an error message, for example:
54422 <literallayout class="monospaced">
54423 fail text "this message looks like spam to me"
54426 The keyword <option>text</option> is optional if the next character is a double quote.
54429 The <option>defer</option> command defers delivery of the original recipients of the
54430 message. The <option>fail</option> command causes all the original recipients to be failed,
54431 and a bounce message to be created. The <option>freeze</option> command suspends all
54432 delivery attempts for the original recipients. In all cases, any new deliveries
54433 that are specified by the filter are attempted as normal after the filter has
54437 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
54438 not manually frozen since. This means that automatic freezing by a system
54439 filter can be used as a way of checking out suspicious messages. If a message
54440 is found to be all right, manually unfreezing it allows it to be delivered.
54443 <indexterm role="concept">
54444 <primary>log</primary>
54445 <secondary><option>fail</option> command log line</secondary>
54447 <indexterm role="concept">
54448 <primary><option>fail</option></primary>
54449 <secondary>log line; reducing</secondary>
54451 The text given with a fail command is used as part of the bounce message as
54452 well as being written to the log. If the message is quite long, this can fill
54453 up a lot of log space when such failures are common. To reduce the size of the
54454 log message, Exim interprets the text in a special way if it starts with the
54455 two characters <literal><<</literal> and contains <literal>>></literal> later. The text between these two
54456 strings is written to the log, and the rest of the text is used in the bounce
54457 message. For example:
54459 <literallayout class="monospaced">
54460 fail "<<filter test 1>>Your message is rejected \
54461 because it contains attachments that we are \
54462 not prepared to receive."
54465 <indexterm role="concept">
54466 <primary>loop</primary>
54467 <secondary>caused by <option>fail</option></secondary>
54469 Take great care with the <option>fail</option> command when basing the decision to fail on
54470 the contents of the message, because the bounce message will of course include
54471 the contents of the original message and will therefore trigger the <option>fail</option>
54472 command again (causing a mail loop) unless steps are taken to prevent this.
54473 Testing the <option>error_message</option> condition is one way to prevent this. You could
54476 <literallayout class="monospaced">
54477 if $message_body contains "this is spam" and not error_message
54478 then fail text "spam is not wanted here" endif
54481 though of course that might let through unwanted bounce messages. The
54482 alternative is clever checking of the body and/or headers to detect bounces
54483 generated by the filter.
54486 The interpretation of a system filter file ceases after a
54487 <option>defer</option>,
54488 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
54489 set up earlier in the filter file are honoured, so you can use a sequence such
54492 <literallayout class="monospaced">
54497 to send a specified message when the system filter is freezing (or deferring or
54498 failing) a message. The normal deliveries for the message do not, of course,
54502 <section id="SECTaddremheasys">
54503 <title>Adding and removing headers in a system filter</title>
54505 <indexterm role="concept">
54506 <primary>header lines</primary>
54507 <secondary>adding; in system filter</secondary>
54509 <indexterm role="concept">
54510 <primary>header lines</primary>
54511 <secondary>removing; in system filter</secondary>
54513 <indexterm role="concept">
54514 <primary>filter</primary>
54515 <secondary>header lines; adding/removing</secondary>
54517 Two filter commands that are available only in system filters are:
54519 <literallayout class="monospaced">
54520 headers add <string>
54521 headers remove <string>
54524 The argument for the <option>headers add</option> is a string that is expanded and then
54525 added to the end of the message’s headers. It is the responsibility of the
54526 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
54527 space is ignored, and if the string is otherwise empty, or if the expansion is
54528 forced to fail, the command has no effect.
54531 You can use <quote>\n</quote> within the string, followed by white space, to specify
54532 continued header lines. More than one header may be added in one command by
54533 including <quote>\n</quote> within the string without any following white space. For
54536 <literallayout class="monospaced">
54537 headers add "X-header-1: ....\n \
54538 continuation of X-header-1 ...\n\
54542 Note that the header line continuation white space after the first newline must
54543 be placed before the backslash that continues the input string, because white
54544 space after input continuations is ignored.
54547 The argument for <option>headers remove</option> is a colon-separated list of header names.
54548 This command applies only to those headers that are stored with the message;
54549 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
54550 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
54551 header with the same name, they are all removed.
54554 The <option>headers</option> command in a system filter makes an immediate change to the set
54555 of header lines that was received with the message (with possible additions
54556 from ACL processing). Subsequent commands in the system filter operate on the
54557 modified set, which also forms the basis for subsequent message delivery.
54558 Unless further modified during routing or transporting, this set of headers is
54559 used for all recipients of the message.
54562 During routing and transporting, the variables that refer to the contents of
54563 header lines refer only to those lines that are in this set. Thus, header lines
54564 that are added by a system filter are visible to users’ filter files and to all
54565 routers and transports. This contrasts with the manipulation of header lines by
54566 routers and transports, which is not immediate, but which instead is saved up
54567 until the message is actually being written (see section
54568 <xref linkend="SECTheadersaddrem"/>).
54571 If the message is not delivered at the first attempt, header lines that were
54572 added by the system filter are stored with the message, and so are still
54573 present at the next delivery attempt. Header lines that were removed are still
54574 present, but marked <quote>deleted</quote> so that they are not transported with the
54575 message. For this reason, it is usual to make the <option>headers</option> command
54576 conditional on <option>first_delivery</option> so that the set of header lines is not
54577 modified more than once.
54580 Because header modification in a system filter acts immediately, you have to
54581 use an indirect approach if you want to modify the contents of a header line.
54584 <literallayout class="monospaced">
54585 headers add "Old-Subject: $h_subject:"
54586 headers remove "Subject"
54587 headers add "Subject: new subject (was: $h_old-subject:)"
54588 headers remove "Old-Subject"
54591 <section id="SECID217">
54592 <title>Setting an errors address in a system filter</title>
54594 <indexterm role="concept">
54595 <primary>envelope sender</primary>
54597 In a system filter, if a <option>deliver</option> command is followed by
54599 <literallayout class="monospaced">
54600 errors_to <some address>
54603 in order to change the envelope sender (and hence the error reporting) for that
54604 delivery, any address may be specified. (In a user filter, only the current
54605 user’s address can be set.) For example, if some mail is being monitored, you
54608 <literallayout class="monospaced">
54609 unseen deliver monitor@spying.example errors_to root@local.example
54612 to take a copy which would not be sent back to the normal error reporting
54613 address if its delivery failed.
54616 <section id="SECTperaddfil">
54617 <title>Per-address filtering</title>
54619 <indexterm role="variable">
54620 <primary><varname>$domain</varname></primary>
54622 <indexterm role="variable">
54623 <primary><varname>$local_part</varname></primary>
54625 In contrast to the system filter, which is run just once per message for each
54626 delivery attempt, it is also possible to set up a system-wide filtering
54627 operation that runs once for each recipient address. In this case, variables
54628 such as <varname>$local_part</varname> and <varname>$domain</varname> can be used, and indeed, the choice of
54629 filter file could be made dependent on them. This is an example of a router
54630 which implements such a filter:
54632 <literallayout class="monospaced">
54636 domains = +local_domains
54637 file = /central/filters/$local_part
54643 The filter is run in a separate process under its own uid. Therefore, either
54644 <option>check_local_user</option> must be set (as above), in which case the filter is run as
54645 the local user, or the <option>user</option> option must be used to specify which user to
54646 use. If both are set, <option>user</option> overrides.
54649 Care should be taken to ensure that none of the commands in the filter file
54650 specify a significant delivery if the message is to go on to be delivered to
54651 its intended recipient. The router will not then claim to have dealt with the
54652 address, so it will be passed on to subsequent routers to be delivered in the
54654 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
54655 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
54656 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
54661 <chapter id="CHAPmsgproc">
54662 <title>Message processing</title>
54664 <indexterm role="concept" id="IIDmesproc" class="startofrange">
54665 <primary>message</primary>
54666 <secondary>general processing</secondary>
54668 Exim performs various transformations on the sender and recipient addresses of
54669 all messages that it handles, and also on the messages’ header lines. Some of
54670 these are optional and configurable, while others always take place. All of
54671 this processing, except rewriting as a result of routing, and the addition or
54672 removal of header lines while delivering, happens when a message is received,
54673 before it is placed on Exim’s queue.
54676 Some of the automatic processing takes place by default only for
54677 <quote>locally-originated</quote> messages. This adjective is used to describe messages
54678 that are not received over TCP/IP, but instead are passed to an Exim process on
54679 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
54680 set up by the <option>-bs</option> command line option.
54683 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
54684 or ::1) are not considered to be locally-originated. Exim does not treat the
54685 loopback interface specially in any way.
54688 If you want the loopback interface to be treated specially, you must ensure
54689 that there are appropriate entries in your ACLs.
54691 <section id="SECTsubmodnon">
54692 <title>Submission mode for non-local messages</title>
54694 <indexterm role="concept">
54695 <primary>message</primary>
54696 <secondary>submission</secondary>
54698 <indexterm role="concept">
54699 <primary>submission mode</primary>
54701 Processing that happens automatically for locally-originated messages (unless
54702 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
54703 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
54704 state. Submission mode is set by the modifier
54706 <literallayout class="monospaced">
54707 control = submission
54710 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
54711 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
54712 a local submission, and is normally used when the source of the message is
54713 known to be an MUA running on a client host (as opposed to an MTA). For
54714 example, to set submission mode for messages originating on the IPv4 loopback
54715 interface, you could include the following in the MAIL ACL:
54717 <literallayout class="monospaced">
54718 warn hosts = 127.0.0.1
54719 control = submission
54722 <indexterm role="concept">
54723 <primary><option>sender_retain</option> submission option</primary>
54725 There are some options that can be used when setting submission mode. A slash
54726 is used to separate options. For example:
54728 <literallayout class="monospaced">
54729 control = submission/sender_retain
54732 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
54733 true and <option>local_from_check</option> false for the current incoming message. The first
54734 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
54735 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
54736 authenticated sender. With this setting, Exim still fixes up messages by adding
54737 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
54738 attempt to check sender authenticity in header lines.
54741 When <option>sender_retain</option> is not set, a submission mode setting may specify a
54742 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
54745 <literallayout class="monospaced">
54746 control = submission/domain=some.domain
54749 The domain may be empty. How this value is used is described in sections
54750 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
54751 that allows you to specify the user’s full name for inclusion in a created
54752 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
54754 <literallayout class="monospaced">
54755 accept authenticated = *
54756 control = submission/domain=wonderland.example/\
54757 name=${lookup {$authenticated_id} \
54758 lsearch {/etc/exim/namelist}}
54761 Because the name may contain any characters, including slashes, the <option>name</option>
54762 option must be given last. The remainder of the string is used as the name. For
54763 the example above, if <filename>/etc/exim/namelist</filename> contains:
54765 <literallayout class="monospaced">
54766 bigegg: Humpty Dumpty
54769 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
54772 <literallayout class="monospaced">
54773 Sender: Humpty Dumpty <bigegg@wonderland.example>
54776 <indexterm role="concept">
54777 <primary>return path</primary>
54778 <secondary>in submission mode</secondary>
54780 By default, submission mode forces the return path to the same address as is
54781 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
54782 specified, the return path is also left unchanged.
54785 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
54786 ACL. This means that any sender checks performed before the fix-ups use the
54787 untrusted sender address specified by the user, not the trusted sender address
54788 specified by submission mode. Although this might be slightly unexpected, it
54789 does mean that you can configure ACL checks to spot that a user is trying to
54790 spoof another’s address.
54793 <section id="SECTlineendings">
54794 <title>Line endings</title>
54796 <indexterm role="concept">
54797 <primary>line endings</primary>
54799 <indexterm role="concept">
54800 <primary>carriage return</primary>
54802 <indexterm role="concept">
54803 <primary>linefeed</primary>
54805 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
54806 linefeed) is the line ending for messages transmitted over the Internet using
54807 SMTP over TCP/IP. However, within individual operating systems, different
54808 conventions are used. For example, Unix-like systems use just LF, but others
54809 use CRLF or just CR.
54812 Exim was designed for Unix-like systems, and internally, it stores messages
54813 using the system’s convention of a single LF as a line terminator. When
54814 receiving a message, all line endings are translated to this standard format.
54815 Originally, it was thought that programs that passed messages directly to an
54816 MTA within an operating system would use that system’s convention. Experience
54817 has shown that this is not the case; for example, there are Unix applications
54818 that use CRLF in this circumstance. For this reason, and for compatibility with
54819 other MTAs, the way Exim handles line endings for all messages is now as
54825 LF not preceded by CR is treated as a line ending.
54830 CR is treated as a line ending; if it is immediately followed by LF, the LF
54836 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
54837 nor a local message in the state where a line containing only a dot is a
54843 If a bare CR is encountered within a header line, an extra space is added after
54844 the line terminator so as not to end the header line. The reasoning behind this
54845 is that bare CRs in header lines are most likely either to be mistakes, or
54846 people trying to play silly games.
54851 If the first header line received in a message ends with CRLF, a subsequent
54852 bare LF in a header line is treated in the same way as a bare CR in a header
54858 <section id="SECID218">
54859 <title>Unqualified addresses</title>
54861 <indexterm role="concept">
54862 <primary>unqualified addresses</primary>
54864 <indexterm role="concept">
54865 <primary>address</primary>
54866 <secondary>qualification</secondary>
54868 By default, Exim expects every envelope address it receives from an external
54869 host to be fully qualified. Unqualified addresses cause negative responses to
54870 SMTP commands. However, because SMTP is used as a means of transporting
54871 messages from MUAs running on personal workstations, there is sometimes a
54872 requirement to accept unqualified addresses from specific hosts or IP networks.
54875 Exim has two options that separately control which hosts may send unqualified
54876 sender or recipient addresses in SMTP commands, namely
54877 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
54878 cases, if an unqualified address is accepted, it is qualified by adding the
54879 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
54882 <indexterm role="option">
54883 <primary><option>qualify_domain</option></primary>
54885 <indexterm role="option">
54886 <primary><option>qualify_recipient</option></primary>
54888 Unqualified addresses in header lines are automatically qualified for messages
54889 that are locally originated, unless the <option>-bnq</option> option is given on the command
54890 line. For messages received over SMTP, unqualified addresses in header lines
54891 are qualified only if unqualified addresses are permitted in SMTP commands. In
54892 other words, such qualification is also controlled by
54893 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
54896 <section id="SECID219">
54897 <title>The UUCP From line</title>
54899 <indexterm role="concept">
54900 <primary><quote>From</quote> line</primary>
54902 <indexterm role="concept">
54903 <primary>UUCP</primary>
54904 <secondary><quote>From</quote> line</secondary>
54906 <indexterm role="concept">
54907 <primary>sender</primary>
54908 <secondary>address</secondary>
54910 <indexterm role="option">
54911 <primary><option>uucp_from_pattern</option></primary>
54913 <indexterm role="option">
54914 <primary><option>uucp_from_sender</option></primary>
54916 <indexterm role="concept">
54917 <primary>envelope sender</primary>
54919 <indexterm role="concept">
54920 <primary>Sendmail compatibility</primary>
54921 <secondary><quote>From</quote> line</secondary>
54923 Messages that have come from UUCP (and some other applications) often begin
54924 with a line containing the envelope sender and a timestamp, following the word
54925 <quote>From</quote>. Examples of two common formats are:
54927 <literallayout class="monospaced">
54928 From a.oakley@berlin.mus Fri Jan 5 12:35 GMT 1996
54929 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
54932 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
54933 Exim recognizes such lines at the start of messages that are submitted to it
54934 via the command line (that is, on the standard input). It does not recognize
54935 such lines in incoming SMTP messages, unless the sending host matches
54936 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
54937 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
54938 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
54939 default value matches the two common cases shown above and puts the address
54940 that follows <quote>From</quote> into <varname>$1</varname>.
54943 <indexterm role="concept">
54944 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
54945 <secondary>in <quote>From </quote> line handling</secondary>
54947 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
54948 a trusted user, the message’s sender address is constructed by expanding the
54949 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
54950 then parsed as an RFC 2822 address. If there is no domain, the local part is
54951 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
54952 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
54955 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
54956 sender address is not changed. This is also the case for incoming SMTP messages
54957 that are permitted to contain <quote>From</quote> lines.
54960 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
54961 treated as a data line that starts the body of the message, as it is not valid
54962 as a header line. This also happens if a <quote>From</quote> line is present in an
54963 incoming SMTP message from a source that is not permitted to send them.
54966 <section id="SECID220">
54967 <title>Resent- header lines</title>
54969 <indexterm role="concept">
54970 <primary><option>Resent-</option> header lines</primary>
54972 RFC 2822 makes provision for sets of header lines starting with the string
54973 <literal>Resent-</literal> to be added to a message when it is resent by the original
54974 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
54975 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
54976 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
54980 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
54981 processing of replies or other such automatic actions on messages.</emphasis>
54985 This leaves things a bit vague as far as other processing actions such as
54986 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
54992 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
54993 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
54998 If there’s a rewriting rule for a particular header line, it is also applied to
54999 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
55000 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
55005 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
55011 For a locally-submitted message,
55012 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
55013 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
55014 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
55015 included in log lines in this case.
55020 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
55021 <option>Resent-</option> header lines are present.
55026 <section id="SECID221">
55027 <title>The Auto-Submitted: header line</title>
55029 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
55030 includes the header line:
55032 <literallayout class="monospaced">
55033 Auto-Submitted: auto-replied
55036 <section id="SECID222">
55037 <title>The Bcc: header line</title>
55039 <indexterm role="concept">
55040 <primary><emphasis>Bcc:</emphasis> header line</primary>
55042 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
55043 message’s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
55044 extracting its addresses). If <option>-t</option> is not present on the command line, any
55045 existing <emphasis>Bcc:</emphasis> is not removed.
55048 <section id="SECID223">
55049 <title>The Date: header line</title>
55051 <indexterm role="concept">
55052 <primary><emphasis>Date:</emphasis> header line</primary>
55054 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
55055 Exim adds one, using the current date and time, unless the
55056 <option>suppress_local_fixups</option> control has been specified.
55059 <section id="SECID224">
55060 <title>The Delivery-date: header line</title>
55062 <indexterm role="concept">
55063 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
55065 <indexterm role="option">
55066 <primary><option>delivery_date_remove</option></primary>
55068 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
55069 set. Exim can be configured to add them to the final delivery of messages. (See
55070 the generic <option>delivery_date_add</option> transport option.) They should not be present
55071 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
55072 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
55076 <section id="SECID225">
55077 <title>The Envelope-to: header line</title>
55079 <indexterm role="concept">
55080 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
55082 <indexterm role="option">
55083 <primary><option>envelope_to_remove</option></primary>
55085 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
55086 Exim can be configured to add them to the final delivery of messages. (See the
55087 generic <option>envelope_to_add</option> transport option.) They should not be present in
55088 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
55089 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
55093 <section id="SECTthefrohea">
55094 <title>The From: header line</title>
55096 <indexterm role="concept">
55097 <primary><emphasis>From:</emphasis> header line</primary>
55099 <indexterm role="concept">
55100 <primary>Sendmail compatibility</primary>
55101 <secondary><quote>From</quote> line</secondary>
55103 <indexterm role="concept">
55104 <primary>message</primary>
55105 <secondary>submission</secondary>
55107 <indexterm role="concept">
55108 <primary>submission mode</primary>
55110 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
55111 adds one if either of the following conditions is true:
55116 The envelope sender address is not empty (that is, this is not a bounce
55117 message). The added header line copies the envelope sender address.
55122 <indexterm role="variable">
55123 <primary><varname>$authenticated_id</varname></primary>
55125 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
55127 <orderedlist numeration="arabic">
55130 <indexterm role="variable">
55131 <primary><varname>$qualify_domain</varname></primary>
55133 If no domain is specified by the submission control, the local part is
55134 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
55139 If a non-empty domain is specified by the submission control, the local
55140 part is <varname>$authenticated_id</varname>, and the domain is the specified domain.
55145 If an empty domain is specified by the submission control,
55146 <varname>$authenticated_id</varname> is assumed to be the complete address.
55153 A non-empty envelope sender takes precedence.
55156 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
55157 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
55158 containing the sender’s address. The calling user’s login name and full name
55159 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
55160 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
55161 <option>unknown_login</option> configuration option). The address is qualified with
55162 <option>qualify_domain</option>.
55165 For compatibility with Sendmail, if an incoming, non-SMTP message has a
55166 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
55167 user, this is replaced by an address containing the user’s login name and full
55168 name as described in section <xref linkend="SECTconstr"/>.
55171 <section id="SECID226">
55172 <title>The Message-ID: header line</title>
55174 <indexterm role="concept">
55175 <primary><emphasis>Message-ID:</emphasis> header line</primary>
55177 <indexterm role="concept">
55178 <primary>message</primary>
55179 <secondary>submission</secondary>
55181 <indexterm role="option">
55182 <primary><option>message_id_header_text</option></primary>
55184 If a locally-generated or submission-mode incoming message does not contain a
55185 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
55186 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
55187 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
55188 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim’s internal
55189 message id, preceded by the letter E to ensure it starts with a letter, and
55190 followed by @ and the primary host name. Additional information can be included
55191 in this header line by setting the <option>message_id_header_text</option> and/or
55192 <option>message_id_header_domain</option> options.
55195 <section id="SECID227">
55196 <title>The Received: header line</title>
55198 <indexterm role="concept">
55199 <primary><emphasis>Received:</emphasis> header line</primary>
55201 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
55202 contents are defined by the <option>received_header_text</option> configuration option, and
55203 Exim automatically adds a semicolon and a timestamp to the configured string.
55206 The <emphasis>Received:</emphasis> header is generated as soon as the message’s header lines
55207 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
55208 line is the time that the message started to be received. This is the value
55209 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
55212 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
55213 changed to the time of acceptance, which is (apart from a small delay while the
55214 -H spool file is written) the earliest time at which delivery could start.
55217 <section id="SECID228">
55218 <title>The References: header line</title>
55220 <indexterm role="concept">
55221 <primary><emphasis>References:</emphasis> header line</primary>
55223 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
55224 header line. This is constructed according to the rules that are described in
55225 section 3.64 of RFC 2822 (which states that replies should contain such a
55226 header line), and section 3.14 of RFC 3834 (which states that automatic
55227 responses are not different in this respect). However, because some mail
55228 processing software does not cope well with very long header lines, no more
55229 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
55230 incoming message. If there are more than 12, the first one and then the final
55231 11 are copied, before adding the message ID of the incoming message.
55234 <section id="SECID229">
55235 <title>The Return-path: header line</title>
55237 <indexterm role="concept">
55238 <primary><emphasis>Return-path:</emphasis> header line</primary>
55240 <indexterm role="option">
55241 <primary><option>return_path_remove</option></primary>
55243 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
55244 it does the final delivery of messages. (See the generic <option>return_path_add</option>
55245 transport option.) Therefore, they should not be present in messages in
55246 transit. If the <option>return_path_remove</option> configuration option is set (the
55247 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
55250 <section id="SECTthesenhea">
55251 <title>The Sender: header line</title>
55253 <indexterm role="concept">
55254 <primary><emphasis>Sender:</emphasis> header line</primary>
55256 <indexterm role="concept">
55257 <primary>message</primary>
55258 <secondary>submission</secondary>
55260 For a locally-originated message from an untrusted user, Exim may remove an
55261 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
55262 these actions by setting the <option>local_sender_retain</option> option true, the
55263 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
55267 When a local message is received from an untrusted user and
55268 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
55269 control has not been set, a check is made to see if the address given in the
55270 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
55271 that is expected has the login name as the local part and the value of
55272 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
55273 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
55274 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
55275 line is added to the message.
55278 If you set <option>local_from_check</option> false, this checking does not occur. However,
55279 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
55280 <option>local_sender_retain</option> to be true. It is not possible to set both of these
55281 options true at the same time.
55284 <indexterm role="concept">
55285 <primary>submission mode</primary>
55287 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
55288 received over TCP/IP or for messages submitted by trusted users. However, when
55289 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
55290 not specified on the submission control, the following processing takes place:
55293 <indexterm role="variable">
55294 <primary><varname>$authenticated_id</varname></primary>
55296 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
55297 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
55298 created as follows:
55303 <indexterm role="variable">
55304 <primary><varname>$qualify_domain</varname></primary>
55306 If no domain is specified by the submission control, the local part is
55307 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
55312 If a non-empty domain is specified by the submission control, the local part
55313 is <varname>$authenticated_id</varname>, and the domain is the specified domain.
55318 If an empty domain is specified by the submission control,
55319 <varname>$authenticated_id</varname> is assumed to be the complete address.
55324 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
55325 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
55326 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
55327 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
55330 <indexterm role="concept">
55331 <primary>return path</primary>
55332 <secondary>created from <emphasis>Sender:</emphasis></secondary>
55334 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
55335 the message (the envelope sender address) is changed to be the same address,
55336 except in the case of submission mode when <option>sender_retain</option> is specified.
55339 <section id="SECTheadersaddrem">
55340 <title>Adding and removing header lines in routers and transports</title>
55342 <indexterm role="concept">
55343 <primary>header lines</primary>
55344 <secondary>adding; in router or transport</secondary>
55346 <indexterm role="concept">
55347 <primary>header lines</primary>
55348 <secondary>removing; in router or transport</secondary>
55350 When a message is delivered, the addition and removal of header lines can be
55351 specified in a system filter, or on any of the routers and transports that
55352 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
55353 modifying headers in a system filter. Header lines can also be added in an ACL
55354 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
55357 In contrast to what happens in a system filter, header modifications that are
55358 specified on routers and transports apply only to the particular recipient
55359 addresses that are being processed by those routers and transports. These
55360 changes do not actually take place until a copy of the message is being
55361 transported. Therefore, they do not affect the basic set of header lines, and
55362 they do not affect the values of the variables that refer to header lines.
55365 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
55366 the transport cannot refer to the modified header lines, because such
55367 expansions all occur before the message is actually transported.
55370 For both routers and transports, the result of expanding a <option>headers_add</option>
55371 option must be in the form of one or more RFC 2822 header lines, separated by
55372 newlines (coded as <quote>\n</quote>). For example:
55374 <literallayout class="monospaced">
55375 headers_add = X-added-header: added by $primary_hostname\n\
55376 X-added-second: another added header line
55379 Exim does not check the syntax of these added header lines.
55382 The result of expanding <option>headers_remove</option> must consist of a colon-separated
55383 list of header names. This is confusing, because header names themselves are
55384 often terminated by colons. In this case, the colons are the list separators,
55385 not part of the names. For example:
55387 <literallayout class="monospaced">
55388 headers_remove = return-receipt-to:acknowledge-to
55391 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router, its value
55392 is expanded at routing time, and then associated with all addresses that are
55393 accepted by that router, and also with any new addresses that it generates. If
55394 an address passes through several routers as a result of aliasing or
55395 forwarding, the changes are cumulative.
55398 <indexterm role="option">
55399 <primary><option>unseen</option></primary>
55401 However, this does not apply to multiple routers that result from the use of
55402 the <option>unseen</option> option. Any header modifications that were specified by the
55403 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
55406 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
55407 settings cannot be delivered together in a batch, so a transport is always
55408 dealing with a set of addresses that have the same header-processing
55412 The transport starts by writing the original set of header lines that arrived
55413 with the message, possibly modified by the system filter. As it writes out
55414 these lines, it consults the list of header names that were attached to the
55415 recipient address(es) by <option>headers_remove</option> options in routers, and it also
55416 consults the transport’s own <option>headers_remove</option> option. Header lines whose
55417 names are on either of these lists are not written out. If there are multiple
55418 instances of any listed header, they are all skipped.
55421 After the remaining original header lines have been written, new header
55422 lines that were specified by routers’ <option>headers_add</option> options are written, in
55423 the order in which they were attached to the address. These are followed by any
55424 header lines specified by the transport’s <option>headers_add</option> option.
55427 This way of handling header line modifications in routers and transports has
55428 the following consequences:
55433 The original set of header lines, possibly modified by the system filter,
55434 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
55435 to it, at all times.
55440 Header lines that are added by a router’s
55441 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
55442 expansion syntax in subsequent routers or the transport.
55447 Conversely, header lines that are specified for removal by <option>headers_remove</option>
55448 in a router remain visible to subsequent routers and the transport.
55453 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
55454 a later router or by a transport.
55459 An added header can refer to the contents of an original header that is to be
55460 removed, even it has the same name as the added header. For example:
55462 <literallayout class="monospaced">
55463 headers_remove = subject
55464 headers_add = Subject: new subject (was: $h_subject:)
55469 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
55470 for a <command>redirect</command> router that has the <option>one_time</option> option set.
55473 <section id="SECTconstr">
55474 <title>Constructed addresses</title>
55476 <indexterm role="concept">
55477 <primary>address</primary>
55478 <secondary>constructed</secondary>
55480 <indexterm role="concept">
55481 <primary>constructed address</primary>
55483 When Exim constructs a sender address for a locally-generated message, it uses
55487 <<emphasis>user name</emphasis>> <<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>>
55492 <literallayout class="monospaced">
55493 Zaphod Beeblebrox <zaphod@end.univ.example>
55496 The user name is obtained from the <option>-F</option> command line option if set, or
55497 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
55498 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
55499 ampersand character, this is replaced by the login name with the first letter
55500 upper cased, as is conventional in a number of operating systems. See the
55501 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
55502 The <option>unknown_username</option> option can be used to specify user names in cases when
55503 there is no password file entry.
55506 <indexterm role="concept">
55507 <primary>RFC 2047</primary>
55509 In all cases, the user name is made to conform to RFC 2822 by quoting all or
55510 parts of it if necessary. In addition, if it contains any non-printing
55511 characters, it is encoded as described in RFC 2047, which defines a way of
55512 including non-ASCII characters in header lines. The value of the
55513 <option>headers_charset</option> option specifies the name of the encoding that is used (the
55514 characters are assumed to be in this encoding). The setting of
55515 <option>print_topbitchars</option> controls whether characters with the top bit set (that
55516 is, with codes greater than 127) count as printing characters or not.
55519 <section id="SECID230">
55520 <title>Case of local parts</title>
55522 <indexterm role="concept">
55523 <primary>case of local parts</primary>
55525 <indexterm role="concept">
55526 <primary>local part</primary>
55527 <secondary>case of</secondary>
55529 RFC 2822 states that the case of letters in the local parts of addresses cannot
55530 be assumed to be non-significant. Exim preserves the case of local parts of
55531 addresses, but by default it uses a lower-cased form when it is routing,
55532 because on most Unix systems, usernames are in lower case and case-insensitive
55533 routing is required. However, any particular router can be made to use the
55534 original case for local parts by setting the <option>caseful_local_part</option> generic
55538 <indexterm role="concept">
55539 <primary>mixed-case login names</primary>
55541 If you must have mixed-case user names on your system, the best way to proceed,
55542 assuming you want case-independent handling of incoming email, is to set up
55543 your first router to convert incoming local parts in your domains to the
55544 correct case by means of a file lookup. For example:
55546 <literallayout class="monospaced">
55549 domains = +local_domains
55550 data = ${lookup{$local_part}cdb\
55551 {/etc/usercased.cdb}{$value}fail}\
55555 For this router, the local part is forced to lower case by the default action
55556 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
55557 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
55558 on any subsequent routers which process your domains, they will operate on
55559 local parts with the correct case in a case-sensitive manner.
55562 <section id="SECID231">
55563 <title>Dots in local parts</title>
55565 <indexterm role="concept">
55566 <primary>dot</primary>
55567 <secondary>in local part</secondary>
55569 <indexterm role="concept">
55570 <primary>local part</primary>
55571 <secondary>dots in</secondary>
55573 RFC 2822 forbids empty components in local parts. That is, an unquoted local
55574 part may not begin or end with a dot, nor have two consecutive dots in the
55575 middle. However, it seems that many MTAs do not enforce this, so Exim permits
55576 empty components for compatibility.
55579 <section id="SECID232">
55580 <title>Rewriting addresses</title>
55582 <indexterm role="concept">
55583 <primary>rewriting</primary>
55584 <secondary>addresses</secondary>
55586 Rewriting of sender and recipient addresses, and addresses in headers, can
55587 happen automatically, or as the result of configuration options, as described
55588 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
55589 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
55592 Automatic rewriting includes qualification, as mentioned above. The other case
55593 in which it can happen is when an incomplete non-local domain is given. The
55594 routing process may cause this to be expanded into the full domain name. For
55595 example, a header such as
55597 <literallayout class="monospaced">
55601 might get rewritten as
55603 <literallayout class="monospaced">
55604 To: hare@teaparty.wonderland.fict.example
55607 Rewriting as a result of routing is the one kind of message processing that
55608 does not happen at input time, as it cannot be done until the address has
55612 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
55613 addresses have been routed, in case any of the headers get changed as a
55614 result of routing. However, doing this in practice would hold up many
55615 deliveries for unreasonable amounts of time, just because one address could not
55616 immediately be routed. Exim therefore does not delay other deliveries when
55617 routing of one or more addresses is deferred.
55618 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
55623 <chapter id="CHAPSMTP">
55624 <title>SMTP processing</title>
55626 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
55627 <primary>SMTP</primary>
55628 <secondary>processing details</secondary>
55630 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
55631 <primary>LMTP</primary>
55632 <secondary>processing details</secondary>
55634 Exim supports a number of different ways of using the SMTP protocol, and its
55635 LMTP variant, which is an interactive protocol for transferring messages into a
55636 closed mail store application. This chapter contains details of how SMTP is
55637 processed. For incoming mail, the following are available:
55642 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
55647 SMTP over the standard input and output (the <option>-bs</option> option);
55652 Batched SMTP on the standard input (the <option>-bS</option> option).
55657 For mail delivery, the following are available:
55662 SMTP over TCP/IP (the <command>smtp</command> transport);
55667 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
55668 <quote>lmtp</quote>);
55673 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
55679 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
55680 the <option>use_bsmtp</option> option set).
55685 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
55686 stored in or read from files (or pipes), in a format in which SMTP commands are
55687 used to contain the envelope information.
55689 <section id="SECToutSMTPTCP">
55690 <title>Outgoing SMTP and LMTP over TCP/IP</title>
55692 <indexterm role="concept">
55693 <primary>SMTP</primary>
55694 <secondary>outgoing over TCP/IP</secondary>
55696 <indexterm role="concept">
55697 <primary>outgoing SMTP over TCP/IP</primary>
55699 <indexterm role="concept">
55700 <primary>LMTP</primary>
55701 <secondary>over TCP/IP</secondary>
55703 <indexterm role="concept">
55704 <primary>outgoing LMTP over TCP/IP</primary>
55706 <indexterm role="concept">
55707 <primary>EHLO</primary>
55709 <indexterm role="concept">
55710 <primary>HELO</primary>
55712 <indexterm role="concept">
55713 <primary>SIZE option on MAIL command</primary>
55715 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
55716 The <option>protocol</option> option selects which protocol is to be used, but the actual
55717 processing is the same in both cases.
55720 If, in response to its EHLO command, Exim is told that the SIZE
55721 parameter is supported, it adds SIZE=<<emphasis>n</emphasis>> to each subsequent MAIL
55722 command. The value of <<emphasis>n</emphasis>> is the message size plus the value of the
55723 <option>size_addition</option> option (default 1024) to allow for additions to the message
55724 such as per-transport header lines, or changes made in a
55725 <indexterm role="concept">
55726 <primary>transport</primary>
55727 <secondary>filter</secondary>
55729 <indexterm role="concept">
55730 <primary>filter</primary>
55731 <secondary>transport filter</secondary>
55733 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
55737 If the remote server advertises support for PIPELINING, Exim uses the
55738 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
55739 required for the transaction.
55742 If the remote server advertises support for the STARTTLS command, and Exim
55743 was built to support TLS encryption, it tries to start a TLS session unless the
55744 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
55747 If the remote server advertises support for the AUTH command, Exim scans
55748 the authenticators configuration for any suitable client settings, as described
55749 in chapter <xref linkend="CHAPSMTPAUTH"/>.
55752 <indexterm role="concept">
55753 <primary>carriage return</primary>
55755 <indexterm role="concept">
55756 <primary>linefeed</primary>
55758 Responses from the remote host are supposed to be terminated by CR followed by
55759 LF. However, there are known to be hosts that do not send CR characters, so in
55760 order to be able to interwork with such hosts, Exim treats LF on its own as a
55764 If a message contains a number of different addresses, all those with the same
55765 characteristics (for example, the same envelope sender) that resolve to the
55766 same set of hosts, in the same order, are sent in a single SMTP transaction,
55767 even if they are for different domains, unless there are more than the setting
55768 of the <option>max_rcpts</option> option in the <command>smtp</command> transport allows, in which case
55769 they are split into groups containing no more than <option>max_rcpts</option> addresses
55770 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
55771 in parallel sessions. The order of hosts with identical MX values is not
55772 significant when checking whether addresses can be batched in this way.
55775 When the <command>smtp</command> transport suffers a temporary failure that is not
55776 message-related, Exim updates its transport-specific database, which contains
55777 records indexed by host name that remember which messages are waiting for each
55778 particular host. It also updates the retry database with new retry times.
55781 <indexterm role="concept">
55782 <primary>hints database</primary>
55783 <secondary>retry keys</secondary>
55785 Exim’s retry hints are based on host name plus IP address, so if one address of
55786 a multi-homed host is broken, it will soon be skipped most of the time.
55787 See the next section for more detail about error handling.
55790 <indexterm role="concept">
55791 <primary>SMTP</primary>
55792 <secondary>passed connection</secondary>
55794 <indexterm role="concept">
55795 <primary>SMTP</primary>
55796 <secondary>batching over TCP/IP</secondary>
55798 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
55799 looks in the hints database for the transport to see if there are any queued
55800 messages waiting for the host to which it is connected. If it finds one, it
55801 creates a new Exim process using the <option>-MC</option> option (which can only be used by
55802 a process running as root or the Exim user) and passes the TCP/IP socket to it
55803 so that it can deliver another message using the same socket. The new process
55804 does only those deliveries that are routed to the connected host, and may in
55805 turn pass the socket on to a third process, and so on.
55808 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
55809 limit the number of messages sent down a single TCP/IP connection.
55812 <indexterm role="concept">
55813 <primary>asterisk</primary>
55814 <secondary>after IP address</secondary>
55816 The second and subsequent messages delivered down an existing connection are
55817 identified in the main log by the addition of an asterisk after the closing
55818 square bracket of the IP address.
55821 <section id="SECToutSMTPerr">
55822 <title>Errors in outgoing SMTP</title>
55824 <indexterm role="concept">
55825 <primary>error</primary>
55826 <secondary>in outgoing SMTP</secondary>
55828 <indexterm role="concept">
55829 <primary>SMTP</primary>
55830 <secondary>errors in outgoing</secondary>
55832 <indexterm role="concept">
55833 <primary>host</primary>
55834 <secondary>error</secondary>
55836 Three different kinds of error are recognized for outgoing SMTP: host errors,
55837 message errors, and recipient errors.
55841 <term><emphasis role="bold">Host errors</emphasis></term>
55844 A host error is not associated with a particular message or with a
55845 particular recipient of a message. The host errors are:
55850 Connection refused or timed out,
55855 Any error response code on connection,
55860 Any error response code to EHLO or HELO,
55865 Loss of connection at any time, except after <quote>.</quote>,
55870 I/O errors at any time,
55875 Timeouts during the session, other than in response to MAIL, RCPT or
55876 the <quote>.</quote> at the end of the data.
55881 For a host error, a permanent error response on connection, or in response to
55882 EHLO, causes all addresses routed to the host to be failed. Any other host
55883 error causes all addresses to be deferred, and retry data to be created for the
55884 host. It is not tried again, for any message, until its retry time arrives. If
55885 the current set of addresses are not all delivered in this run (to some
55886 alternative host), the message is added to the list of those waiting for this
55887 host, so if it is still undelivered when a subsequent successful delivery is
55888 made to the host, it will be sent down the same SMTP connection.
55890 </listitem></varlistentry>
55892 <term><emphasis role="bold">Message errors</emphasis></term>
55895 <indexterm role="concept">
55896 <primary>message</primary>
55897 <secondary>error</secondary>
55899 A message error is associated with a particular message when sent to a
55900 particular host, but not with a particular recipient of the message. The
55901 message errors are:
55906 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
55912 Timeout after MAIL,
55917 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
55918 timeout after the DATA command itself is treated as a host error, as is loss of
55919 connection at any other time.
55924 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
55925 to be failed, and a delivery error report to be returned to the sender. A
55926 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
55927 addresses to be deferred. Retry data is not created for the host, but instead,
55928 a retry record for the combination of host plus message id is created. The
55929 message is not added to the list of those waiting for this host. This ensures
55930 that the failing message will not be sent to this host again until the retry
55931 time arrives. However, other messages that are routed to the host are not
55932 affected, so if it is some property of the message that is causing the error,
55933 it will not stop the delivery of other mail.
55936 If the remote host specified support for the SIZE parameter in its response
55937 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
55938 over-large message will cause a message error because the error arrives as a
55941 </listitem></varlistentry>
55943 <term><emphasis role="bold">Recipient errors</emphasis></term>
55946 <indexterm role="concept">
55947 <primary>recipient</primary>
55948 <secondary>error</secondary>
55950 A recipient error is associated with a particular recipient of a message. The
55951 recipient errors are:
55956 Any error response to RCPT,
55961 Timeout after RCPT.
55966 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
55967 recipient address to be failed, and a bounce message to be returned to the
55968 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
55969 address to be deferred, and routing retry data to be created for it. This is
55970 used to delay processing of the address in subsequent queue runs, until its
55971 routing retry time arrives. This applies to all messages, but because it
55972 operates only in queue runs, one attempt will be made to deliver a new message
55973 to the failing address before the delay starts to operate. This ensures that,
55974 if the failure is really related to the message rather than the recipient
55975 (<quote>message too big for this recipient</quote> is a possible example), other messages
55976 have a chance of getting delivered. If a delivery to the address does succeed,
55977 the retry information gets cleared, so all stuck messages get tried again, and
55978 the retry clock is reset.
55981 The message is not added to the list of those waiting for this host. Use of the
55982 host for other messages is unaffected, and except in the case of a timeout,
55983 other recipients are processed independently, and may be successfully delivered
55984 in the current SMTP session. After a timeout it is of course impossible to
55985 proceed with the session, so all addresses get deferred. However, those other
55986 than the one that failed do not suffer any subsequent retry delays. Therefore,
55987 if one recipient is causing trouble, the others have a chance of getting
55988 through when a subsequent delivery attempt occurs before the failing
55989 recipient’s retry time.
55991 </listitem></varlistentry>
55994 In all cases, if there are other hosts (or IP addresses) available for the
55995 current set of addresses (for example, from multiple MX records), they are
55996 tried in this run for any undelivered addresses, subject of course to their
55997 own retry data. In other words, recipient error retry data does not take effect
55998 until the next delivery attempt.
56001 Some hosts have been observed to give temporary error responses to every
56002 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
56003 would be nice if such circumstances could be recognized, and defer data for the
56004 host itself created, but this is not possible within the current Exim design.
56005 What actually happens is that retry data for every (host, message) combination
56009 The reason that timeouts after MAIL and RCPT are treated specially is that
56010 these can sometimes arise as a result of the remote host’s verification
56011 procedures. Exim makes this assumption, and treats them as if a temporary error
56012 response had been received. A timeout after <quote>.</quote> is treated specially because
56013 it is known that some broken implementations fail to recognize the end of the
56014 message if the last character of the last line is a binary zero. Thus, it is
56015 helpful to treat this case as a message error.
56018 Timeouts at other times are treated as host errors, assuming a problem with the
56019 host, or the connection to it. If a timeout after MAIL, RCPT,
56020 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
56021 the timeout is likely to occur at some other point in the dialogue, causing it
56022 then to be treated as a host error.
56025 There is experimental evidence that some MTAs drop the connection after the
56026 terminating <quote>.</quote> if they do not like the contents of the message for some
56027 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
56028 should be given. That is why Exim treats this case as a message rather than a
56029 host error, in order not to delay other messages to the same host.
56032 <section id="SECID233">
56033 <title>Incoming SMTP messages over TCP/IP</title>
56035 <indexterm role="concept">
56036 <primary>SMTP</primary>
56037 <secondary>incoming over TCP/IP</secondary>
56039 <indexterm role="concept">
56040 <primary>incoming SMTP over TCP/IP</primary>
56042 <indexterm role="concept">
56043 <primary>inetd</primary>
56045 <indexterm role="concept">
56046 <primary>daemon</primary>
56048 Incoming SMTP messages can be accepted in one of two ways: by running a
56049 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
56050 <filename>/etc/inetd.conf</filename> should be like this:
56052 <literallayout class="monospaced">
56053 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
56056 Exim distinguishes between this case and the case of a locally running user
56057 agent using the <option>-bs</option> option by checking whether or not the standard input is
56058 a socket. When it is, either the port must be privileged (less than 1024), or
56059 the caller must be root or the Exim user. If any other user passes a socket
56060 with an unprivileged port number, Exim prints a message on the standard error
56061 stream and exits with an error code.
56064 By default, Exim does not make a log entry when a remote host connects or
56065 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
56066 unexpected. It can be made to write such log entries by setting the
56067 <option>smtp_connection</option> log selector.
56070 <indexterm role="concept">
56071 <primary>carriage return</primary>
56073 <indexterm role="concept">
56074 <primary>linefeed</primary>
56076 Commands from the remote host are supposed to be terminated by CR followed by
56077 LF. However, there are known to be hosts that do not send CR characters. In
56078 order to be able to interwork with such hosts, Exim treats LF on its own as a
56080 Furthermore, because common code is used for receiving messages from all
56081 sources, a CR on its own is also interpreted as a line terminator. However, the
56082 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
56085 <indexterm role="concept">
56086 <primary>EHLO</primary>
56087 <secondary>invalid data</secondary>
56089 <indexterm role="concept">
56090 <primary>HELO</primary>
56091 <secondary>invalid data</secondary>
56093 One area that sometimes gives rise to problems concerns the EHLO or
56094 HELO commands. Some clients send syntactically invalid versions of these
56095 commands, which Exim rejects by default. (This is nothing to do with verifying
56096 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
56097 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
56098 match the broken hosts that send invalid commands.
56101 <indexterm role="concept">
56102 <primary>SIZE option on MAIL command</primary>
56104 <indexterm role="concept">
56105 <primary>MAIL</primary>
56106 <secondary>SIZE option</secondary>
56108 The amount of disk space available is checked whenever SIZE is received on
56109 a MAIL command, independently of whether <option>message_size_limit</option> or
56110 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
56111 false. A temporary error is given if there is not enough space. If
56112 <option>check_spool_space</option> is set, the check is for that amount of space plus the
56113 value given with SIZE, that is, it checks that the addition of the incoming
56114 message will not reduce the space below the threshold.
56117 When a message is successfully received, Exim includes the local message id in
56118 its response to the final <quote>.</quote> that terminates the data. If the remote host
56119 logs this text it can help with tracing what has happened to a message.
56122 The Exim daemon can limit the number of simultaneous incoming connections it is
56123 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
56124 number of simultaneous incoming connections from a single remote host (see the
56125 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
56126 rejected using the SMTP temporary error code 421.
56129 The Exim daemon does not rely on the SIGCHLD signal to detect when a
56130 subprocess has finished, as this can get lost at busy times. Instead, it looks
56131 for completed subprocesses every time it wakes up. Provided there are other
56132 things happening (new incoming calls, starts of queue runs), completed
56133 processes will be noticed and tidied away. On very quiet systems you may
56134 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
56135 it will be noticed when the daemon next wakes up.
56138 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
56139 and can also be set up to reject SMTP calls from non-reserved hosts at times of
56140 high system load – for details see the <option>smtp_accept_reserve</option>,
56141 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
56142 applies in both the daemon and <emphasis>inetd</emphasis> cases.
56145 Exim normally starts a delivery process for each message received, though this
56146 can be varied by means of the <option>-odq</option> command line option and the
56147 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
56148 number of simultaneously running delivery processes started in this way from
56149 SMTP input can be limited by the <option>smtp_accept_queue</option> and
56150 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
56151 subsequently received messages are just put on the input queue without starting
56152 a delivery process.
56155 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
56156 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
56157 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
56158 handled by an entirely independent Exim process. Control by load average is,
56159 however, available with <emphasis>inetd</emphasis>.
56162 Exim can be configured to verify addresses in incoming SMTP commands as they
56163 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
56164 to rewrite addresses at this time – before any syntax checking is done. See
56165 section <xref linkend="SECTrewriteS"/>.
56168 Exim can also be configured to limit the rate at which a client host submits
56169 MAIL and RCPT commands in a single SMTP session. See the
56170 <option>smtp_ratelimit_hosts</option> option.
56173 <section id="SECID234">
56174 <title>Unrecognized SMTP commands</title>
56176 <indexterm role="concept">
56177 <primary>SMTP</primary>
56178 <secondary>unrecognized commands</secondary>
56180 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
56181 commands during a single SMTP connection, it drops the connection after sending
56182 the error response to the last command. The default value for
56183 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
56184 abuse that subvert web servers into making connections to SMTP ports; in these
56185 circumstances, a number of non-SMTP lines are sent first.
56188 <section id="SECID235">
56189 <title>Syntax and protocol errors in SMTP commands</title>
56191 <indexterm role="concept">
56192 <primary>SMTP</primary>
56193 <secondary>syntax errors</secondary>
56195 <indexterm role="concept">
56196 <primary>SMTP</primary>
56197 <secondary>protocol errors</secondary>
56199 A syntax error is detected if an SMTP command is recognized, but there is
56200 something syntactically wrong with its data, for example, a malformed email
56201 address in a RCPT command. Protocol errors include invalid command
56202 sequencing such as RCPT before MAIL. If Exim receives more than
56203 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
56204 drops the connection after sending the error response to the last command. The
56205 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
56206 broken clients that loop sending bad commands (yes, it has been seen).
56209 <section id="SECID236">
56210 <title>Use of non-mail SMTP commands</title>
56212 <indexterm role="concept">
56213 <primary>SMTP</primary>
56214 <secondary>non-mail commands</secondary>
56216 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
56217 DATA. Exim counts such commands, and drops the connection if there are too
56218 many of them in a single SMTP session. This action catches some
56219 denial-of-service attempts and things like repeated failing AUTHs, or a mad
56220 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
56221 defines what <quote>too many</quote> means. Its default value is 10.
56224 When a new message is expected, one occurrence of RSET is not counted. This
56225 allows a client to send one RSET between messages (this is not necessary,
56226 but some clients do it). Exim also allows one uncounted occurrence of HELO
56227 or EHLO, and one occurrence of STARTTLS between messages. After
56228 starting up a TLS session, another EHLO is expected, and so it too is not
56232 The first occurrence of AUTH in a connection, or immediately following
56233 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
56234 RCPT, DATA, and QUIT are counted.
56237 You can control which hosts are subject to the limit set by
56238 <option>smtp_accept_max_nonmail</option> by setting
56239 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
56240 the limit apply to all hosts. This option means that you can exclude any
56241 specific badly-behaved hosts that you have to live with.
56244 <section id="SECID237">
56245 <title>The VRFY and EXPN commands</title>
56247 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
56248 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
56249 appropriate) in order to decide whether the command should be accepted or not.
56250 If no ACL is defined, the command is rejected.
56253 <indexterm role="concept">
56254 <primary>VRFY</primary>
56255 <secondary>processing</secondary>
56257 When VRFY is accepted, it runs exactly the same code as when Exim is
56258 called with the <option>-bv</option> option.
56261 <indexterm role="concept">
56262 <primary>EXPN</primary>
56263 <secondary>processing</secondary>
56265 When EXPN is accepted, a single-level expansion of the address is done.
56266 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
56267 than a verification (the <option>-bv</option> option). If an unqualified local part is given
56268 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
56269 of VRFY and EXPN commands are logged on the main and reject logs, and
56270 VRFY verification failures are logged on the main log for consistency with
56274 <section id="SECTETRN">
56275 <title>The ETRN command</title>
56277 <indexterm role="concept">
56278 <primary>ETRN</primary>
56279 <secondary>processing</secondary>
56281 RFC 1985 describes an SMTP command called ETRN that is designed to
56282 overcome the security problems of the TURN command (which has fallen into
56283 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
56284 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
56285 should be accepted or not. If no ACL is defined, the command is rejected.
56288 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
56289 delivery to certain hosts. As Exim does not organize its message queue by host,
56290 the only form of ETRN that is supported by default is the one where the
56291 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
56292 specific to the SMTP server. A valid ETRN command causes a run of Exim with
56293 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
56294 argument. For example,
56296 <literallayout class="monospaced">
56302 <literallayout class="monospaced">
56306 which causes a delivery attempt on all messages with undelivered addresses
56307 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
56308 default), Exim prevents the simultaneous execution of more than one queue run
56309 for the same argument string as a result of an ETRN command. This stops
56310 a misbehaving client from starting more than one queue runner at once.
56313 <indexterm role="concept">
56314 <primary>hints database</primary>
56315 <secondary>ETRN serialization</secondary>
56317 Exim implements the serialization by means of a hints database in which a
56318 record is written whenever a process is started by ETRN, and deleted when
56319 the process completes. However, Exim does not keep the SMTP session waiting for
56320 the ETRN process to complete. Once ETRN is accepted, the client is sent
56321 a <quote>success</quote> return code. Obviously there is scope for hints records to get
56322 left lying around if there is a system or program crash. To guard against this,
56323 Exim ignores any records that are more than six hours old.
56326 <indexterm role="option">
56327 <primary><option>smtp_etrn_command</option></primary>
56329 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
56330 used. This specifies a command that is run whenever ETRN is received,
56331 whatever the form of its argument. For
56334 <literallayout class="monospaced">
56335 smtp_etrn_command = /etc/etrn_command $domain \
56336 $sender_host_address
56339 <indexterm role="variable">
56340 <primary><varname>$domain</varname></primary>
56342 The string is split up into arguments which are independently expanded. The
56343 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
56344 and no syntax checking is done on the contents of this argument. Exim does not
56345 wait for the command to complete, so its status code is not checked. Exim runs
56346 under its own uid and gid when receiving incoming SMTP, so it is not possible
56347 for it to change them before running the command.
56350 <section id="SECID238">
56351 <title>Incoming local SMTP</title>
56353 <indexterm role="concept">
56354 <primary>SMTP</primary>
56355 <secondary>local incoming</secondary>
56357 Some user agents use SMTP to pass messages to their local MTA using the
56358 standard input and output, as opposed to passing the envelope on the command
56359 line and writing the message to the standard input. This is supported by the
56360 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
56361 messages over TCP/IP (including the use of ACLs), except that the envelope
56362 sender given in a MAIL command is ignored unless the caller is trusted. In
56363 an ACL you can detect this form of SMTP input by testing for an empty host
56364 identification. It is common to have this as the first line in the ACL that
56365 runs for RCPT commands:
56367 <literallayout class="monospaced">
56371 This accepts SMTP messages from local processes without doing any other tests.
56374 <section id="SECTbatchSMTP">
56375 <title>Outgoing batched SMTP</title>
56377 <indexterm role="concept">
56378 <primary>SMTP</primary>
56379 <secondary>batched outgoing</secondary>
56381 <indexterm role="concept">
56382 <primary>batched SMTP output</primary>
56384 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
56385 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
56386 be output in BSMTP format. No SMTP responses are possible for this form of
56387 delivery. All it is doing is using SMTP commands as a way of transmitting the
56388 envelope along with the message.
56391 The message is written to the file or pipe preceded by the SMTP commands
56392 MAIL and RCPT, and followed by a line containing a single dot. Lines in
56393 the message that start with a dot have an extra dot added. The SMTP command
56394 HELO is not normally used. If it is required, the <option>message_prefix</option> option
56395 can be used to specify it.
56398 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
56399 one recipient address at a time by default. However, you can arrange for them
56400 to handle several addresses at once by setting the <option>batch_max</option> option. When
56401 this is done for BSMTP, messages may contain multiple RCPT commands. See
56402 chapter <xref linkend="CHAPbatching"/> for more details.
56405 <indexterm role="variable">
56406 <primary><varname>$host</varname></primary>
56408 When one or more addresses are routed to a BSMTP transport by a router that
56409 sets up a host list, the name of the first host on the list is available to the
56410 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
56413 <literallayout class="monospaced">
56416 driver = manualroute
56417 transport = smtp_appendfile
56418 route_list = domain.example batch.host.example
56422 driver = appendfile
56423 directory = /var/bsmtp/$host
56429 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
56430 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
56431 message (unless there are more than 1000 recipients).
56434 <section id="SECTincomingbatchedSMTP">
56435 <title>Incoming batched SMTP</title>
56437 <indexterm role="concept">
56438 <primary>SMTP</primary>
56439 <secondary>batched incoming</secondary>
56441 <indexterm role="concept">
56442 <primary>batched SMTP input</primary>
56444 The <option>-bS</option> command line option causes Exim to accept one or more messages by
56445 reading SMTP on the standard input, but to generate no responses. If the caller
56446 is trusted, the senders in the MAIL commands are believed; otherwise the
56447 sender is always the caller of Exim. Unqualified senders and receivers are not
56448 rejected (there seems little point) but instead just get qualified. HELO
56449 and EHLO act as RSET; VRFY, EXPN, ETRN and HELP, act
56450 as NOOP; QUIT quits.
56453 No policy checking is done for BSMTP input. That is, no ACL is run at anytime.
56454 In this respect it is like non-SMTP local input.
56457 If an error is detected while reading a message, including a missing <quote>.</quote> at
56458 the end, Exim gives up immediately. It writes details of the error to the
56459 standard output in a stylized way that the calling program should be able to
56460 make some use of automatically, for example:
56462 <literallayout class="monospaced">
56463 554 Unexpected end of file
56464 Transaction started in line 10
56465 Error detected in line 14
56468 It writes a more verbose version, for human consumption, to the standard error
56471 <literallayout class="monospaced">
56472 An error was detected while processing a file of BSMTP input.
56473 The error message was:
56475 501 '>' missing at end of address
56477 The SMTP transaction started in line 10.
56478 The error was detected in line 12.
56479 The SMTP command at fault was:
56481 rcpt to:<malformed@in.com.plete
56483 1 previous message was successfully processed.
56484 The rest of the batch was abandoned.
56487 The return code from Exim is zero only if there were no errors. It is 1 if some
56488 messages were accepted before an error was detected, and 2 if no messages were
56490 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
56491 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
56496 <chapter id="CHAPemsgcust">
56497 <title>Customizing bounce and warning messages</title>
56498 <titleabbrev>Customizing messages</titleabbrev>
56500 When a message fails to be delivered, or remains on the queue for more than a
56501 configured amount of time, Exim sends a message to the original sender, or
56502 to an alternative configured address. The text of these messages is built into
56503 the code of Exim, but it is possible to change it, either by adding a single
56504 string, or by replacing each of the paragraphs by text supplied in a file.
56507 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
56508 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
56509 option. Exim also adds the line
56511 <literallayout class="monospaced">
56512 Auto-Submitted: auto-generated
56515 to all warning and bounce messages,
56517 <section id="SECID239">
56518 <title>Customizing bounce messages</title>
56520 <indexterm role="concept">
56521 <primary>customizing</primary>
56522 <secondary>bounce message</secondary>
56524 <indexterm role="concept">
56525 <primary>bounce message</primary>
56526 <secondary>customizing</secondary>
56528 If <option>bounce_message_text</option> is set, its contents are included in the default
56529 message immediately after <quote>This message was created automatically by mail
56530 delivery software.</quote> The string is not expanded. It is not used if
56531 <option>bounce_message_file</option> is set.
56534 When <option>bounce_message_file</option> is set, it must point to a template file for
56535 constructing error messages. The file consists of a series of text items,
56536 separated by lines consisting of exactly four asterisks. If the file cannot be
56537 opened, default text is used and a message is written to the main and panic
56538 logs. If any text item in the file is empty, default text is used for that
56542 <indexterm role="variable">
56543 <primary><varname>$bounce_recipient</varname></primary>
56545 <indexterm role="variable">
56546 <primary><varname>$bounce_return_size_limit</varname></primary>
56548 Each item of text that is read from the file is expanded, and there are two
56549 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
56550 the recipient of an error message while it is being created, and
56551 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
56552 option, rounded to a whole number.
56555 The items must appear in the file in the following order:
56560 The first item is included in the headers, and should include at least a
56561 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
56566 The second item forms the start of the error message. After it, Exim lists the
56567 failing addresses with their error messages.
56572 The third item is used to introduce any text from pipe transports that is to be
56573 returned to the sender. It is omitted if there is no such text.
56578 The fourth item is used to introduce the copy of the message that is returned
56579 as part of the error report.
56584 The fifth item is added after the fourth one if the returned message is
56585 truncated because it is bigger than <option>return_size_limit</option>.
56590 The sixth item is added after the copy of the original message.
56595 The default state (<option>bounce_message_file</option> unset) is equivalent to the
56596 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
56597 other lines have been split in order to fit them on the page:
56599 <literallayout class="monospaced">
56600 Subject: Mail delivery failed
56601 ${if eq{$sender_address}{$bounce_recipient}
56602 {: returning message to sender}}
56604 This message was created automatically by mail delivery software.
56606 A message ${if eq{$sender_address}{$bounce_recipient}
56607 {that you sent }{sent by
56609 <$sender_address>
56611 }}could not be delivered to all of its recipients.
56612 This is a permanent error. The following address(es) failed:
56614 The following text was generated during the delivery attempt(s):
56616 ------ This is a copy of the message, including all the headers.
56619 ------ The body of the message is $message_size characters long;
56621 ------ $bounce_return_size_limit or so are included here.
56625 <section id="SECTcustwarn">
56626 <title>Customizing warning messages</title>
56628 <indexterm role="concept">
56629 <primary>customizing</primary>
56630 <secondary>warning message</secondary>
56632 <indexterm role="concept">
56633 <primary>warning of delay</primary>
56634 <secondary>customizing the message</secondary>
56636 The option <option>warn_message_file</option> can be pointed at a template file for use when
56637 warnings about message delays are created. In this case there are only three
56643 The first item is included in the headers, and should include at least a
56644 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
56649 The second item forms the start of the warning message. After it, Exim lists
56650 the delayed addresses.
56655 The third item then ends the message.
56660 The default state is equivalent to the following file, except that some lines
56661 have been split here, in order to fit them on the page:
56663 <literallayout class="monospaced">
56664 Subject: Warning: message $message_exim_id delayed
56665 $warn_message_delay
56667 This message was created automatically by mail delivery software.
56669 A message ${if eq{$sender_address}{$warn_message_recipients}
56670 {that you sent }{sent by
56672 <$sender_address>
56674 }}has not been delivered to all of its recipients after
56675 more than $warn_message_delay on the queue on $primary_hostname.
56677 The message identifier is: $message_exim_id
56678 The subject of the message is: $h_subject
56679 The date of the message is: $h_date
56681 The following address(es) have not yet been delivered:
56683 No action is required on your part. Delivery attempts will
56684 continue for some time, and this warning may be repeated at
56685 intervals if the message remains undelivered. Eventually the
56686 mail delivery software will give up, and when that happens,
56687 the message will be returned to you.
56690 <indexterm role="variable">
56691 <primary><varname>$warn_message_delay</varname></primary>
56693 <indexterm role="variable">
56694 <primary><varname>$warn_message_recipients</varname></primary>
56696 However, in the default state the subject and date lines are omitted if no
56697 appropriate headers exist. During the expansion of this file,
56698 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote><<emphasis>n</emphasis>>
56699 minutes</quote> or <quote><<emphasis>n</emphasis>> hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
56700 of recipients for the warning message. There may be more than one if there are
56701 multiple addresses with different <option>errors_to</option> settings on the routers that
56707 <chapter id="CHAPcomconreq">
56708 <title>Some common configuration settings</title>
56710 This chapter discusses some configuration settings that seem to be fairly
56711 common. More examples and discussion can be found in the Exim book.
56713 <section id="SECID240">
56714 <title>Sending mail to a smart host</title>
56716 <indexterm role="concept">
56717 <primary>smart host</primary>
56718 <secondary>example router</secondary>
56720 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
56721 should replace the default <command>dnslookup</command> router with a router which does the
56722 routing explicitly:
56724 <literallayout class="monospaced">
56725 send_to_smart_host:
56726 driver = manualroute
56727 route_list = !+local_domains smart.host.name
56728 transport = remote_smtp
56731 You can use the smart host’s IP address instead of the name if you wish.
56732 If you are using Exim only to submit messages to a smart host, and not for
56733 receiving incoming messages, you can arrange for it to do the submission
56734 synchronously by setting the <option>mua_wrapper</option> option (see chapter
56735 <xref linkend="CHAPnonqueueing"/>).
56738 <section id="SECTmailinglists">
56739 <title>Using Exim to handle mailing lists</title>
56741 <indexterm role="concept">
56742 <primary>mailing lists</primary>
56744 Exim can be used to run simple mailing lists, but for large and/or complicated
56745 requirements, the use of additional specialized mailing list software such as
56746 Majordomo or Mailman is recommended.
56749 The <command>redirect</command> router can be used to handle mailing lists where each list
56750 is maintained in a separate file, which can therefore be managed by an
56751 independent manager. The <option>domains</option> router option can be used to run these
56752 lists in a separate domain from normal mail. For example:
56754 <literallayout class="monospaced">
56757 domains = lists.example
56758 file = /usr/lists/$local_part
56761 errors_to = $local_part-request@lists.example
56765 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
56766 in that domain, it looks for a file that matches the local part. If there is no
56767 such file, the router declines, but because <option>no_more</option> is set, no subsequent
56768 routers are tried, and so the whole delivery fails.
56771 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
56772 expanded into a file name or a pipe delivery, which is usually inappropriate in
56776 <indexterm role="option">
56777 <primary><option>errors_to</option></primary>
56779 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
56780 taken from a mailing list are to be sent to the given address rather than the
56781 original sender of the message. However, before acting on this, Exim verifies
56782 the error address, and ignores it if verification fails.
56785 For example, using the configuration above, mail sent to
56786 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
56787 <filename>/usr/lists/dicts</filename>, with error reports directed to
56788 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
56789 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
56790 the address(es) of this particular list’s manager(s), but other approaches,
56791 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
56792 or <option>local_part_suffix</option> options) to handle addresses of the form
56793 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
56796 <section id="SECID241">
56797 <title>Syntax errors in mailing lists</title>
56799 <indexterm role="concept">
56800 <primary>mailing lists</primary>
56801 <secondary>syntax errors in</secondary>
56803 If an entry in redirection data contains a syntax error, Exim normally defers
56804 delivery of the original address. That means that a syntax error in a mailing
56805 list holds up all deliveries to the list. This may not be appropriate when a
56806 list is being maintained automatically from data supplied by users, and the
56807 addresses are not rigorously checked.
56810 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
56811 entries that fail to parse, noting the incident in the log. If in addition
56812 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
56813 whenever a broken address is skipped. It is usually appropriate to set
56814 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
56817 <section id="SECID242">
56818 <title>Re-expansion of mailing lists</title>
56820 <indexterm role="concept">
56821 <primary>mailing lists</primary>
56822 <secondary>re-expansion of</secondary>
56824 Exim remembers every individual address to which a message has been delivered,
56825 in order to avoid duplication, but it normally stores only the original
56826 recipient addresses with a message. If all the deliveries to a mailing list
56827 cannot be done at the first attempt, the mailing list is re-expanded when the
56828 delivery is next tried. This means that alterations to the list are taken into
56829 account at each delivery attempt, so addresses that have been added to
56830 the list since the message arrived will therefore receive a copy of the
56831 message, even though it pre-dates their subscription.
56834 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
56835 on the <command>redirect</command> router. If this is done, any addresses generated by the
56836 router that fail to deliver at the first attempt are added to the message as
56837 <quote>top level</quote> addresses, and the parent address that generated them is marked
56838 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
56839 subsequent delivery attempts. The disadvantage of this is that if any of the
56840 failing addresses are incorrect, correcting them in the file has no effect on
56841 pre-existing messages.
56844 The original top-level address is remembered with each of the generated
56845 addresses, and is output in any log messages. However, any intermediate parent
56846 addresses are not recorded. This makes a difference to the log only if the
56847 <option>all_parents</option> selector is set, but for mailing lists there is normally only
56848 one level of expansion anyway.
56851 <section id="SECID243">
56852 <title>Closed mailing lists</title>
56854 <indexterm role="concept">
56855 <primary>mailing lists</primary>
56856 <secondary>closed</secondary>
56858 The examples so far have assumed open mailing lists, to which anybody may
56859 send mail. It is also possible to set up closed lists, where mail is accepted
56860 from specified senders only. This is done by making use of the generic
56861 <option>senders</option> option to restrict the router that handles the list.
56864 The following example uses the same file as a list of recipients and as a list
56865 of permitted senders. It requires three routers:
56867 <literallayout class="monospaced">
56870 domains = lists.example
56871 local_part_suffix = -request
56872 file = /usr/lists/$local_part$local_part_suffix
56877 domains = lists.example
56878 senders = ${if exists {/usr/lists/$local_part}\
56879 {lsearch;/usr/lists/$local_part}{*}}
56880 file = /usr/lists/$local_part
56883 errors_to = $local_part-request@lists.example
56888 domains = lists.example
56890 data = :fail: $local_part@lists.example is a closed mailing list
56893 All three routers have the same <option>domains</option> setting, so for any other domains,
56894 they are all skipped. The first router runs only if the local part ends in
56895 <option>-request</option>. It handles messages to the list manager(s) by means of an open
56899 The second router runs only if the <option>senders</option> precondition is satisfied. It
56900 checks for the existence of a list that corresponds to the local part, and then
56901 checks that the sender is on the list by means of a linear search. It is
56902 necessary to check for the existence of the file before trying to search it,
56903 because otherwise Exim thinks there is a configuration error. If the file does
56904 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
56905 means that the router runs, but because there is no list, declines, and
56906 <option>no_more</option> ensures that no further routers are run. The address fails with an
56907 <quote>unrouteable address</quote> error.
56910 The third router runs only if the second router is skipped, which happens when
56911 a mailing list exists, but the sender is not on it. This router forcibly fails
56912 the address, giving a suitable error message.
56915 <section id="SECTverp">
56916 <title>Variable Envelope Return Paths (VERP)</title>
56918 <indexterm role="concept">
56919 <primary>VERP</primary>
56921 <indexterm role="concept">
56922 <primary>Variable Envelope Return Paths</primary>
56924 <indexterm role="concept">
56925 <primary>envelope sender</primary>
56927 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> –
56928 are a way of helping mailing list administrators discover which subscription
56929 address is the cause of a particular delivery failure. The idea is to encode
56930 the original recipient address in the outgoing envelope sender address, so that
56931 if the message is forwarded by another host and then subsequently bounces, the
56932 original recipient can be extracted from the recipient address of the bounce.
56935 <indexterm role="option">
56936 <primary><option>errors_to</option></primary>
56938 <indexterm role="option">
56939 <primary><option>return_path</option></primary>
56941 Envelope sender addresses can be modified by Exim using two different
56942 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
56943 list examples), or the <option>return_path</option> option on a transport. The second of
56944 these is effective only if the message is successfully delivered to another
56945 host; it is not used for errors detected on the local host (see the description
56946 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
56947 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
56949 <literallayout class="monospaced">
56954 ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
56955 {$1-request+$local_part=$domain@your.dom.example}fail}
56958 This has the effect of rewriting the return path (envelope sender) on outgoing
56959 SMTP messages, if the local part of the original return path ends in
56960 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
56961 local part and domain of the recipient into the return path. Suppose, for
56962 example, that a message whose return path has been set to
56963 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
56964 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
56967 <literallayout class="monospaced">
56968 somelist-request+subscriber=other.dom.example@your.dom.example
56971 <indexterm role="variable">
56972 <primary><varname>$local_part</varname></primary>
56974 For this to work, you must tell Exim to send multiple copies of messages that
56975 have more than one recipient, so that each copy has just one recipient. This is
56976 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
56977 might be sent to several different recipients in the same domain, in which case
56978 <varname>$local_part</varname> is not available in the transport, because it is not unique.
56981 Unless your host is doing nothing but mailing list deliveries, you should
56982 probably use a separate transport for the VERP deliveries, so as not to use
56983 extra resources in making one-per-recipient copies for other deliveries. This
56984 can easily be done by expanding the <option>transport</option> option in the router:
56986 <literallayout class="monospaced">
56989 domains = ! +local_domains
56991 ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
56992 {verp_smtp}{remote_smtp}}
56996 If you want to change the return path using <option>errors_to</option> in a router instead
56997 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
56998 routers that handle mailing list addresses. This will ensure that all delivery
56999 errors, including those detected on the local host, are sent to the VERP
57003 On a host that does no local deliveries and has no manual routing, only the
57004 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
57005 SMTP deliveries. Every mailing list recipient has its own return path value,
57006 and so Exim must hand them to the transport one at a time. Here is an example
57007 of a <command>dnslookup</command> router that implements VERP:
57009 <literallayout class="monospaced">
57012 domains = ! +local_domains
57013 transport = remote_smtp
57015 ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
57016 {$1-request+$local_part=$domain@your.dom.example}fail}
57020 Before you start sending out messages with VERPed return paths, you must also
57021 configure Exim to accept the bounce messages that come back to those paths.
57022 Typically this is done by setting a <option>local_part_suffix</option> option for a
57023 router, and using this to route the messages to wherever you want to handle
57027 The overhead incurred in using VERP depends very much on the size of the
57028 message, the number of recipient addresses that resolve to the same remote
57029 host, and the speed of the connection over which the message is being sent. If
57030 a lot of addresses resolve to the same host and the connection is slow, sending
57031 a separate copy of the message for each address may take substantially longer
57032 than sending a single copy with many recipients (for which VERP cannot be
57036 <section id="SECTvirtualdomains">
57037 <title>Virtual domains</title>
57039 <indexterm role="concept">
57040 <primary>virtual domains</primary>
57042 <indexterm role="concept">
57043 <primary>domain</primary>
57044 <secondary>virtual</secondary>
57046 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
57052 A domain for which there are no real mailboxes; all valid local parts are
57053 aliases for other email addresses. Common examples are organizational
57054 top-level domains and <quote>vanity</quote> domains.
57059 One of a number of independent domains that are all handled by the same host,
57060 with mailboxes on that host, but where the mailbox owners do not necessarily
57061 have login accounts on that host.
57066 The first usage is probably more common, and does seem more <quote>virtual</quote> than
57067 the second. This kind of domain can be handled in Exim with a straightforward
57068 aliasing router. One approach is to create a separate alias file for each
57069 virtual domain. Exim can test for the existence of the alias file to determine
57070 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
57071 to a router of this form:
57073 <literallayout class="monospaced">
57076 domains = dsearch;/etc/mail/virtual
57077 data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain}}
57081 The <option>domains</option> option specifies that the router is to be skipped, unless there
57082 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
57083 domain that is being processed. When the router runs, it looks up the local
57084 part in the file to find a new address (or list of addresses). The <option>no_more</option>
57085 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
57086 string), Exim gives up on the address without trying any subsequent routers.
57089 This one router can handle all the virtual domains because the alias file names
57090 follow a fixed pattern. Permissions can be arranged so that appropriate people
57091 can edit the different alias files. A successful aliasing operation results in
57092 a new envelope recipient address, which is then routed from scratch.
57095 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
57096 way. One approach is to create a file for each domain containing a list of
57097 valid local parts, and use it in a router like this:
57099 <literallayout class="monospaced">
57102 domains = dsearch;/etc/mail/domains
57103 local_parts = lsearch;/etc/mail/domains/$domain
57104 transport = my_mailboxes
57107 The address is accepted if there is a file for the domain, and the local part
57108 can be found in the file. The <option>domains</option> option is used to check for the
57109 file’s existence because <option>domains</option> is tested before the <option>local_parts</option>
57110 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
57111 because that option is tested after <option>local_parts</option>. The transport is as
57114 <literallayout class="monospaced">
57116 driver = appendfile
57117 file = /var/mail/$domain/$local_part
57121 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
57122 required, to specify which uid is to be used for writing to the mailboxes.
57125 The configuration shown here is just one example of how you might support this
57126 requirement. There are many other ways this kind of configuration can be set
57127 up, for example, by using a database instead of separate files to hold all the
57128 information about the domains.
57131 <section id="SECTmulbox">
57132 <title>Multiple user mailboxes</title>
57134 <indexterm role="concept">
57135 <primary>multiple mailboxes</primary>
57137 <indexterm role="concept">
57138 <primary>mailbox</primary>
57139 <secondary>multiple</secondary>
57141 <indexterm role="concept">
57142 <primary>local part</primary>
57143 <secondary>prefix</secondary>
57145 <indexterm role="concept">
57146 <primary>local part</primary>
57147 <secondary>suffix</secondary>
57149 Heavy email users often want to operate with multiple mailboxes, into which
57150 incoming mail is automatically sorted. A popular way of handling this is to
57151 allow users to use multiple sender addresses, so that replies can easily be
57152 identified. Users are permitted to add prefixes or suffixes to their local
57153 parts for this purpose. The wildcard facility of the generic router options
57154 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
57155 example, consider this router:
57157 <literallayout class="monospaced">
57161 file = $home/.forward
57162 local_part_suffix = -*
57163 local_part_suffix_optional
57167 <indexterm role="variable">
57168 <primary><varname>$local_part_suffix</varname></primary>
57170 It runs a user’s <filename>.forward</filename> file for all local parts of the form
57171 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
57172 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
57174 <literallayout class="monospaced">
57175 if $local_part_suffix contains -special then
57176 save /home/$local_part/Mail/special
57180 If the filter file does not exist, or does not deal with such addresses, they
57181 fall through to subsequent routers, and, assuming no subsequent use of the
57182 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
57183 control over which suffixes are valid.
57186 Alternatively, a suffix can be used to trigger the use of a different
57187 <filename>.forward</filename> file – which is the way a similar facility is implemented in
57190 <literallayout class="monospaced">
57194 file = $home/.forward$local_part_suffix
57195 local_part_suffix = -*
57196 local_part_suffix_optional
57200 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
57201 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
57202 does not exist, or does not deal with the address, it is passed on to
57203 subsequent routers, which could, if required, look for an unqualified
57204 <filename>.forward</filename> file to use as a default.
57207 <section id="SECID244">
57208 <title>Simplified vacation processing</title>
57210 <indexterm role="concept">
57211 <primary>vacation processing</primary>
57213 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
57214 a pipe command in a <filename>.forward</filename> file
57215 (see section <xref linkend="SECTspecitredli"/> for syntax details).
57216 This is prone to error by inexperienced users. There are two features of Exim
57217 that can be used to make this process simpler for users:
57222 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
57223 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
57224 alternatively can use Exim’s <command>autoreply</command> transport. The contents of a user’s
57225 <filename>.forward</filename> file are then much simpler. For example:
57227 <literallayout class="monospaced">
57228 spqr, vacation-spqr
57233 The <option>require_files</option> generic router option can be used to trigger a
57234 vacation delivery by checking for the existence of a certain file in the
57235 user’s home directory. The <option>unseen</option> generic option should also be used, to
57236 ensure that the original delivery also proceeds. In this case, all the user has
57237 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
57243 Another advantage of both these methods is that they both work even when the
57244 use of arbitrary pipes by users is locked out.
57247 <section id="SECID245">
57248 <title>Taking copies of mail</title>
57250 <indexterm role="concept">
57251 <primary>message</primary>
57252 <secondary>copying every</secondary>
57254 Some installations have policies that require archive copies of all messages to
57255 be made. A single copy of each message can easily be taken by an appropriate
57256 command in a system filter, which could, for example, use a different file for
57257 each day’s messages.
57260 There is also a shadow transport mechanism that can be used to take copies of
57261 messages that are successfully delivered by local transports, one copy per
57262 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
57263 notification of delivery by sites that insist on doing such things.
57266 <section id="SECID246">
57267 <title>Intermittently connected hosts</title>
57269 <indexterm role="concept">
57270 <primary>intermittently connected hosts</primary>
57272 It has become quite common (because it is cheaper) for hosts to connect to the
57273 Internet periodically rather than remain connected all the time. The normal
57274 arrangement is that mail for such hosts accumulates on a system that is
57275 permanently connected.
57278 Exim was designed for use on permanently connected hosts, and so it is not
57279 particularly well-suited to use in an intermittently connected environment.
57280 Nevertheless there are some features that can be used.
57283 <section id="SECID247">
57284 <title>Exim on the upstream server host</title>
57286 It is tempting to arrange for incoming mail for the intermittently connected
57287 host to remain on Exim’s queue until the client connects. However, this
57288 approach does not scale very well. Two different kinds of waiting message are
57289 being mixed up in the same queue – those that cannot be delivered because of
57290 some temporary problem, and those that are waiting for their destination host
57291 to connect. This makes it hard to manage the queue, as well as wasting
57292 resources, because each queue runner scans the entire queue.
57295 A better approach is to separate off those messages that are waiting for an
57296 intermittently connected host. This can be done by delivering these messages
57297 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
57298 format, from where they are transmitted by other software when their
57299 destination connects. This makes it easy to collect all the mail for one host
57300 in a single directory, and to apply local timeout rules on a per-message basis
57304 On a very small scale, leaving the mail on Exim’s queue can be made to work. If
57305 you are doing this, you should configure Exim with a long retry period for the
57306 intermittent host. For example:
57308 <literallayout class="monospaced">
57309 cheshire.wonderland.fict.example * F,5d,24h
57312 This stops a lot of failed delivery attempts from occurring, but Exim remembers
57313 which messages it has queued up for that host. Once the intermittent host comes
57314 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
57315 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
57316 causes all the queued up messages to be delivered, often down a single SMTP
57317 connection. While the host remains connected, any new messages get delivered
57321 If the connecting hosts do not have fixed IP addresses, that is, if a host is
57322 issued with a different IP address each time it connects, Exim’s retry
57323 mechanisms on the holding host get confused, because the IP address is normally
57324 used as part of the key string for holding retry information. This can be
57325 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
57326 Since this has disadvantages for permanently connected hosts, it is best to
57327 arrange a separate transport for the intermittently connected ones.
57330 <section id="SECID248">
57331 <title>Exim on the intermittently connected client host</title>
57333 The value of <option>smtp_accept_queue_per_connection</option> should probably be
57334 increased, or even set to zero (that is, disabled) on the intermittently
57335 connected host, so that all incoming messages down a single connection get
57336 delivered immediately.
57339 <indexterm role="concept">
57340 <primary>SMTP</primary>
57341 <secondary>passed connection</secondary>
57343 <indexterm role="concept">
57344 <primary>SMTP</primary>
57345 <secondary>multiple deliveries</secondary>
57347 <indexterm role="concept">
57348 <primary>multiple SMTP deliveries</primary>
57350 Mail waiting to be sent from an intermittently connected host will probably
57351 not have been routed, because without a connection DNS lookups are not
57352 possible. This means that if a normal queue run is done at connection time,
57353 each message is likely to be sent in a separate SMTP session. This can be
57354 avoided by starting the queue run with a command line option beginning with
57355 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
57356 first pass, routing is done but no deliveries take place. The second pass is a
57357 normal queue run; since all the messages have been previously routed, those
57358 destined for the same host are likely to get sent as multiple deliveries in a
57359 single SMTP connection.
57364 <chapter id="CHAPnonqueueing">
57365 <title>Using Exim as a non-queueing client</title>
57366 <titleabbrev>Exim as a non-queueing client</titleabbrev>
57368 <indexterm role="concept">
57369 <primary>client, non-queueing</primary>
57371 <indexterm role="concept">
57372 <primary>smart host</primary>
57373 <secondary>suppressing queueing</secondary>
57375 On a personal computer, it is a common requirement for all
57376 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
57377 configured to operate that way, for all the popular operating systems.
57378 However, there are some MUAs for Unix-like systems that cannot be so
57379 configured: they submit messages using the command line interface of
57380 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
57384 If the personal computer runs continuously, there is no problem, because it can
57385 run a conventional MTA that handles delivery to the smart host, and deal with
57386 any delays via its queueing mechanism. However, if the computer does not run
57387 continuously or runs different operating systems at different times, queueing
57388 email is not desirable.
57391 There is therefore a requirement for something that can provide the
57392 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
57393 any queueing or retrying facilities. Furthermore, the delivery to the smart
57394 host should be synchronous, so that if it fails, the sending MUA is immediately
57395 informed. In other words, we want something that extends an MUA that submits
57396 to a local MTA via the command line so that it behaves like one that submits
57397 to a remote smart host using TCP/SMTP.
57400 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
57401 that do this job. However, people have found them to be lacking in various
57402 ways. For instance, you might want to allow aliasing and forwarding to be done
57403 before sending a message to the smart host.
57406 Exim already had the necessary infrastructure for doing this job. Just a few
57407 tweaks were needed to make it behave as required, though it is somewhat of an
57408 overkill to use a fully-featured MTA for this purpose.
57411 <indexterm role="option">
57412 <primary><option>mua_wrapper</option></primary>
57414 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
57415 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
57416 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
57417 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
57418 compatible router and transport configuration. Typically there will be just one
57419 router and one transport, sending everything to a smart host.
57422 When run in MUA wrapping mode, the behaviour of Exim changes in the
57428 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
57429 In other words, the only way to submit messages is via the command line.
57434 Each message is synchronously delivered as soon as it is received (<option>-odi</option> is
57435 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
57436 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
57437 does not finish until the delivery attempt is complete. If the delivery is
57438 successful, a zero return code is given.
57443 Address redirection is permitted, but the final routing for all addresses must
57444 be to the same remote transport, and to the same list of hosts. Furthermore,
57445 the return address (envelope sender) must be the same for all recipients, as
57446 must any added or deleted header lines. In other words, it must be possible to
57447 deliver the message in a single SMTP transaction, however many recipients there
57453 If these conditions are not met, or if routing any address results in a
57454 failure or defer status, or if Exim is unable to deliver all the recipients
57455 successfully to one of the smart hosts, delivery of the entire message fails.
57460 Because no queueing is allowed, all failures are treated as permanent; there
57461 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
57462 smart host. Furthermore, because only a single yes/no response can be given to
57463 the caller, it is not possible to deliver to some recipients and not others. If
57464 there is an error (temporary or permanent) for any recipient, all are failed.
57469 If more than one smart host is listed, Exim will try another host after a
57470 connection failure or a timeout, in the normal way. However, if this kind of
57471 failure happens for all the hosts, the delivery fails.
57476 When delivery fails, an error message is written to the standard error stream
57477 (as well as to Exim’s log), and Exim exits to the caller with a return code
57478 value 1. The message is expunged from Exim’s spool files. No bounce messages
57479 are ever generated.
57484 No retry data is maintained, and any retry rules are ignored.
57489 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
57490 true, <option>max_rcpt</option> in the <command>smtp</command> transport is forced to <quote>unlimited</quote>,
57491 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
57496 The overall effect is that Exim makes a single synchronous attempt to deliver
57497 the message, failing if there is any kind of problem. Because no local
57498 deliveries are done and no daemon can be run, Exim does not need root
57499 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
57500 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
57501 the advantages and disadvantages of running without root privilege.
57505 <chapter id="CHAPlog">
57506 <title>Log files</title>
57508 <indexterm role="concept" id="IIDloggen" class="startofrange">
57509 <primary>log</primary>
57510 <secondary>general description</secondary>
57512 <indexterm role="concept">
57513 <primary>log</primary>
57514 <secondary>types of</secondary>
57516 Exim writes three different logs, referred to as the main log, the reject log,
57522 <indexterm role="concept">
57523 <primary>main log</primary>
57525 The main log records the arrival of each message and each delivery in a single
57526 line in each case. The format is as compact as possible, in an attempt to keep
57527 down the size of log files. Two-character flag sequences make it easy to pick
57528 out these lines. A number of other events are recorded in the main log. Some of
57529 them are optional, in which case the <option>log_selector</option> option controls whether
57530 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
57531 analysis of main log files, is provided in the Exim distribution (see section
57532 <xref linkend="SECTmailstat"/>).
57537 <indexterm role="concept">
57538 <primary>reject log</primary>
57540 The reject log records information from messages that are rejected as a result
57541 of a configuration option (that is, for policy reasons).
57542 The first line of each rejection is a copy of the line that is also written to
57543 the main log. Then, if the message’s header has been read at the time the log
57544 is written, its contents are written to this log. Only the original header
57545 lines are available; header lines added by ACLs are not logged. You can use the
57546 reject log to check that your policy controls are working correctly; on a busy
57547 host this may be easier than scanning the main log for rejection messages. You
57548 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
57554 <indexterm role="concept">
57555 <primary>panic log</primary>
57557 <indexterm role="concept">
57558 <primary>system log</primary>
57560 When certain serious errors occur, Exim writes entries to its panic log. If the
57561 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
57562 are usually written to the main log as well, but can get lost amid the mass of
57563 other entries. The panic log should be empty under normal circumstances. It is
57564 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
57565 regularly, in order to become aware of any problems. When Exim cannot open its
57566 panic log, it tries as a last resort to write to the system log (syslog). This
57567 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
57568 message itself is written at priority LOG_CRIT.
57573 Every log line starts with a timestamp, in the format shown in the following
57574 example. Note that many of the examples shown in this chapter are line-wrapped.
57575 In the log file, this would be all on one line:
57577 <literallayout class="monospaced">
57578 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
57582 By default, the timestamps are in the local timezone. There are two
57583 ways of changing this:
57588 You can set the <option>timezone</option> option to a different time zone; in particular, if
57591 <literallayout class="monospaced">
57595 the timestamps will be in UTC (aka GMT).
57600 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
57603 <literallayout class="monospaced">
57604 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
57609 <indexterm role="concept">
57610 <primary>log</primary>
57611 <secondary>process ids in</secondary>
57613 <indexterm role="concept">
57614 <primary>pid (process id)</primary>
57615 <secondary>in log lines</secondary>
57617 Exim does not include its process id in log lines by default, but you can
57618 request that it does so by specifying the <literal>pid</literal> log selector (see section
57619 <xref linkend="SECTlogselector"/>). When this is set, the process id is output, in square
57620 brackets, immediately after the time and date.
57622 <section id="SECTwhelogwri">
57623 <title>Where the logs are written</title>
57625 <indexterm role="concept">
57626 <primary>log</primary>
57627 <secondary>destination</secondary>
57629 <indexterm role="concept">
57630 <primary>log</primary>
57631 <secondary>to file</secondary>
57633 <indexterm role="concept">
57634 <primary>log</primary>
57635 <secondary>to syslog</secondary>
57637 <indexterm role="concept">
57638 <primary>syslog</primary>
57640 The logs may be written to local files, or to syslog, or both. However, it
57641 should be noted that many syslog implementations use UDP as a transport, and
57642 are therefore unreliable in the sense that messages are not guaranteed to
57643 arrive at the loghost, nor is the ordering of messages necessarily maintained.
57644 It has also been reported that on large log files (tens of megabytes) you may
57645 need to tweak syslog to prevent it syncing the file with each write – on
57646 Linux this has been seen to make syslog take 90% plus of CPU time.
57649 The destination for Exim’s logs is configured by setting LOG_FILE_PATH in
57650 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the run time
57651 configuration. This latter string is expanded, so it can contain, for example,
57652 references to the host name:
57654 <literallayout class="monospaced">
57655 log_file_path = /var/log/$primary_hostname/exim_%slog
57658 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
57659 rather than at run time, because then the setting is available right from the
57660 start of Exim’s execution. Otherwise, if there’s something it wants to log
57661 before it has read the configuration file (for example, an error in the
57662 configuration file) it will not use the path you want, and may not be able to
57666 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
57667 list, currently limited to at most two items. This is one option where the
57668 facility for changing a list separator may not be used. The list must always be
57669 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
57670 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
57671 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
57672 implying the use of a default path.
57675 When Exim encounters an empty item in the list, it searches the list defined by
57676 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
57677 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
57678 mean <quote>use the path specified at build time</quote>. It no such item exists, log
57679 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
57680 equivalent to the setting:
57682 <literallayout class="monospaced">
57683 log_file_path = $spool_directory/log/%slog
57686 If you do not specify anything at build time or run time, that is where the
57690 A log file path may also contain <literal>%D</literal> if datestamped log file names are in
57691 use – see section <xref linkend="SECTdatlogfil"/> below.
57694 Here are some examples of possible settings:
57697 <literal>LOG_FILE_PATH=syslog </literal> syslog only
57698 <literal>LOG_FILE_PATH=:syslog </literal> syslog and default path
57699 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
57700 <literal>LOG_FILE_PATH=/usr/log/exim_%s </literal> specified path only
57703 If there are more than two paths in the list, the first is used and a panic
57707 <section id="SECID285">
57708 <title>Logging to local files that are periodically <quote>cycled</quote></title>
57710 <indexterm role="concept">
57711 <primary>log</primary>
57712 <secondary>cycling local files</secondary>
57714 <indexterm role="concept">
57715 <primary>cycling logs</primary>
57717 <indexterm role="concept">
57718 <primary><emphasis>exicyclog</emphasis></primary>
57720 <indexterm role="concept">
57721 <primary>log</primary>
57722 <secondary>local files; writing to</secondary>
57724 Some operating systems provide centralized and standardized methods for cycling
57725 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
57726 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
57727 main and reject logs each time it is called. The maximum number of old logs to
57728 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
57731 An Exim delivery process opens the main log when it first needs to write to it,
57732 and it keeps the file open in case subsequent entries are required – for
57733 example, if a number of different deliveries are being done for the same
57734 message. However, remote SMTP deliveries can take a long time, and this means
57735 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
57736 something similar is being used to rename log files on a regular basis. To
57737 ensure that a switch of log files is noticed as soon as possible, Exim calls
57738 <function>stat()</function> on the main log’s name before reusing an open file, and if the file
57739 does not exist, or its inode has changed, the old file is closed and Exim
57740 tries to open the main log from scratch. Thus, an old log file may remain open
57741 for quite some time, but no Exim processes should write to it once it has been
57745 <section id="SECTdatlogfil">
57746 <title>Datestamped log files</title>
57748 <indexterm role="concept">
57749 <primary>log</primary>
57750 <secondary>datestamped files</secondary>
57752 Instead of cycling the main and reject log files by renaming them
57753 periodically, some sites like to use files whose names contain a datestamp,
57754 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename>.
57755 Exim has support for this way of working. It is enabled by setting the
57756 <option>log_file_path</option> option to a path that includes <literal>%D</literal> at the point where the
57757 datestamp is required. For example:
57759 <literallayout class="monospaced">
57760 log_file_path = /var/spool/exim/log/%slog-%D
57761 log_file_path = /var/log/exim-%s-%D.log
57762 log_file_path = /var/spool/exim/log/%D-%slog
57765 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
57766 examples of names generated by the above examples:
57768 <literallayout class="monospaced">
57769 /var/spool/exim/log/mainlog-20021225
57770 /var/log/exim-reject-20021225.log
57771 /var/spool/exim/log/20021225-mainlog
57774 When this form of log file is specified, Exim automatically switches to new
57775 files at midnight. It does not make any attempt to compress old logs; you
57776 will need to write your own script if you require this. You should not
57777 run <emphasis>exicyclog</emphasis> with this form of logging.
57780 The location of the panic log is also determined by <option>log_file_path</option>, but it
57781 is not datestamped, because rotation of the panic log does not make sense.
57782 When generating the name of the panic log, <literal>%D</literal> is removed from the string.
57783 In addition, if it immediately follows a slash, a following non-alphanumeric
57784 character is removed; otherwise a preceding non-alphanumeric character is
57785 removed. Thus, the three examples above would give these panic log names:
57787 <literallayout class="monospaced">
57788 /var/spool/exim/log/paniclog
57789 /var/log/exim-panic.log
57790 /var/spool/exim/log/paniclog
57793 <section id="SECID249">
57794 <title>Logging to syslog</title>
57796 <indexterm role="concept">
57797 <primary>log</primary>
57798 <secondary>syslog; writing to</secondary>
57800 The use of syslog does not change what Exim logs or the format of its messages,
57801 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
57802 Exim’s log lines are omitted when these lines are sent to syslog. Apart from
57803 that, the same strings are written to syslog as to log files. The syslog
57804 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
57805 by default, but you can change these by setting the <option>syslog_facility</option> and
57806 <option>syslog_processname</option> options, respectively. If Exim was compiled with
57807 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
57808 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
57809 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
57810 the time and host name to each line.
57811 The three log streams are mapped onto syslog priorities as follows:
57816 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
57821 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
57826 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
57831 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
57832 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
57833 these are routed by syslog to the same place. You can suppress this duplication
57834 by setting <option>syslog_duplication</option> false.
57837 Exim’s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
57838 entries contain multiple lines when headers are included. To cope with both
57839 these cases, entries written to syslog are split into separate <function>syslog()</function>
57840 calls at each internal newline, and also after a maximum of
57841 870 data characters. (This allows for a total syslog line length of 1024, when
57842 additions such as timestamps are added.) If you are running a syslog
57843 replacement that can handle lines longer than the 1024 characters allowed by
57844 RFC 3164, you should set
57846 <literallayout class="monospaced">
57847 SYSLOG_LONG_LINES=yes
57850 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
57851 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
57854 To make it easy to re-assemble split lines later, each component of a split
57855 entry starts with a string of the form [<<emphasis>n</emphasis>>/<<emphasis>m</emphasis>>] or [<<emphasis>n</emphasis>>\<<emphasis>m</emphasis>>]
57856 where <<emphasis>n</emphasis>> is the component number and <<emphasis>m</emphasis>> is the total number of
57857 components in the entry. The / delimiter is used when the line was split
57858 because it was too long; if it was split because of an internal newline, the \
57859 delimiter is used. For example, supposing the length limit to be 50 instead of
57860 870, the following would be the result of a typical rejection message to
57861 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
57862 name, and pid as added by syslog:
57864 <literallayout class="monospaced">
57865 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
57866 [2/5] [127.0.0.1] (ph10): syntax error in 'From' header
57867 [3/5] when scanning for sender: missing or malformed lo
57868 [4/5] cal part in "<>" (envelope sender is <ph10@cam.exa
57872 The same error might cause the following lines to be written to <quote>rejectlog</quote>
57875 <literallayout class="monospaced">
57876 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
57877 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
57878 [3/18] er when scanning for sender: missing or malformed
57879 [4/18] local part in "<>" (envelope sender is <ph10@cam
57880 [5\18] .example>)
57881 [6\18] Recipients: ph10@some.domain.cam.example
57882 [7\18] P Received: from [127.0.0.1] (ident=ph10)
57883 [8\18] by xxxxx.cam.example with smtp (Exim 4.00)
57884 [9\18] id 16RdAL-0006pc-00
57885 [10/18] for ph10@cam.example; Mon, 16 Sep 2002 16:
57886 [11\18] 09:43 +0100
57887 [12\18] F From: <>
57888 [13\18] Subject: this is a test header
57889 [18\18] X-something: this is another header
57890 [15/18] I Message-Id: <E16RdAL-0006pc-00@xxxxx.cam.examp
57893 [18/18] Date: Mon, 16 Sep 2002 16:09:43 +0100
57896 Log lines that are neither too long nor contain newlines are written to syslog
57897 without modification.
57900 If only syslog is being used, the Exim monitor is unable to provide a log tail
57901 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
57902 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
57906 <section id="SECID250">
57907 <title>Log line flags</title>
57909 One line is written to the main log for each message received, and for each
57910 successful, unsuccessful, and delayed delivery. These lines can readily be
57911 picked out by the distinctive two-character flags that immediately follow the
57912 timestamp. The flags are:
57915 <literal><=</literal> message arrival
57916 <literal>=></literal> normal message delivery
57917 <literal>-></literal> additional address in same delivery
57918 <literal>*></literal> delivery suppressed by <option>-N</option>
57919 <literal>**</literal> delivery failed; address bounced
57920 <literal>==</literal> delivery deferred; temporary problem
57923 <section id="SECID251">
57924 <title>Logging message reception</title>
57926 <indexterm role="concept">
57927 <primary>log</primary>
57928 <secondary>reception line</secondary>
57930 The format of the single-line entry in the main log that is written for every
57931 message received is shown in the basic example below, which is split over
57932 several lines in order to fit it on the page:
57934 <literallayout class="monospaced">
57935 2002-10-31 08:57:53 16ZCW1-0005MB-00 <= kryten@dwarf.fict.example
57936 H=mailer.fict.example [192.168.123.123] U=exim
57937 P=smtp S=5678 id=<incoming message id>
57940 The address immediately following <quote><=</quote> is the envelope sender address. A
57941 bounce message is shown with the sender address <quote><></quote>, and if it is locally
57942 generated, this is followed by an item of the form
57944 <literallayout class="monospaced">
57945 R=<message id>
57948 which is a reference to the message that caused the bounce to be sent.
57951 <indexterm role="concept">
57952 <primary>HELO</primary>
57954 <indexterm role="concept">
57955 <primary>EHLO</primary>
57957 For messages from other hosts, the H and U fields identify the remote host and
57958 record the RFC 1413 identity of the user that sent the message, if one was
57959 received. The number given in square brackets is the IP address of the sending
57960 host. If there is a single, unparenthesized host name in the H field, as
57961 above, it has been verified to correspond to the IP address (see the
57962 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
57963 by the remote host in the SMTP HELO or EHLO command, and has not been
57964 verified. If verification yields a different name to that given for HELO or
57965 EHLO, the verified name appears first, followed by the HELO or EHLO
57966 name in parentheses.
57969 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
57970 without brackets, in the HELO or EHLO command, leading to entries in
57971 the log containing text like these examples:
57973 <literallayout class="monospaced">
57974 H=(10.21.32.43) [192.168.8.34]
57975 H=([10.21.32.43]) [192.168.8.34]
57978 This can be confusing. Only the final address in square brackets can be relied
57982 For locally generated messages (that is, messages not received over TCP/IP),
57983 the H field is omitted, and the U field contains the login name of the caller
57987 <indexterm role="concept">
57988 <primary>authentication</primary>
57989 <secondary>logging</secondary>
57991 <indexterm role="concept">
57992 <primary>AUTH</primary>
57993 <secondary>logging</secondary>
57995 For all messages, the P field specifies the protocol used to receive the
57996 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
57997 of incoming SMTP messages, the value indicates whether or not any SMTP
57998 extensions (ESMTP), encryption, or authentication were used. If the SMTP
57999 session was encrypted, there is an additional X field that records the cipher
58000 suite that was used.
58003 The protocol is set to <quote>esmtpsa</quote> or <quote>esmtpa</quote> for messages received from
58004 hosts that have authenticated themselves using the SMTP AUTH command. The first
58005 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
58006 there is an additional item A= followed by the name of the authenticator that
58007 was used. If an authenticated identification was set up by the authenticator’s
58008 <option>server_set_id</option> option, this is logged too, separated by a colon from the
58009 authenticator name.
58012 <indexterm role="concept">
58013 <primary>size</primary>
58014 <secondary>of message</secondary>
58016 The id field records the existing message id, if present. The size of the
58017 received message is given by the S field. When the message is delivered,
58018 headers may be removed or added, so that the size of delivered copies of the
58019 message may not correspond with this value (and indeed may be different to each
58023 The <option>log_selector</option> option can be used to request the logging of additional
58024 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
58027 <section id="SECID252">
58028 <title>Logging deliveries</title>
58030 <indexterm role="concept">
58031 <primary>log</primary>
58032 <secondary>delivery line</secondary>
58034 The format of the single-line entry in the main log that is written for every
58035 delivery is shown in one of the examples below, for local and remote
58036 deliveries, respectively. Each example has been split into two lines in order
58037 to fit it on the page:
58039 <literallayout class="monospaced">
58040 2002-10-31 08:59:13 16ZCW1-0005MB-00 => marv
58041 <marv@hitch.fict.example> R=localuser T=local_delivery
58042 2002-10-31 09:00:10 16ZCW1-0005MB-00 =>
58043 monk@holistic.fict.example R=dnslookup T=remote_smtp
58044 H=holistic.fict.example [192.168.234.234]
58047 For ordinary local deliveries, the original address is given in angle brackets
58048 after the final delivery address, which might be a pipe or a file. If
58049 intermediate address(es) exist between the original and the final address, the
58050 last of these is given in parentheses after the final address. The R and T
58051 fields record the router and transport that were used to process the address.
58054 If a shadow transport was run after a successful local delivery, the log line
58055 for the successful delivery has an item added on the end, of the form
58058 <literal>ST=<</literal><emphasis>shadow transport name</emphasis><literal>></literal>
58061 If the shadow transport did not succeed, the error message is put in
58062 parentheses afterwards.
58065 <indexterm role="concept">
58066 <primary>asterisk</primary>
58067 <secondary>after IP address</secondary>
58069 When more than one address is included in a single delivery (for example, two
58070 SMTP RCPT commands in one transaction) the second and subsequent addresses are
58071 flagged with <literal>-></literal> instead of <literal>=></literal>. When two or more messages are delivered
58072 down a single SMTP connection, an asterisk follows the IP address in the log
58073 lines for the second and subsequent messages.
58076 The generation of a reply message by a filter file gets logged as a
58077 <quote>delivery</quote> to the addressee, preceded by <quote>></quote>.
58080 The <option>log_selector</option> option can be used to request the logging of additional
58081 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
58084 <section id="SECID253">
58085 <title>Discarded deliveries</title>
58087 <indexterm role="concept">
58088 <primary>discarded messages</primary>
58090 <indexterm role="concept">
58091 <primary>message</primary>
58092 <secondary>discarded</secondary>
58094 <indexterm role="concept">
58095 <primary>delivery</primary>
58096 <secondary>discarded; logging</secondary>
58098 When a message is discarded as a result of the command <quote>seen finish</quote> being
58099 obeyed in a filter file which generates no deliveries, a log entry of the form
58101 <literallayout class="monospaced">
58102 2002-12-10 00:50:49 16auJc-0001UB-00 => discarded
58103 <low.club@bridge.example> R=userforward
58106 is written, to record why no deliveries are logged. When a message is discarded
58107 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
58109 <literallayout class="monospaced">
58110 1999-03-02 09:44:33 10HmaX-0005vi-00 => :blackhole:
58111 <hole@nowhere.example> R=blackhole_router
58114 <section id="SECID254">
58115 <title>Deferred deliveries</title>
58117 When a delivery is deferred, a line of the following form is logged:
58119 <literallayout class="monospaced">
58120 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
58121 R=dnslookup T=smtp defer (146): Connection refused
58124 In the case of remote deliveries, the error is the one that was given for the
58125 last IP address that was tried. Details of individual SMTP failures are also
58126 written to the log, so the above line would be preceded by something like
58128 <literallayout class="monospaced">
58129 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
58130 mail1.endrest.example [192.168.239.239]: Connection refused
58133 When a deferred address is skipped because its retry time has not been reached,
58134 a message is written to the log, but this can be suppressed by setting an
58135 appropriate value in <option>log_selector</option>.
58138 <section id="SECID255">
58139 <title>Delivery failures</title>
58141 <indexterm role="concept">
58142 <primary>delivery</primary>
58143 <secondary>failure; logging</secondary>
58145 If a delivery fails because an address cannot be routed, a line of the
58146 following form is logged:
58148 <literallayout class="monospaced">
58149 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
58150 <jim@trek99.example>: unknown mail domain
58153 If a delivery fails at transport time, the router and transport are shown, and
58154 the response from the remote host is included, as in this example:
58156 <literallayout class="monospaced">
58157 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
58158 R=dnslookup T=remote_smtp: SMTP error from remote mailer
58159 after pipelined RCPT TO:<ace400@pb.example>: host
58160 pbmail3.py.example [192.168.63.111]: 553 5.3.0
58161 <ace400@pb.example>...Addressee unknown
58164 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
58165 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
58166 disabling PIPELINING. The log lines for all forms of delivery failure are
58167 flagged with <literal>**</literal>.
58170 <section id="SECID256">
58171 <title>Fake deliveries</title>
58173 <indexterm role="concept">
58174 <primary>delivery</primary>
58175 <secondary>fake; logging</secondary>
58177 If a delivery does not actually take place because the <option>-N</option> option has been
58178 used to suppress it, a normal delivery line is written to the log, except that
58179 <quote>=></quote> is replaced by <quote>*></quote>.
58182 <section id="SECID257">
58183 <title>Completion</title>
58187 <literallayout class="monospaced">
58188 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
58191 is written to the main log when a message is about to be removed from the spool
58192 at the end of its processing.
58195 <section id="SECID258">
58196 <title>Summary of Fields in Log Lines</title>
58198 <indexterm role="concept">
58199 <primary>log</primary>
58200 <secondary>summary of fields</secondary>
58202 A summary of the field identifiers that are used in log lines is shown in
58203 the following table:
58206 <literal>A </literal> authenticator name (and optional id)
58207 <literal>C </literal> SMTP confirmation on delivery
58208 <literal> </literal> command list for <quote>no mail in SMTP session</quote>
58209 <literal>CV </literal> certificate verification status
58210 <literal>D </literal> duration of <quote>no mail in SMTP session</quote>
58211 <literal>DN </literal> distinguished name from peer certificate
58212 <literal>DT </literal> on <literal>=></literal> lines: time taken for a delivery
58213 <literal>F </literal> sender address (on delivery lines)
58214 <literal>H </literal> host name and IP address
58215 <literal>I </literal> local interface used
58216 <literal>id </literal> message id for incoming message
58217 <literal>P </literal> on <literal><=</literal> lines: protocol used
58218 <literal> </literal> on <literal>=></literal> and <literal>**</literal> lines: return path
58219 <literal>QT </literal> on <literal>=></literal> lines: time spent on queue so far
58220 <literal> </literal> on <quote>Completed</quote> lines: time spent on queue
58221 <literal>R </literal> on <literal><=</literal> lines: reference for local bounce
58222 <literal> </literal> on <literal>=></literal> <literal>**</literal> and <literal>==</literal> lines: router name
58223 <literal>S </literal> size of message
58224 <literal>ST </literal> shadow transport name
58225 <literal>T </literal> on <literal><=</literal> lines: message subject (topic)
58226 <literal> </literal> on <literal>=></literal> <literal>**</literal> and <literal>==</literal> lines: transport name
58227 <literal>U </literal> local user or RFC 1413 identity
58228 <literal>X </literal> TLS cipher suite
58231 <section id="SECID259">
58232 <title>Other log entries</title>
58234 Various other types of log entry are written from time to time. Most should be
58235 self-explanatory. Among the more common are:
58240 <indexterm role="concept">
58241 <primary>retry</primary>
58242 <secondary>time not reached</secondary>
58244 <emphasis>retry time not reached</emphasis> An address previously suffered a temporary error
58245 during routing or local delivery, and the time to retry has not yet arrived.
58246 This message is not written to an individual message log file unless it happens
58247 during the first delivery attempt.
58252 <emphasis>retry time not reached for any host</emphasis> An address previously suffered
58253 temporary errors during remote delivery, and the retry time has not yet arrived
58254 for any of the hosts to which it is routed.
58259 <indexterm role="concept">
58260 <primary>spool directory</primary>
58261 <secondary>file locked</secondary>
58263 <emphasis>spool file locked</emphasis> An attempt to deliver a message cannot proceed because
58264 some other Exim process is already working on the message. This can be quite
58265 common if queue running processes are started at frequent intervals. The
58266 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
58272 <indexterm role="concept">
58273 <primary>error</primary>
58274 <secondary>ignored</secondary>
58276 <emphasis>error ignored</emphasis> There are several circumstances that give rise to this
58279 <orderedlist numeration="arabic">
58282 Exim failed to deliver a bounce message whose age was greater than
58283 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
58288 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
58289 failed. The delivery was discarded.
58294 A delivery set up by a router configured with
58296 <literallayout class="monospaced">
58297 errors_to = <>
58300 failed. The delivery was discarded.
58307 <section id="SECTlogselector">
58308 <title>Reducing or increasing what is logged</title>
58310 <indexterm role="concept">
58311 <primary>log</primary>
58312 <secondary>selectors</secondary>
58314 By setting the <option>log_selector</option> global option, you can disable some of Exim’s
58315 default logging, or you can request additional logging. The value of
58316 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
58319 <literallayout class="monospaced">
58320 log_selector = +arguments -retry_defer
58323 The list of optional log items is in the following table, with the default
58324 selection marked by asterisks:
58327 <literal>*acl_warn_skipped </literal> skipped <option>warn</option> statement in ACL
58328 <literal> address_rewrite </literal> address rewriting
58329 <literal> all_parents </literal> all parents in => lines
58330 <literal> arguments </literal> command line arguments
58331 <literal>*connection_reject </literal> connection rejections
58332 <literal>*delay_delivery </literal> immediate delivery delayed
58333 <literal> deliver_time </literal> time taken to perform delivery
58334 <literal> delivery_size </literal> add <literal>S=</literal><emphasis>nnn</emphasis> to => lines
58335 <literal>*dnslist_defer </literal> defers of DNS list (aka RBL) lookups
58336 <literal>*etrn </literal> ETRN commands
58337 <literal>*host_lookup_failed </literal> as it says
58338 <literal> ident_timeout </literal> timeout for ident connection
58339 <literal> incoming_interface </literal> incoming interface on <= lines
58340 <literal> incoming_port </literal> incoming port on <= lines
58341 <literal>*lost_incoming_connection </literal> as it says (includes timeouts)
58342 <literal> outgoing_port </literal> add remote port to => lines
58343 <literal>*queue_run </literal> start and end queue runs
58344 <literal> queue_time </literal> time on queue for one recipient
58345 <literal> queue_time_overall </literal> time on queue for whole message
58346 <literal> pid </literal> Exim process id
58347 <literal> received_recipients </literal> recipients on <= lines
58348 <literal> received_sender </literal> sender on <= lines
58349 <literal>*rejected_header </literal> header contents on reject log
58350 <literal>*retry_defer </literal> <quote>retry time not reached</quote>
58351 <literal> return_path_on_delivery </literal> put return path on => and ** lines
58352 <literal> sender_on_delivery </literal> add sender to => lines
58353 <literal>*sender_verify_fail </literal> sender verification failures
58354 <literal>*size_reject </literal> rejection because too big
58355 <literal>*skip_delivery </literal> delivery skipped in a queue run
58356 <literal> smtp_confirmation </literal> SMTP confirmation on => lines
58357 <literal> smtp_connection </literal> SMTP connections
58358 <literal> smtp_incomplete_transaction</literal> incomplete SMTP transactions
58359 <literal> smtp_no_mail </literal> session with no MAIL commands
58360 <literal> smtp_protocol_error </literal> SMTP protocol errors
58361 <literal> smtp_syntax_error </literal> SMTP syntax errors
58362 <literal> subject </literal> contents of <emphasis>Subject:</emphasis> on <= lines
58363 <literal> tls_certificate_verified </literal> certificate verification status
58364 <literal>*tls_cipher </literal> TLS cipher suite on <= and => lines
58365 <literal> tls_peerdn </literal> TLS peer DN on <= and => lines
58366 <literal> unknown_in_list </literal> DNS lookup failed in list match
58368 <literal> all </literal> all of the above
58371 More details on each of these items follows:
58376 <indexterm role="concept">
58377 <primary><option>warn</option> ACL verb</primary>
58378 <secondary>log when skipping</secondary>
58380 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
58381 its conditions cannot be evaluated, a log line to this effect is written if
58382 this log selector is set.
58387 <indexterm role="concept">
58388 <primary>log</primary>
58389 <secondary>rewriting</secondary>
58391 <indexterm role="concept">
58392 <primary>rewriting</primary>
58393 <secondary>logging</secondary>
58395 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
58396 rewrites, but not to rewrites in filters run as an unprivileged user (because
58397 such users cannot access the log).
58402 <indexterm role="concept">
58403 <primary>log</primary>
58404 <secondary>full parentage</secondary>
58406 <option>all_parents</option>: Normally only the original and final addresses are logged on
58407 delivery lines; with this selector, intermediate parents are given in
58408 parentheses between them.
58413 <indexterm role="concept">
58414 <primary>log</primary>
58415 <secondary>Exim arguments</secondary>
58417 <indexterm role="concept">
58418 <primary>Exim arguments, logging</primary>
58420 <option>arguments</option>: This causes Exim to write the arguments with which it was called
58421 to the main log, preceded by the current working directory. This is a debugging
58422 feature, added to make it easier to find out how certain MUAs call
58423 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
58424 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
58425 that are empty or that contain white space are quoted. Non-printing characters
58426 are shown as escape sequences. This facility cannot log unrecognized arguments,
58427 because the arguments are checked before the configuration file is read. The
58428 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
58429 between the caller and Exim.
58434 <indexterm role="concept">
58435 <primary>log</primary>
58436 <secondary>connection rejections</secondary>
58438 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
58439 connection is rejected, for whatever reason.
58444 <indexterm role="concept">
58445 <primary>log</primary>
58446 <secondary>delayed delivery</secondary>
58448 <indexterm role="concept">
58449 <primary>delayed delivery, logging</primary>
58451 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
58452 started for an incoming message because the load is too high or too many
58453 messages were received on one connection. Logging does not occur if no delivery
58454 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
58459 <indexterm role="concept">
58460 <primary>log</primary>
58461 <secondary>delivery duration</secondary>
58463 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
58464 perform the actual delivery is logged as DT=<<emphasis>time</emphasis>>, for example, <literal>DT=1s</literal>.
58469 <indexterm role="concept">
58470 <primary>log</primary>
58471 <secondary>message size on delivery</secondary>
58473 <indexterm role="concept">
58474 <primary>size</primary>
58475 <secondary>of message</secondary>
58477 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
58478 the <quote>=></quote> line, tagged with S=.
58483 <indexterm role="concept">
58484 <primary>log</primary>
58485 <secondary>dnslist defer</secondary>
58487 <indexterm role="concept">
58488 <primary>DNS list</primary>
58489 <secondary>logging defer</secondary>
58491 <indexterm role="concept">
58492 <primary>black list (DNS)</primary>
58494 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
58495 DNS black list suffers a temporary error.
58500 <indexterm role="concept">
58501 <primary>log</primary>
58502 <secondary>ETRN commands</secondary>
58504 <indexterm role="concept">
58505 <primary>ETRN</primary>
58506 <secondary>logging</secondary>
58508 <option>etrn</option>: Every valid ETRN command that is received is logged, before the ACL
58509 is run to determine whether or not it is actually accepted. An invalid ETRN
58510 command, or one received within a message transaction is not logged by this
58511 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
58516 <indexterm role="concept">
58517 <primary>log</primary>
58518 <secondary>host lookup failure</secondary>
58520 <option>host_lookup_failed</option>: When a lookup of a host’s IP addresses fails to find
58521 any addresses, or when a lookup of an IP address fails to find a host name, a
58522 log line is written. This logging does not apply to direct DNS lookups when
58523 routing email addresses, but it does apply to <quote>byname</quote> lookups.
58528 <indexterm role="concept">
58529 <primary>log</primary>
58530 <secondary>ident timeout</secondary>
58532 <indexterm role="concept">
58533 <primary>RFC 1413</primary>
58534 <secondary>logging timeout</secondary>
58536 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
58537 client’s ident port times out.
58542 <indexterm role="concept">
58543 <primary>log</primary>
58544 <secondary>incoming interface</secondary>
58546 <indexterm role="concept">
58547 <primary>interface</primary>
58548 <secondary>logging</secondary>
58550 <option>incoming_interface</option>: The interface on which a message was received is added
58551 to the <quote><=</quote> line as an IP address in square brackets, tagged by I= and
58552 followed by a colon and the port number. The local interface and port are also
58553 added to other SMTP log lines, for example <quote>SMTP connection from</quote>, and to
58559 <indexterm role="concept">
58560 <primary>log</primary>
58561 <secondary>incoming remote port</secondary>
58563 <indexterm role="concept">
58564 <primary>port</primary>
58565 <secondary>logging remote</secondary>
58567 <indexterm role="concept">
58568 <primary>TCP/IP</primary>
58569 <secondary>logging incoming remote port</secondary>
58571 <indexterm role="variable">
58572 <primary><varname>$sender_fullhost</varname></primary>
58574 <indexterm role="variable">
58575 <primary><varname>$sender_rcvhost</varname></primary>
58577 <option>incoming_port</option>: The remote port number from which a message was received is
58578 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
58579 in square brackets, and separated from it by a colon. This is implemented by
58580 changing the value that is put in the <varname>$sender_fullhost</varname> and
58581 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
58582 important with the widening use of NAT (see RFC 2505).
58587 <indexterm role="concept">
58588 <primary>log</primary>
58589 <secondary>dropped connection</secondary>
58591 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
58592 connection is unexpectedly dropped.
58597 <indexterm role="concept">
58598 <primary>log</primary>
58599 <secondary>outgoing remote port</secondary>
58601 <indexterm role="concept">
58602 <primary>port</primary>
58603 <secondary>logging outgoint remote</secondary>
58605 <indexterm role="concept">
58606 <primary>TCP/IP</primary>
58607 <secondary>logging ougtoing remote port</secondary>
58609 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
58610 containing => tags) following the IP address. This option is not included in
58611 the default setting, because for most ordinary configurations, the remote port
58612 number is always 25 (the SMTP port).
58617 <indexterm role="concept">
58618 <primary>log</primary>
58619 <secondary>process ids in</secondary>
58621 <indexterm role="concept">
58622 <primary>pid (process id)</primary>
58623 <secondary>in log lines</secondary>
58625 <option>pid</option>: The current process id is added to every log line, in square brackets,
58626 immediately after the time and date.
58631 <indexterm role="concept">
58632 <primary>log</primary>
58633 <secondary>queue run</secondary>
58635 <indexterm role="concept">
58636 <primary>queue runner</primary>
58637 <secondary>logging</secondary>
58639 <option>queue_run</option>: The start and end of every queue run are logged.
58644 <indexterm role="concept">
58645 <primary>log</primary>
58646 <secondary>queue time</secondary>
58648 <option>queue_time</option>: The amount of time the message has been in the queue on the
58649 local host is logged as QT=<<emphasis>time</emphasis>> on delivery (<literal>=></literal>) lines, for example,
58650 <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the message, so it
58651 includes reception time as well as the delivery time for the current address.
58652 This means that it may be longer than the difference between the arrival and
58653 delivery log line times, because the arrival log line is not written until the
58654 message has been successfully received.
58659 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
58660 the local host is logged as QT=<<emphasis>time</emphasis>> on <quote>Completed</quote> lines, for
58661 example, <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the
58662 message, so it includes reception time as well as the total delivery time.
58667 <indexterm role="concept">
58668 <primary>log</primary>
58669 <secondary>recipients</secondary>
58671 <option>received_recipients</option>: The recipients of a message are listed in the main log
58672 as soon as the message is received. The list appears at the end of the log line
58673 that is written when a message is received, preceded by the word <quote>for</quote>. The
58674 addresses are listed after they have been qualified, but before any rewriting
58676 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
58682 <indexterm role="concept">
58683 <primary>log</primary>
58684 <secondary>sender reception</secondary>
58686 <option>received_sender</option>: The unrewritten original sender of a message is added to
58687 the end of the log line that records the message’s arrival, after the word
58688 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
58693 <indexterm role="concept">
58694 <primary>log</primary>
58695 <secondary>header lines for rejection</secondary>
58697 <option>rejected_header</option>: If a message’s header has been received at the time a
58698 rejection is written to the reject log, the complete header is added to the
58699 log. Header logging can be turned off individually for messages that are
58700 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
58705 <indexterm role="concept">
58706 <primary>log</primary>
58707 <secondary>retry defer</secondary>
58709 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
58710 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
58711 message is always omitted from individual message logs after the first delivery
58717 <indexterm role="concept">
58718 <primary>log</primary>
58719 <secondary>return path</secondary>
58721 <option>return_path_on_delivery</option>: The return path that is being transmitted with
58722 the message is included in delivery and bounce lines, using the tag P=.
58723 This is omitted if no delivery actually happens, for example, if routing fails,
58724 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
58729 <indexterm role="concept">
58730 <primary>log</primary>
58731 <secondary>sender on delivery</secondary>
58733 <option>sender_on_delivery</option>: The message’s sender address is added to every delivery
58734 and bounce line, tagged by F= (for <quote>from</quote>).
58735 This is the original sender that was received with the message; it is not
58736 necessarily the same as the outgoing return path.
58741 <indexterm role="concept">
58742 <primary>log</primary>
58743 <secondary>sender verify failure</secondary>
58745 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
58746 gives details of a sender verification failure is not written. Log lines for
58747 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
58753 <indexterm role="concept">
58754 <primary>log</primary>
58755 <secondary>size rejection</secondary>
58757 <option>size_reject</option>: A log line is written whenever a message is rejected because
58763 <indexterm role="concept">
58764 <primary>log</primary>
58765 <secondary>frozen messages; skipped</secondary>
58767 <indexterm role="concept">
58768 <primary>frozen messages</primary>
58769 <secondary>logging skipping</secondary>
58771 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
58772 queue run because it is frozen or because another process is already delivering
58774 <indexterm role="concept">
58775 <primary><quote>spool file is locked</quote></primary>
58777 The message that is written is <quote>spool file is locked</quote>.
58782 <indexterm role="concept">
58783 <primary>log</primary>
58784 <secondary>smtp confirmation</secondary>
58786 <indexterm role="concept">
58787 <primary>SMTP</primary>
58788 <secondary>logging confirmation</secondary>
58790 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP dialogue for
58791 outgoing messages is added to delivery log lines in the form <literal>C=</literal><<emphasis>text</emphasis>>.
58792 A number of MTAs (including Exim) return an identifying string in this
58798 <indexterm role="concept">
58799 <primary>log</primary>
58800 <secondary>SMTP connections</secondary>
58802 <indexterm role="concept">
58803 <primary>SMTP</primary>
58804 <secondary>logging connections</secondary>
58806 <option>smtp_connection</option>: A log line is written whenever an SMTP connection is
58807 established or closed, unless the connection is from a host that matches
58808 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
58809 only when the closure is unexpected.) This applies to connections from local
58810 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
58811 dropped in the middle of a message, a log line is always written, whether or
58812 not this selector is set, but otherwise nothing is written at the start and end
58813 of connections unless this selector is enabled.
58816 For TCP/IP connections to an Exim daemon, the current number of connections is
58817 included in the log message for each new connection, but note that the count is
58818 reset if the daemon is restarted.
58819 Also, because connections are closed (and the closure is logged) in
58820 subprocesses, the count may not include connections that have been closed but
58821 whose termination the daemon has not yet noticed. Thus, while it is possible to
58822 match up the opening and closing of connections in the log, the value of the
58823 logged counts may not be entirely accurate.
58828 <indexterm role="concept">
58829 <primary>log</primary>
58830 <secondary>SMTP transaction; incomplete</secondary>
58832 <indexterm role="concept">
58833 <primary>SMTP</primary>
58834 <secondary>logging incomplete transactions</secondary>
58836 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
58837 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
58838 and the message sender plus any accepted recipients are included in the log
58839 line. This can provide evidence of dictionary attacks.
58844 <indexterm role="concept">
58845 <primary>log</primary>
58846 <secondary>non-MAIL SMTP sessions</secondary>
58848 <indexterm role="concept">
58849 <primary>MAIL</primary>
58850 <secondary>logging session without</secondary>
58852 <option>smtp_no_mail</option>: A line is written to the main log whenever an accepted SMTP
58853 connection terminates without having issued a MAIL command. This includes both
58854 the case when the connection is dropped, and the case when QUIT is used. It
58855 does not include cases where the connection is rejected right at the start (by
58856 an ACL, or because there are too many connections, or whatever). These cases
58857 already have their own log lines.
58860 The log line that is written contains the identity of the client in the usual
58861 way, followed by D= and a time, which records the duration of the connection.
58862 If the connection was authenticated, this fact is logged exactly as it is for
58863 an incoming message, with an A= item. If the connection was encrypted, CV=,
58864 DN=, and X= items may appear as they do for an incoming message, controlled by
58865 the same logging options.
58868 Finally, if any SMTP commands were issued during the connection, a C= item
58869 is added to the line, listing the commands that were used. For example,
58871 <literallayout class="monospaced">
58875 shows that the client issued QUIT straight after EHLO. If there were fewer
58876 than 20 commands, they are all listed. If there were more than 20 commands,
58877 the last 20 are listed, preceded by <quote>...</quote>. However, with the default
58878 setting of 10 for <option>smtp_accep_max_nonmail</option>, the connection will in any case
58879 have been aborted before 20 non-mail commands are processed.
58884 <indexterm role="concept">
58885 <primary>log</primary>
58886 <secondary>SMTP protocol error</secondary>
58888 <indexterm role="concept">
58889 <primary>SMTP</primary>
58890 <secondary>logging protocol error</secondary>
58892 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
58893 encountered. Exim does not have perfect detection of all protocol errors
58894 because of transmission delays and the use of pipelining. If PIPELINING has
58895 been advertised to a client, an Exim server assumes that the client will use
58896 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
58897 received after rejecting MAIL) as protocol errors.
58902 <indexterm role="concept">
58903 <primary>SMTP</primary>
58904 <secondary>logging syntax errors</secondary>
58906 <indexterm role="concept">
58907 <primary>SMTP</primary>
58908 <secondary>syntax errors; logging</secondary>
58910 <indexterm role="concept">
58911 <primary>SMTP</primary>
58912 <secondary>unknown command; logging</secondary>
58914 <indexterm role="concept">
58915 <primary>log</primary>
58916 <secondary>unknown SMTP command</secondary>
58918 <indexterm role="concept">
58919 <primary>log</primary>
58920 <secondary>SMTP syntax error</secondary>
58922 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
58923 encountered. An unrecognized command is treated as a syntax error. For an
58924 external connection, the host identity is given; for an internal connection
58925 using <option>-bs</option> the sender identification (normally the calling user) is given.
58930 <indexterm role="concept">
58931 <primary>log</primary>
58932 <secondary>subject</secondary>
58934 <indexterm role="concept">
58935 <primary>subject, logging</primary>
58937 <option>subject</option>: The subject of the message is added to the arrival log line,
58938 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
58939 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
58940 specifies whether characters with values greater than 127 should be logged
58941 unchanged, or whether they should be rendered as escape sequences.
58946 <indexterm role="concept">
58947 <primary>log</primary>
58948 <secondary>certificate verification</secondary>
58950 <option>tls_certificate_verified</option>: An extra item is added to <= and => log lines
58951 when TLS is in use. The item is <literal>CV=yes</literal> if the peer’s certificate was
58952 verified, and <literal>CV=no</literal> if not.
58957 <indexterm role="concept">
58958 <primary>log</primary>
58959 <secondary>TLS cipher</secondary>
58961 <indexterm role="concept">
58962 <primary>TLS</primary>
58963 <secondary>logging cipher</secondary>
58965 <option>tls_cipher</option>: When a message is sent or received over an encrypted
58966 connection, the cipher suite used is added to the log line, preceded by X=.
58971 <indexterm role="concept">
58972 <primary>log</primary>
58973 <secondary>TLS peer DN</secondary>
58975 <indexterm role="concept">
58976 <primary>TLS</primary>
58977 <secondary>logging peer DN</secondary>
58979 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
58980 connection, and a certificate is supplied by the remote host, the peer DN is
58981 added to the log line, preceded by DN=.
58986 <indexterm role="concept">
58987 <primary>log</primary>
58988 <secondary>DNS failure in list</secondary>
58990 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
58991 result of a list match is failure because a DNS lookup failed.
58996 <section id="SECID260">
58997 <title>Message log</title>
58999 <indexterm role="concept">
59000 <primary>message</primary>
59001 <secondary>log file for</secondary>
59003 <indexterm role="concept">
59004 <primary>log</primary>
59005 <secondary>message log; description of</secondary>
59007 <indexterm role="concept">
59008 <primary><filename>msglog</filename> directory</primary>
59010 <indexterm role="option">
59011 <primary><option>preserve_message_logs</option></primary>
59013 In addition to the general log files, Exim writes a log file for each message
59014 that it handles. The names of these per-message logs are the message ids, and
59015 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
59016 message log contains copies of the log lines that apply to the message. This
59017 makes it easier to inspect the status of an individual message without having
59018 to search the main log. A message log is deleted when processing of the message
59019 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
59020 only with great care because they can fill up your disk very quickly.
59023 On a heavily loaded system, it may be desirable to disable the use of
59024 per-message logs, in order to reduce disk I/O. This can be done by setting the
59025 <option>message_logs</option> option false.
59026 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
59031 <chapter id="CHAPutils">
59032 <title>Exim utilities</title>
59034 <indexterm role="concept" id="IIDutils" class="startofrange">
59035 <primary>utilities</primary>
59037 A number of utility scripts and programs are supplied with Exim and are
59038 described in this chapter. There is also the Exim Monitor, which is covered in
59039 the next chapter. The utilities described here are:
59041 <informaltable frame="none">
59042 <tgroup cols="3" colsep="0" rowsep="0">
59043 <colspec colwidth="7*" align="left"/>
59044 <colspec colwidth="15*" align="left"/>
59045 <colspec colwidth="40*" align="left"/>
59048 <entry> <xref linkend="SECTfinoutwha"/></entry>
59049 <entry><emphasis>exiwhat</emphasis></entry>
59050 <entry>list what Exim processes are doing</entry>
59053 <entry> <xref linkend="SECTgreptheque"/></entry>
59054 <entry><emphasis>exiqgrep</emphasis></entry>
59055 <entry>grep the queue</entry>
59058 <entry> <xref linkend="SECTsumtheque"/></entry>
59059 <entry><emphasis>exiqsumm</emphasis></entry>
59060 <entry>summarize the queue</entry>
59063 <entry> <xref linkend="SECTextspeinf"/></entry>
59064 <entry><emphasis>exigrep</emphasis></entry>
59065 <entry>search the main log</entry>
59068 <entry> <xref linkend="SECTexipick"/></entry>
59069 <entry><emphasis>exipick</emphasis></entry>
59070 <entry>select messages on various criteria</entry>
59073 <entry> <xref linkend="SECTcyclogfil"/></entry>
59074 <entry><emphasis>exicyclog</emphasis></entry>
59075 <entry>cycle (rotate) log files</entry>
59078 <entry> <xref linkend="SECTmailstat"/></entry>
59079 <entry><emphasis>eximstats</emphasis></entry>
59080 <entry>extract statistics from the log</entry>
59083 <entry> <xref linkend="SECTcheckaccess"/></entry>
59084 <entry><emphasis>exim_checkaccess</emphasis></entry>
59085 <entry>check address acceptance from given IP</entry>
59088 <entry> <xref linkend="SECTdbmbuild"/></entry>
59089 <entry><emphasis>exim_dbmbuild</emphasis></entry>
59090 <entry>build a DBM file</entry>
59093 <entry> <xref linkend="SECTfinindret"/></entry>
59094 <entry><emphasis>exinext</emphasis></entry>
59095 <entry>extract retry information</entry>
59098 <entry> <xref linkend="SECThindatmai"/></entry>
59099 <entry><emphasis>exim_dumpdb</emphasis></entry>
59100 <entry>dump a hints database</entry>
59103 <entry> <xref linkend="SECThindatmai"/></entry>
59104 <entry><emphasis>exim_tidydb</emphasis></entry>
59105 <entry>clean up a hints database</entry>
59108 <entry> <xref linkend="SECThindatmai"/></entry>
59109 <entry><emphasis>exim_fixdb</emphasis></entry>
59110 <entry>patch a hints database</entry>
59113 <entry> <xref linkend="SECTmailboxmaint"/></entry>
59114 <entry><emphasis>exim_lock</emphasis></entry>
59115 <entry>lock a mailbox file</entry>
59121 Another utility that might be of use to sites with many MTAs is Tom Kistner’s
59122 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
59123 <emphasis role="bold"><ulink url="http://duncanthrax.net/exilog/">http://duncanthrax.net/exilog/</ulink></emphasis> for details.
59125 <section id="SECTfinoutwha">
59126 <title>Finding out what Exim processes are doing (exiwhat)</title>
59128 <indexterm role="concept">
59129 <primary><emphasis>exiwhat</emphasis></primary>
59131 <indexterm role="concept">
59132 <primary>process, querying</primary>
59134 <indexterm role="concept">
59135 <primary>SIGUSR1</primary>
59137 On operating systems that can restart a system call after receiving a signal
59138 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
59139 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
59140 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
59141 processes it can find, having first emptied the file. It then waits for one
59142 second to allow the Exim processes to react before displaying the results. In
59143 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
59144 send the signal to the Exim processes, so it is normally run as root.
59147 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
59148 use by system administrators. It is not sensible, for example, to set up a
59149 script that sends SIGUSR1 signals to Exim processes at short intervals.
59152 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
59153 varies in different operating systems. Not only are different options used,
59154 but the format of the output is different. For this reason, there are some
59155 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
59156 it doesn’t seem to be working for you, check the following compile-time
59160 <literal>EXIWHAT_PS_CMD </literal> the command for running <emphasis>ps</emphasis>
59161 <literal>EXIWHAT_PS_ARG </literal> the argument for <emphasis>ps</emphasis>
59162 <literal>EXIWHAT_EGREP_ARG </literal> the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output
59163 <literal>EXIWHAT_KILL_ARG </literal> the argument for the <emphasis>kill</emphasis> command
59166 An example of typical output from <emphasis>exiwhat</emphasis> is
59168 <literallayout class="monospaced">
59169 164 daemon: -q1h, listening on port 25
59170 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
59171 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
59172 [10.19.42.42] (editor@ref.example)
59173 10592 handling incoming call from [192.168.243.242]
59174 10628 accepting a local non-SMTP message
59177 The first number in the output line is the process number. The third line has
59178 been split here, in order to fit it on the page.
59181 <section id="SECTgreptheque">
59182 <title>Selective queue listing (exiqgrep)</title>
59184 <indexterm role="concept">
59185 <primary><emphasis>exiqgrep</emphasis></primary>
59187 <indexterm role="concept">
59188 <primary>queue</primary>
59189 <secondary>grepping</secondary>
59191 This utility is a Perl script contributed by Matt Hubbard. It runs
59193 <literallayout class="monospaced">
59197 to obtain a queue listing with undelivered recipients only, and then greps the
59198 output to select messages that match given criteria. The following selection
59199 options are available:
59203 <term><emphasis role="bold">-f</emphasis> <<emphasis>regex</emphasis>></term>
59206 Match the sender address. The field that is tested is enclosed in angle
59207 brackets, so you can test for bounce messages with
59209 <literallayout class="monospaced">
59210 exiqgrep -f '^<>$'
59212 </listitem></varlistentry>
59214 <term><emphasis role="bold">-r</emphasis> <<emphasis>regex</emphasis>></term>
59217 Match a recipient address. The field that is tested is not enclosed in angle
59220 </listitem></varlistentry>
59222 <term><emphasis role="bold">-s</emphasis> <<emphasis>regex</emphasis>></term>
59225 Match against the size field.
59227 </listitem></varlistentry>
59229 <term><emphasis role="bold">-y</emphasis> <<emphasis>seconds</emphasis>></term>
59232 Match messages that are younger than the given time.
59234 </listitem></varlistentry>
59236 <term><emphasis role="bold">-o</emphasis> <<emphasis>seconds</emphasis>></term>
59239 Match messages that are older than the given time.
59241 </listitem></varlistentry>
59243 <term><emphasis role="bold">-z</emphasis></term>
59246 Match only frozen messages.
59248 </listitem></varlistentry>
59250 <term><emphasis role="bold">-x</emphasis></term>
59253 Match only non-frozen messages.
59255 </listitem></varlistentry>
59258 The following options control the format of the output:
59262 <term><emphasis role="bold">-c</emphasis></term>
59265 Display only the count of matching messages.
59267 </listitem></varlistentry>
59269 <term><emphasis role="bold">-l</emphasis></term>
59272 Long format – display the full message information as output by Exim. This is
59275 </listitem></varlistentry>
59277 <term><emphasis role="bold">-i</emphasis></term>
59280 Display message ids only.
59282 </listitem></varlistentry>
59284 <term><emphasis role="bold">-b</emphasis></term>
59287 Brief format – one line per message.
59289 </listitem></varlistentry>
59291 <term><emphasis role="bold">-R</emphasis></term>
59294 Display messages in reverse order.
59296 </listitem></varlistentry>
59299 There is one more option, <option>-h</option>, which outputs a list of options.
59302 <section id="SECTsumtheque">
59303 <title>Summarizing the queue (exiqsumm)</title>
59305 <indexterm role="concept">
59306 <primary><emphasis>exiqsumm</emphasis></primary>
59308 <indexterm role="concept">
59309 <primary>queue</primary>
59310 <secondary>summary</secondary>
59312 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
59313 -bp</literal> and produces a summary of the messages on the queue. Thus, you use it by
59314 running a command such as
59316 <literallayout class="monospaced">
59317 exim -bp | exiqsumm
59320 The output consists of one line for each domain that has messages waiting for
59321 it, as in the following example:
59323 <literallayout class="monospaced">
59324 3 2322 74m 66m msn.com.example
59327 Each line lists the number of pending deliveries for a domain, their total
59328 volume, and the length of time that the oldest and the newest messages have
59329 been waiting. Note that the number of pending deliveries is greater than the
59330 number of messages when messages have more than one recipient.
59333 A summary line is output at the end. By default the output is sorted on the
59334 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
59335 the output to be sorted by oldest message and by count of messages,
59336 respectively. There are also three options that split the messages for each
59337 domain into two or more subcounts: <option>-b</option> separates bounce messages, <option>-f</option>
59338 separates frozen messages, and <option>-s</option> separates messages according to their
59342 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
59343 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
59344 generated by aliasing or forwarding are included (unless the <option>one_time</option>
59345 option of the <command>redirect</command> router has been used to convert them into <quote>top
59346 level</quote> addresses).
59349 <section id="SECTextspeinf">
59350 <title>Extracting specific information from the log (exigrep)</title>
59352 <indexterm role="concept">
59353 <primary><emphasis>exigrep</emphasis></primary>
59355 <indexterm role="concept">
59356 <primary>log</primary>
59357 <secondary>extracts; grepping for</secondary>
59359 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
59360 files for entries that match a given pattern. When it finds a match, it
59361 extracts all the log entries for the relevant message, not just those that
59362 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
59363 given message, or all mail for a given user, or for a given host, for example.
59364 The input files can be in Exim log format or syslog format.
59365 If a matching log line is not associated with a specific message, it is
59366 included in <emphasis>exigrep</emphasis>’s output without any additional lines. The usage is:
59369 <literal>exigrep [-t<</literal><emphasis>n</emphasis><literal>>] [-I] [-l] [-v] <</literal><emphasis>pattern</emphasis><literal>> [<</literal><emphasis>log file</emphasis><literal>>] ...</literal>
59372 If no log file names are given on the command line, the standard input is read.
59375 The <option>-t</option> argument specifies a number of seconds. It adds an additional
59376 condition for message selection. Messages that are complete are shown only if
59377 they spent more than <<emphasis>n</emphasis>> seconds on the queue.
59380 By default, <emphasis>exigrep</emphasis> does case-insensitive matching. The <option>-I</option> option
59381 makes it case-sensitive. This may give a performance improvement when searching
59382 large log files. Without <option>-I</option>, the Perl pattern matches use Perl’s <literal>/i</literal>
59383 option; with <option>-I</option> they do not. In both cases it is possible to change the
59384 case sensitivity within the pattern by using <literal>(?i)</literal> or <literal>(?-i)</literal>.
59387 The <option>-l</option> option means <quote>literal</quote>, that is, treat all characters in the
59388 pattern as standing for themselves. Otherwise the pattern must be a Perl
59389 regular expression.
59392 The <option>-v</option> option inverts the matching condition. That is, a line is selected
59393 if it does <emphasis>not</emphasis> match the pattern.
59396 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
59397 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
59398 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
59401 <section id="SECTexipick">
59402 <title>Selecting messages by various criteria (exipick)</title>
59404 <indexterm role="concept">
59405 <primary><emphasis>exipick</emphasis></primary>
59407 John Jetmore’s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
59408 lists messages from the queue according to a variety of criteria. For details
59409 of <emphasis>exipick</emphasis>’s facilities, visit the web page at
59410 <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
59411 the <option>--help</option> option.
59414 <section id="SECTcyclogfil">
59415 <title>Cycling log files (exicyclog)</title>
59417 <indexterm role="concept">
59418 <primary>log</primary>
59419 <secondary>cycling local files</secondary>
59421 <indexterm role="concept">
59422 <primary>cycling logs</primary>
59424 <indexterm role="concept">
59425 <primary><emphasis>exicyclog</emphasis></primary>
59427 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
59428 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
59429 you are using log files with datestamps in their names (see section
59430 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
59431 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
59432 There are two command line options for <emphasis>exicyclog</emphasis>:
59437 <option>-k</option> <<emphasis>count</emphasis>> specifies the number of log files to keep, overriding the
59438 default that is set when Exim is built. The default default is 10.
59443 <option>-l</option> <<emphasis>path</emphasis>> specifies the log file path, in the same format as Exim’s
59444 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
59445 overriding the script’s default, which is to find the setting from Exim’s
59451 Each time <emphasis>exicyclog</emphasis> is run the file names get <quote>shuffled down</quote> by one. If
59452 the main log file name is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
59453 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
59454 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
59455 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
59456 logs are handled similarly.
59459 If the limit is greater than 99, the script uses 3-digit numbers such as
59460 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
59461 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
59462 any existing log files.
59465 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
59466 the end are deleted. All files with numbers greater than 01 are compressed,
59467 using a compression command which is configured by the COMPRESS_COMMAND
59468 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
59469 root <option>crontab</option> entry of the form
59471 <literallayout class="monospaced">
59472 1 0 * * * su exim -c /usr/exim/bin/exicyclog
59475 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
59476 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
59479 <section id="SECTmailstat">
59480 <title>Mail statistics (eximstats)</title>
59482 <indexterm role="concept">
59483 <primary>statistics</primary>
59485 <indexterm role="concept">
59486 <primary><emphasis>eximstats</emphasis></primary>
59488 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
59489 information from log files. The output is either plain text, or HTML.
59490 Exim log files are also supported by the <emphasis>Lire</emphasis> system produced by the
59491 LogReport Foundation <emphasis role="bold"><ulink url="http://www.logreport.org">http://www.logreport.org</ulink></emphasis>.
59494 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
59495 latest version is the result of some extensive revision by Steve Campbell. A
59496 lot of information is given by default, but there are options for suppressing
59497 various parts of it. Following any options, the arguments to the script are a
59498 list of files, which should be main log files. For example:
59500 <literallayout class="monospaced">
59501 eximstats -nr /var/spool/exim/log/mainlog.01
59504 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
59505 messages received from or delivered to various hosts. The information is sorted
59506 both by message count and by volume, and the top fifty hosts in each category
59507 are listed on the standard output. Similar information, based on email
59508 addresses or domains instead of hosts can be requested by means of various
59509 options. For messages delivered and received locally, similar statistics are
59510 also produced per user.
59513 The output also includes total counts and statistics about delivery errors, and
59514 histograms showing the number of messages received and deliveries made in each
59515 hour of the day. A delivery with more than one address in its envelope (for
59516 example, an SMTP transaction with more than one RCPT command) is counted
59517 as a single delivery by <emphasis>eximstats</emphasis>.
59520 Though normally more deliveries than receipts are reported (as messages may
59521 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
59522 messages received than delivered, even though the queue is empty at the start
59523 and end of the period in question. If an incoming message contains no valid
59524 recipients, no deliveries are recorded for it. A bounce message is handled as
59525 an entirely separate message.
59528 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
59529 of messages received and deliveries made, and the number of hosts involved in
59530 each case. It also outputs the number of messages that were delayed (that is,
59531 not completely delivered at the first attempt), and the number that had at
59532 least one address that failed.
59535 The remainder of the output is in sections that can be independently disabled
59536 or modified by various options. It consists of a summary of deliveries by
59537 transport, histograms of messages received and delivered per time interval
59538 (default per hour), information about the time messages spent on the queue,
59539 a list of relayed messages, lists of the top fifty sending hosts, local
59540 senders, destination hosts, and destination local users by count and by volume,
59541 and a list of delivery errors that occurred.
59544 The relay information lists messages that were actually relayed, that is, they
59545 came from a remote host and were directly delivered to some other remote host,
59546 without being processed (for example, for aliasing or forwarding) locally.
59549 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
59550 outputs. These are documented in the Perl script itself, and can be extracted
59551 by running the command <command>perldoc</command> on the script. For example:
59553 <literallayout class="monospaced">
59554 perldoc /usr/exim/bin/eximstats
59557 <section id="SECTcheckaccess">
59558 <title>Checking access policy (exim_checkaccess)</title>
59560 <indexterm role="concept">
59561 <primary><emphasis>exim_checkaccess</emphasis></primary>
59563 <indexterm role="concept">
59564 <primary>policy control</primary>
59565 <secondary>checking access</secondary>
59567 <indexterm role="concept">
59568 <primary>checking access</primary>
59570 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
59571 debugging output, in order to check what Exim is doing when it is applying
59572 policy controls to incoming SMTP mail. However, not everybody is sufficiently
59573 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
59574 sometimes you just want to answer the question <quote>Does this address have
59575 access?</quote> without bothering with any further details.
59578 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
59579 two arguments, an IP address and an email address:
59581 <literallayout class="monospaced">
59582 exim_checkaccess 10.9.8.7 A.User@a.domain.example
59585 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
59586 given email address would be accepted in a RCPT command in a TCP/IP
59587 connection from the host with the given IP address. The output of the utility
59588 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
59590 <literallayout class="monospaced">
59592 550 Relay not permitted
59595 When running this test, the utility uses <literal><></literal> as the envelope sender address
59596 for the MAIL command, but you can change this by providing additional
59597 options. These are passed directly to the Exim command. For example, to specify
59598 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
59601 <literallayout class="monospaced">
59602 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
59603 -f himself@there.example
59606 Note that these additional Exim command line items must be given after the two
59607 mandatory arguments.
59610 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
59611 while running its checks. You can run checks that include callouts by using
59612 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
59615 <section id="SECTdbmbuild">
59616 <title>Making DBM files (exim_dbmbuild)</title>
59618 <indexterm role="concept">
59619 <primary>DBM</primary>
59620 <secondary>building dbm files</secondary>
59622 <indexterm role="concept">
59623 <primary>building DBM files</primary>
59625 <indexterm role="concept">
59626 <primary><emphasis>exim_dbmbuild</emphasis></primary>
59628 <indexterm role="concept">
59629 <primary>lower casing</primary>
59631 <indexterm role="concept">
59632 <primary>binary zero</primary>
59633 <secondary>in lookup key</secondary>
59635 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
59636 the format used by the <command>lsearch</command> lookup (see section
59637 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
59638 names as keys and the remainder of the information as data. The lower-casing
59639 can be prevented by calling the program with the <option>-nolc</option> option.
59642 A terminating zero is included as part of the key string. This is expected by
59643 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
59644 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
59645 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
59649 The program requires two arguments: the name of the input file (which can be a
59650 single hyphen to indicate the standard input), and the name of the output file.
59651 It creates the output under a temporary name, and then renames it if all went
59655 <indexterm role="concept">
59656 <primary>USE_DB</primary>
59658 If the native DB interface is in use (USE_DB is set in a compile-time
59659 configuration file – this is common in free versions of Unix) the two file
59660 names must be different, because in this mode the Berkeley DB functions create
59661 a single output file using exactly the name given. For example,
59663 <literallayout class="monospaced">
59664 exim_dbmbuild /etc/aliases /etc/aliases.db
59667 reads the system alias file and creates a DBM version of it in
59668 <filename>/etc/aliases.db</filename>.
59671 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
59672 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
59673 environment, the suffixes are added to the second argument of
59674 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
59675 when the Berkeley functions are used in compatibility mode (though this is not
59676 recommended), because in that case it adds a <filename>.db</filename> suffix to the file name.
59679 If a duplicate key is encountered, the program outputs a warning, and when it
59680 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
59681 option is used. By default, only the first of a set of duplicates is used –
59682 this makes it compatible with <command>lsearch</command> lookups. There is an option
59683 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
59684 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
59685 <option>stderr</option>. For other errors, where it doesn’t actually make a new file, the
59689 <section id="SECTfinindret">
59690 <title>Finding individual retry times (exinext)</title>
59692 <indexterm role="concept">
59693 <primary>retry</primary>
59694 <secondary>times</secondary>
59696 <indexterm role="concept">
59697 <primary><emphasis>exinext</emphasis></primary>
59699 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
59700 fish specific information out of the retry database. Given a mail domain (or a
59701 complete address), it looks up the hosts for that domain, and outputs any retry
59702 information for the hosts or for the domain. At present, the retry information
59703 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
59704 output. For example:
59706 <literallayout class="monospaced">
59707 $ exinext piglet@milne.fict.example
59708 kanga.milne.example:192.168.8.1 error 146: Connection refused
59709 first failed: 21-Feb-1996 14:57:34
59710 last tried: 21-Feb-1996 14:57:34
59711 next try at: 21-Feb-1996 15:02:34
59712 roo.milne.example:192.168.8.3 error 146: Connection refused
59713 first failed: 20-Jan-1996 13:12:08
59714 last tried: 21-Feb-1996 11:42:03
59715 next try at: 21-Feb-1996 19:42:03
59716 past final cutoff time
59719 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
59720 will give any retry information for that local part in your default domain.
59721 A message id can be used to obtain retry information pertaining to a specific
59722 message. This exists only when an attempt to deliver a message to a remote host
59723 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
59724 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
59728 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
59729 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
59730 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
59731 configuration file, and the second sets macros for use within the configuration
59732 file. These features are mainly to help in testing, but might also be useful in
59733 environments where more than one configuration file is in use.
59736 <section id="SECThindatmai">
59737 <title>Hints database maintenance</title>
59739 <indexterm role="concept">
59740 <primary>hints database</primary>
59741 <secondary>maintenance</secondary>
59743 <indexterm role="concept">
59744 <primary>maintaining Exim’s hints database</primary>
59746 Three utility programs are provided for maintaining the DBM files that Exim
59747 uses to contain its delivery hint information. Each program requires two
59748 arguments. The first specifies the name of Exim’s spool directory, and the
59749 second is the name of the database it is to operate on. These are as follows:
59754 <emphasis>retry</emphasis>: the database of retry information
59759 <emphasis>wait-</emphasis><<emphasis>transport name</emphasis>>: databases of information about messages waiting
59765 <emphasis>callout</emphasis>: the callout cache
59770 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
59775 <emphasis>misc</emphasis>: other hints data
59780 The <emphasis>misc</emphasis> database is used for
59785 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
59790 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
59791 <command>smtp</command> transport)
59796 <section id="SECID261">
59797 <title>exim_dumpdb</title>
59799 <indexterm role="concept">
59800 <primary><emphasis>exim_dumpdb</emphasis></primary>
59802 The entire contents of a database are written to the standard output by the
59803 <emphasis>exim_dumpdb</emphasis> program, which has no options or arguments other than the
59804 spool and database names. For example, to dump the retry database:
59806 <literallayout class="monospaced">
59807 exim_dumpdb /var/spool/exim retry
59810 Two lines of output are produced for each entry:
59812 <literallayout class="monospaced">
59813 T:mail.ref.example:192.168.242.242 146 77 Connection refused
59814 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
59817 The first item on the first line is the key of the record. It starts with one
59818 of the letters R, or T, depending on whether it refers to a routing or
59819 transport retry. For a local delivery, the next part is the local address; for
59820 a remote delivery it is the name of the remote host, followed by its failing IP
59821 address (unless <option>retry_include_ip_address</option> is set false on the <command>smtp</command>
59822 transport). If the remote port is not the standard one (port 25), it is added
59823 to the IP address. Then there follows an error code, an additional error code,
59824 and a textual description of the error.
59827 The three times on the second line are the time of first failure, the time of
59828 the last delivery attempt, and the computed time for the next attempt. The line
59829 ends with an asterisk if the cutoff time for the last retry rule has been
59833 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
59834 consists of a host name followed by a list of ids for messages that are or were
59835 waiting to be delivered to that host. If there are a very large number for any
59836 one host, continuation records, with a sequence number added to the host name,
59837 may be seen. The data in these records is often out of date, because a message
59838 may be routed to several alternative hosts, and Exim makes no effort to keep
59842 <section id="SECID262">
59843 <title>exim_tidydb</title>
59845 <indexterm role="concept">
59846 <primary><emphasis>exim_tidydb</emphasis></primary>
59848 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
59849 database. If run with no options, it removes all records that are more than 30
59850 days old. The age is calculated from the date and time that the record was last
59851 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
59852 since the first delivery failure. Information about a host that has been down
59853 for more than 30 days will remain in the database, provided that the record is
59854 updated sufficiently often.
59857 The cutoff date can be altered by means of the <option>-t</option> option, which must be
59858 followed by a time. For example, to remove all records older than a week from
59859 the retry database:
59861 <literallayout class="monospaced">
59862 exim_tidydb -t 7d /var/spool/exim retry
59865 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
59866 message ids. In the former these appear as data in records keyed by host –
59867 they were messages that were waiting for that host – and in the latter they
59868 are the keys for retry information for messages that have suffered certain
59869 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
59870 message ids in database records are those of messages that are still on the
59871 queue. Message ids for messages that no longer exist are removed from
59872 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
59873 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
59874 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
59875 whenever it removes information from the database.
59878 Certain records are automatically removed by Exim when they are no longer
59879 needed, but others are not. For example, if all the MX hosts for a domain are
59880 down, a retry record is created for each one. If the primary MX host comes back
59881 first, its record is removed when Exim successfully delivers to it, but the
59882 records for the others remain because Exim has not tried to use those hosts.
59885 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
59886 hints databases. You should do this at a quiet time of day, because it requires
59887 a database to be locked (and therefore inaccessible to Exim) while it does its
59888 work. Removing records from a DBM file does not normally make the file smaller,
59889 but all the common DBM libraries are able to re-use the space that is released.
59890 After an initial phase of increasing in size, the databases normally reach a
59891 point at which they no longer get any bigger, as long as they are regularly
59895 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
59896 databases is likely to keep on increasing.
59899 <section id="SECID263">
59900 <title>exim_fixdb</title>
59902 <indexterm role="concept">
59903 <primary><emphasis>exim_fixdb</emphasis></primary>
59905 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
59906 Its main use is for testing Exim, but it might also be occasionally useful for
59907 getting round problems in a live system. It has no options, and its interface
59908 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
59909 key of a database record can then be entered, and the data for that record is
59913 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
59914 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
59915 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
59916 data for individual fields can be changed by typing the field number followed
59917 by new data, for example:
59919 <literallayout class="monospaced">
59923 resets the time of the next delivery attempt. Time values are given as a
59924 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
59925 used as optional separators.
59928 <section id="SECTmailboxmaint">
59929 <title>Mailbox maintenance (exim_lock)</title>
59931 <indexterm role="concept">
59932 <primary>mailbox</primary>
59933 <secondary>maintenance</secondary>
59935 <indexterm role="concept">
59936 <primary><emphasis>exim_lock</emphasis></primary>
59938 <indexterm role="concept">
59939 <primary>locking mailboxes</primary>
59941 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
59942 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
59943 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
59944 a user agent while investigating a problem. The utility requires the name of
59945 the file as its first argument. If the locking is successful, the second
59946 argument is run as a command (using C’s <function>system()</function> function); if there is no
59947 second argument, the value of the SHELL environment variable is used; if this
59948 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
59949 is unlocked and the utility ends. The following options are available:
59953 <term><option>-fcntl</option></term>
59956 Use <function>fcntl()</function> locking on the open mailbox.
59958 </listitem></varlistentry>
59960 <term><option>-flock</option></term>
59963 Use <function>flock()</function> locking on the open mailbox, provided the operating system
59966 </listitem></varlistentry>
59968 <term><option>-interval</option></term>
59971 This must be followed by a number, which is a number of seconds; it sets the
59972 interval to sleep between retries (default 3).
59974 </listitem></varlistentry>
59976 <term><option>-lockfile</option></term>
59979 Create a lock file before opening the mailbox.
59981 </listitem></varlistentry>
59983 <term><option>-mbx</option></term>
59986 Lock the mailbox using MBX rules.
59988 </listitem></varlistentry>
59990 <term><option>-q</option></term>
59993 Suppress verification output.
59995 </listitem></varlistentry>
59997 <term><option>-retries</option></term>
60000 This must be followed by a number; it sets the number of times to try to get
60001 the lock (default 10).
60003 </listitem></varlistentry>
60005 <term><option>-restore_time</option></term>
60008 This option causes <option>exim_lock</option> to restore the modified and read times to the
60009 locked file before exiting. This allows you to access a locked mailbox (for
60010 example, to take a backup copy) without disturbing the times that the user
60013 </listitem></varlistentry>
60015 <term><option>-timeout</option></term>
60018 This must be followed by a number, which is a number of seconds; it sets a
60019 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
60020 default), a non-blocking call is used.
60022 </listitem></varlistentry>
60024 <term><option>-v</option></term>
60027 Generate verbose output.
60029 </listitem></varlistentry>
60032 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
60033 default is to create a lock file and also to use <function>fcntl()</function> locking on the
60034 mailbox, which is the same as Exim’s default. The use of <option>-flock</option> or
60035 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
60036 requires that the directory containing the file be writeable. Locking by lock
60037 file does not last for ever; Exim assumes that a lock file is expired if it is
60038 more than 30 minutes old.
60041 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
60042 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
60043 to be taken out on the open mailbox, and an exclusive lock on the file
60044 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
60045 number of the mailbox file. When the locking is released, if an exclusive lock
60046 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
60049 The default output contains verification of the locking that takes place. The
60050 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
60051 suppresses all output except error messages.
60056 <literallayout class="monospaced">
60057 exim_lock /var/spool/mail/spqr
60060 runs an interactive shell while the file is locked, whereas
60063 <literal>exim_lock -q /var/spool/mail/spqr <<End</literal>
60064 <<emphasis>some commands</emphasis>>
60065 <literal>End</literal>
60068 runs a specific non-interactive sequence of commands while the file is locked,
60069 suppressing all verification output. A single command can be run by a command
60072 <literallayout class="monospaced">
60073 exim_lock -q /var/spool/mail/spqr \
60074 "cp /var/spool/mail/spqr /some/where"
60077 Note that if a command is supplied, it must be entirely contained within the
60078 second argument – hence the quotes.
60079 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
60084 <chapter id="CHAPeximon">
60085 <title>The Exim monitor</title>
60087 <indexterm role="concept" id="IIDeximon" class="startofrange">
60088 <primary>Exim monitor</primary>
60089 <secondary>description</secondary>
60091 <indexterm role="concept">
60092 <primary>X-windows</primary>
60094 <indexterm role="concept">
60095 <primary><emphasis>eximon</emphasis></primary>
60097 <indexterm role="concept">
60098 <primary>Local/eximon.conf</primary>
60100 <indexterm role="concept">
60101 <primary><filename>exim_monitor/EDITME</filename></primary>
60103 The Exim monitor is an application which displays in an X window information
60104 about the state of Exim’s queue and what Exim is doing. An admin user can
60105 perform certain operations on messages from this GUI interface; however all
60106 such facilities are also available from the command line, and indeed, the
60107 monitor itself makes use of the command line to perform any actions requested.
60109 <section id="SECID264">
60110 <title>Running the monitor</title>
60112 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
60113 script that sets up a number of environment variables, and then runs the
60114 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
60115 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
60116 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
60117 parameters are for.
60120 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
60121 a particular invocation by setting up environment variables of the same names,
60122 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
60124 <literallayout class="monospaced">
60125 EXIMON_LOG_DEPTH=400 eximon
60128 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
60129 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
60130 overrides the Exim log file configuration. This makes it possible to have
60131 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
60132 syslog messages are routed to a file on the local host.
60135 X resources can be used to change the appearance of the window in the normal
60136 way. For example, a resource setting of the form
60138 <literallayout class="monospaced">
60139 Eximon*background: gray94
60142 changes the colour of the background to light grey rather than white. The
60143 stripcharts are drawn with both the data lines and the reference lines in
60144 black. This means that the reference lines are not visible when on top of the
60145 data. However, their colour can be changed by setting a resource called
60146 <quote>highlight</quote> (an odd name, but that’s what the Athena stripchart widget uses).
60147 For example, if your X server is running Unix, you could set up lighter
60148 reference lines in the stripcharts by obeying
60150 <literallayout class="monospaced">
60151 xrdb -merge <<End
60152 Eximon*highlight: gray
60156 <indexterm role="concept">
60157 <primary>admin user</primary>
60159 In order to see the contents of messages on the queue, and to operate on them,
60160 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
60163 The monitor’s window is divided into three parts. The first contains one or
60164 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
60165 main log file, and the third is a display of the queue of messages awaiting
60166 delivery, with two more action buttons. The following sections describe these
60167 different parts of the display.
60170 <section id="SECID265">
60171 <title>The stripcharts</title>
60173 <indexterm role="concept">
60174 <primary>stripchart</primary>
60176 The first stripchart is always a count of messages on the queue. Its name can
60177 be configured by setting QUEUE_STRIPCHART_NAME in the
60178 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
60179 configuration script by regular expression matches on log file entries, making
60180 it possible to display, for example, counts of messages delivered to certain
60181 hosts or using certain transports. The supplied defaults display counts of
60182 received and delivered messages, and of local and SMTP deliveries. The default
60183 period between stripchart updates is one minute; this can be adjusted by a
60184 parameter in the <filename>Local/eximon.conf</filename> file.
60187 The stripchart displays rescale themselves automatically as the value they are
60188 displaying changes. There are always 10 horizontal lines in each chart; the
60189 title string indicates the value of each division when it is greater than one.
60190 For example, <quote>x2</quote> means that each division represents a value of 2.
60193 It is also possible to have a stripchart which shows the percentage fullness of
60194 a particular disk partition, which is useful when local deliveries are confined
60195 to a single partition.
60198 <indexterm role="concept">
60199 <primary><option>statvfs</option> function</primary>
60201 This relies on the availability of the <function>statvfs()</function> function or equivalent in
60202 the operating system. Most, but not all versions of Unix that support Exim have
60203 this. For this particular stripchart, the top of the chart always represents
60204 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
60205 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
60206 <filename>Local/eximon.conf</filename> file.
60209 <section id="SECID266">
60210 <title>Main action buttons</title>
60212 <indexterm role="concept">
60213 <primary>size</primary>
60214 <secondary>of monitor window</secondary>
60216 <indexterm role="concept">
60217 <primary>Exim monitor</primary>
60218 <secondary>window size</secondary>
60220 <indexterm role="concept">
60221 <primary>window size</primary>
60223 Below the stripcharts there is an action button for quitting the monitor. Next
60224 to this is another button marked <quote>Size</quote>. They are placed here so that
60225 shrinking the window to its default minimum size leaves just the queue count
60226 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
60227 the window to expand to its maximum size, unless it is already at the maximum,
60228 in which case it is reduced to its minimum.
60231 When expanding to the maximum, if the window cannot be fully seen where it
60232 currently is, it is moved back to where it was the last time it was at full
60233 size. When it is expanding from its minimum size, the old position is
60234 remembered, and next time it is reduced to the minimum it is moved back there.
60237 The idea is that you can keep a reduced window just showing one or two
60238 stripcharts at a convenient place on your screen, easily expand it to show
60239 the full window when required, and just as easily put it back to what it was.
60240 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
60241 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
60242 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
60245 Normally, the monitor starts up with the window at its full size, but it can be
60246 built so that it starts up with the window at its smallest size, by setting
60247 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
60250 <section id="SECID267">
60251 <title>The log display</title>
60253 <indexterm role="concept">
60254 <primary>log</primary>
60255 <secondary>tail of; in monitor</secondary>
60257 The second section of the window is an area in which a display of the tail of
60258 the main log is maintained.
60259 To save space on the screen, the timestamp on each log line is shortened by
60260 removing the date and, if <option>log_timezone</option> is set, the timezone.
60261 The log tail is not available when the only destination for logging data is
60262 syslog, unless the syslog lines are routed to a local file whose name is passed
60263 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
60266 The log sub-window has a scroll bar at its lefthand side which can be used to
60267 move back to look at earlier text, and the up and down arrow keys also have a
60268 scrolling effect. The amount of log that is kept depends on the setting of
60269 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
60270 to use. When this is full, the earlier 50% of data is discarded – this is
60271 much more efficient than throwing it away line by line. The sub-window also has
60272 a horizontal scroll bar for accessing the ends of long log lines. This is the
60273 only means of horizontal scrolling; the right and left arrow keys are not
60274 available. Text can be cut from this part of the window using the mouse in the
60275 normal way. The size of this subwindow is controlled by parameters in the
60276 configuration file <filename>Local/eximon.conf</filename>.
60279 Searches of the text in the log window can be carried out by means of the ^R
60280 and ^S keystrokes, which default to a reverse and a forward search,
60281 respectively. The search covers only the text that is displayed in the window.
60282 It cannot go further back up the log.
60285 The point from which the search starts is indicated by a caret marker. This is
60286 normally at the end of the text in the window, but can be positioned explicitly
60287 by pointing and clicking with the left mouse button, and is moved automatically
60288 by a successful search. If new text arrives in the window when it is scrolled
60289 back, the caret remains where it is, but if the window is not scrolled back,
60290 the caret is moved to the end of the new text.
60293 Pressing ^R or ^S pops up a window into which the search text can be typed.
60294 There are buttons for selecting forward or reverse searching, for carrying out
60295 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
60296 happens and the window remains so that further searches can be done. If the
60297 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
60298 ^C is typed the search is cancelled.
60301 The searching facility is implemented using the facilities of the Athena text
60302 widget. By default this pops up a window containing both <quote>search</quote> and
60303 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
60304 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
60305 However, the linkers in BSDI and HP-UX seem unable to handle an externally
60306 provided version of <option>TextPop</option> when the remaining parts of the text widget
60307 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
60308 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
60309 on these systems, at the expense of having unwanted items in the search popup
60313 <section id="SECID268">
60314 <title>The queue display</title>
60316 <indexterm role="concept">
60317 <primary>queue</primary>
60318 <secondary>display in monitor</secondary>
60320 The bottom section of the monitor window contains a list of all messages that
60321 are on the queue, which includes those currently being received or delivered,
60322 as well as those awaiting delivery. The size of this subwindow is controlled by
60323 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
60324 at which it is updated is controlled by another parameter in the same file –
60325 the default is 5 minutes, since queue scans can be quite expensive. However,
60326 there is an <quote>Update</quote> action button just above the display which can be used
60327 to force an update of the queue display at any time.
60330 When a host is down for some time, a lot of pending mail can build up for it,
60331 and this can make it hard to deal with other messages on the queue. To help
60332 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
60333 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
60334 type anything in here and press <quote>Return</quote>, the text is added to a chain of
60335 such texts, and if every undelivered address in a message matches at least one
60336 of the texts, the message is not displayed.
60339 If there is an address that does not match any of the texts, all the addresses
60340 are displayed as normal. The matching happens on the ends of addresses so, for
60341 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
60342 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
60343 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
60344 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
60345 a hide request is automatically cancelled after one hour.
60348 While the dialogue box is displayed, you can’t press any buttons or do anything
60349 else to the monitor window. For this reason, if you want to cut text from the
60350 queue display to use in the dialogue box, you have to do the cutting before
60351 pressing the <quote>Hide</quote> button.
60354 The queue display contains, for each unhidden queued message, the length of
60355 time it has been on the queue, the size of the message, the message id, the
60356 message sender, and the first undelivered recipient, all on one line. If it is
60357 a bounce message, the sender is shown as <quote><></quote>. If there is more than one
60358 recipient to which the message has not yet been delivered, subsequent ones are
60359 listed on additional lines, up to a maximum configured number, following which
60360 an ellipsis is displayed. Recipients that have already received the message are
60364 <indexterm role="concept">
60365 <primary>frozen messages</primary>
60366 <secondary>display</secondary>
60368 If a message is frozen, an asterisk is displayed at the left-hand side.
60371 The queue display has a vertical scroll bar, and can also be scrolled by means
60372 of the arrow keys. Text can be cut from it using the mouse in the normal way.
60373 The text searching facilities, as described above for the log window, are also
60374 available, but the caret is always moved to the end of the text when the queue
60375 display is updated.
60378 <section id="SECID269">
60379 <title>The queue menu</title>
60381 <indexterm role="concept">
60382 <primary>queue</primary>
60383 <secondary>menu in monitor</secondary>
60385 If the <option>shift</option> key is held down and the left button is clicked when the mouse
60386 pointer is over the text for any message, an action menu pops up, and the first
60387 line of the queue display for the message is highlighted. This does not affect
60391 If you want to use some other event for popping up the menu, you can set the
60392 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
60393 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
60394 value set in this parameter is a standard X event description. For example, to
60395 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
60397 <literallayout class="monospaced">
60398 EXIMON_MENU_EVENT='Ctrl<Btn1Down>' eximon
60401 The title of the menu is the message id, and it contains entries which act as
60407 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
60408 in a new text window.
60413 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
60414 information and headers is displayed in a new text window. See chapter
60415 <xref linkend="CHAPspool"/> for a description of the format of spool files.
60420 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
60421 displayed in a new text window. There is a default limit of 20,000 bytes to the
60422 amount of data displayed. This can be changed by setting the BODY_MAX
60423 option at compile time, or the EXIMON_BODY_MAX option at run time.
60428 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
60429 delivery of the message. This causes an automatic thaw if the message is
60430 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
60431 a new text window. The delivery is run in a separate process, to avoid holding
60432 up the monitor while the delivery proceeds.
60437 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
60438 that the message be frozen.
60443 <indexterm role="concept">
60444 <primary>thawing messages</primary>
60446 <indexterm role="concept">
60447 <primary>unfreezing messages</primary>
60449 <indexterm role="concept">
60450 <primary>frozen messages</primary>
60451 <secondary>thawing</secondary>
60453 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
60454 that the message be thawed.
60459 <indexterm role="concept">
60460 <primary>delivery</primary>
60461 <secondary>forcing failure</secondary>
60463 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
60464 that Exim gives up trying to deliver the message. A bounce message is generated
60465 for any remaining undelivered addresses.
60470 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
60471 that the message be deleted from the system without generating a bounce
60477 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
60478 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
60479 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
60480 Otherwise it must be entered as a fully qualified address. Pressing RETURN
60481 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
60482 additional recipient be added to the message, unless the entry box is empty, in
60483 which case no action is taken.
60488 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
60489 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
60490 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
60491 Otherwise it must be entered as a fully qualified address. Pressing RETURN
60492 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
60493 recipient address as already delivered, unless the entry box is empty, in which
60494 case no action is taken.
60499 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
60500 mark all recipient addresses as already delivered.
60505 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
60506 sender’s address. Pressing RETURN causes a call to Exim to be made using the
60507 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
60508 in which case no action is taken. If you want to set an empty sender (as in
60509 bounce messages), you must specify it as <quote><></quote>. Otherwise, if the address is
60510 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
60511 the address is qualified with that domain.
60516 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
60517 other cases when a call to Exim is made, if there is any output from Exim (in
60518 particular, if the command fails) a window containing the command and the
60519 output is displayed. Otherwise, the results of the action are normally apparent
60520 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
60521 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
60522 if no output is generated.
60525 The queue display is automatically updated for actions such as freezing and
60526 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
60527 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
60528 force an update of the display after one of these actions.
60531 In any text window that is displayed as result of a menu action, the normal
60532 cut-and-paste facility is available, and searching can be carried out using ^R
60533 and ^S, as described above for the log tail window.
60534 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
60539 <chapter id="CHAPsecurity">
60540 <title>Security considerations</title>
60542 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
60543 <primary>security</primary>
60544 <secondary>discussion of</secondary>
60546 This chapter discusses a number of issues concerned with security, some of
60547 which are also covered in other parts of this manual.
60550 For reasons that this author does not understand, some people have promoted
60551 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
60552 existence of this chapter in the documentation. However, the intent of the
60553 chapter is simply to describe the way Exim works in relation to certain
60554 security concerns, not to make any specific claims about the effectiveness of
60555 its security as compared with other MTAs.
60558 What follows is a description of the way Exim is supposed to be. Best efforts
60559 have been made to try to ensure that the code agrees with the theory, but an
60560 absence of bugs can never be guaranteed. Any that are reported will get fixed
60561 as soon as possible.
60563 <section id="SECID286">
60564 <title>Building a more <quote>hardened</quote> Exim</title>
60566 <indexterm role="concept">
60567 <primary>security</primary>
60568 <secondary>build-time features</secondary>
60570 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
60571 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
60572 Exim administrator who does not have the root password, or by someone who has
60573 penetrated the Exim (but not the root) account. These options are as follows:
60578 ALT_CONFIG_PREFIX can be set to a string that is required to match the
60579 start of any file names used with the <option>-C</option> option. When it is set, these file
60580 names are also not allowed to contain the sequence <quote>/../</quote>. (However, if the
60581 value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
60582 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
60583 default setting for <option>ALT_CONFIG_PREFIX</option>.
60586 If the permitted configuration files are confined to a directory to
60587 which only root has access, this guards against someone who has broken
60588 into the Exim account from running a privileged Exim with an arbitrary
60589 configuration file, and using it to break into other accounts.
60594 If ALT_CONFIG_ROOT_ONLY is defined, root privilege is retained for <option>-C</option>
60595 and <option>-D</option> only if the caller of Exim is root. Without it, the Exim user may
60596 also use <option>-C</option> and <option>-D</option> and retain privilege. Setting this option locks out
60597 the possibility of testing a configuration using <option>-C</option> right through message
60598 reception and delivery, even if the caller is root. The reception works, but by
60599 that time, Exim is running as the Exim user, so when it re-execs to regain
60600 privilege for the delivery, the use of <option>-C</option> causes privilege to be lost.
60601 However, root can test reception and delivery using two separate commands.
60602 ALT_CONFIG_ROOT_ONLY is not set by default.
60607 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
60613 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
60614 never to be used for any deliveries. This is like the <option>never_users</option> runtime
60615 option, but it cannot be overridden; the runtime option adds additional users
60616 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
60617 is permitted to modify the runtime file from using Exim as a way to get root.
60622 <section id="SECID270">
60623 <title>Root privilege</title>
60625 <indexterm role="concept">
60626 <primary>setuid</primary>
60628 <indexterm role="concept">
60629 <primary>root privilege</primary>
60631 The Exim binary is normally setuid to root, which means that it gains root
60632 privilege (runs as root) when it starts execution. In some special cases (for
60633 example, when the daemon is not in use and there are no local deliveries), it
60634 may be possible to run Exim setuid to some user other than root. This is
60635 discussed in the next section. However, in most installations, root privilege
60636 is required for two things:
60641 To set up a socket connected to the standard SMTP port (25) when initialising
60642 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
60648 To be able to change uid and gid in order to read users’ <filename>.forward</filename> files and
60649 perform local deliveries as the receiving user or as specified in the
60655 It is not necessary to be root to do any of the other things Exim does, such as
60656 receiving messages and delivering them externally over SMTP, and it is
60657 obviously more secure if Exim does not run as root except when necessary.
60658 For this reason, a user and group for Exim to use must be defined in
60659 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
60660 group</quote>. Their values can be changed by the run time configuration, though this
60661 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
60662 <emphasis>mail</emphasis> or another user name altogether.
60665 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
60666 abdication; the process cannot regain root afterwards. Prior to release 4.00,
60667 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
60670 After a new Exim process has interpreted its command line options, it changes
60671 uid and gid in the following cases:
60676 <indexterm role="option">
60677 <primary><option>-C</option></primary>
60679 <indexterm role="option">
60680 <primary><option>-D</option></primary>
60682 If the <option>-C</option> option is used to specify an alternate configuration file, or if
60683 the <option>-D</option> option is used to define macro values for the configuration, and the
60684 calling process is not running as root or the Exim user, the uid and gid are
60685 changed to those of the calling process.
60686 However, if ALT_CONFIG_ROOT_ONLY is defined in <filename>Local/Makefile</filename>, only
60687 root callers may use <option>-C</option> and <option>-D</option> without losing privilege, and if
60688 DISABLE_D_OPTION is set, the <option>-D</option> option may not be used at all.
60693 <indexterm role="option">
60694 <primary><option>-be</option></primary>
60696 <indexterm role="option">
60697 <primary><option>-bf</option></primary>
60699 <indexterm role="option">
60700 <primary><option>-bF</option></primary>
60702 If the expansion test option (<option>-be</option>) or one of the filter testing options
60703 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
60709 If the process is not a daemon process or a queue runner process or a delivery
60710 process or a process for testing address routing (started with <option>-bt</option>), the
60711 uid and gid are changed to the Exim user and group. This means that Exim always
60712 runs under its own uid and gid when receiving messages. This also applies when
60713 testing address verification
60714 <indexterm role="option">
60715 <primary><option>-bv</option></primary>
60717 <indexterm role="option">
60718 <primary><option>-bh</option></primary>
60720 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
60726 For a daemon, queue runner, delivery, or address testing process, the uid
60727 remains as root at this stage, but the gid is changed to the Exim group.
60732 The processes that initially retain root privilege behave as follows:
60737 A daemon process changes the gid to the Exim group and the uid to the Exim
60738 user after setting up one or more listening sockets. The <function>initgroups()</function>
60739 function is called, so that if the Exim user is in any additional groups, they
60740 will be used during message reception.
60745 A queue runner process retains root privilege throughout its execution. Its
60746 job is to fork a controlled sequence of delivery processes.
60751 A delivery process retains root privilege throughout most of its execution,
60752 but any actual deliveries (that is, the transports themselves) are run in
60753 subprocesses which always change to a non-root uid and gid. For local
60754 deliveries this is typically the uid and gid of the owner of the mailbox; for
60755 remote deliveries, the Exim uid and gid are used. Once all the delivery
60756 subprocesses have been run, a delivery process changes to the Exim uid and gid
60757 while doing post-delivery tidying up such as updating the retry database and
60758 generating bounce and warning messages.
60761 While the recipient addresses in a message are being routed, the delivery
60762 process runs as root. However, if a user’s filter file has to be processed,
60763 this is done in a subprocess that runs under the individual user’s uid and
60764 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
60769 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
60770 the routing is done in the same environment as a message delivery.
60775 <section id="SECTrunexiwitpri">
60776 <title>Running Exim without privilege</title>
60778 <indexterm role="concept">
60779 <primary>privilege, running without</primary>
60781 <indexterm role="concept">
60782 <primary>unprivileged running</primary>
60784 <indexterm role="concept">
60785 <primary>root privilege</primary>
60786 <secondary>running without</secondary>
60788 Some installations like to run Exim in an unprivileged state for more of its
60789 operation, for added security. Support for this mode of operation is provided
60790 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
60791 gid are changed to the Exim user and group at the start of a delivery process
60792 (and also queue runner and address testing processes). This means that address
60793 routing is no longer run as root, and the deliveries themselves cannot change
60797 <indexterm role="concept">
60798 <primary>SIGHUP</primary>
60800 <indexterm role="concept">
60801 <primary>daemon</primary>
60802 <secondary>restarting</secondary>
60804 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
60805 that the daemon can still be started in the usual way, and it can respond
60806 correctly to SIGHUP because the re-invocation regains root privilege.
60809 An alternative approach is to make Exim setuid to the Exim user and also setgid
60810 to the Exim group. If you do this, the daemon must be started from a root
60811 process. (Calling Exim from a root process makes it behave in the way it does
60812 when it is setuid root.) However, the daemon cannot restart itself after a
60813 SIGHUP signal because it cannot regain privilege.
60816 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
60817 stops Exim from trying to re-invoke itself to do a delivery after a message has
60818 been received. Such a re-invocation is a waste of resources because it has no
60822 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
60823 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
60824 to the Exim user seems a clean approach, but there is one complication:
60827 In this style of operation, Exim is running with the real uid and gid set to
60828 those of the calling process, and the effective uid/gid set to Exim’s values.
60829 Ideally, any association with the calling process’ uid/gid should be dropped,
60830 that is, the real uid/gid should be reset to the effective values so as to
60831 discard any privileges that the caller may have. While some operating systems
60832 have a function that permits this action for a non-root effective uid, quite a
60833 number of them do not. Because of this lack of standardization, Exim does not
60834 address this problem at this time.
60837 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
60838 is to keep the Exim binary setuid to root, and to set
60839 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
60840 be used in the most straightforward way.
60843 If you configure Exim not to run delivery processes as root, there are a
60844 number of restrictions on what you can do:
60849 You can deliver only as the Exim user/group. You should explicitly use the
60850 <option>user</option> and <option>group</option> options to override routers or local transports that
60851 normally deliver as the recipient. This makes sure that configurations that
60852 work in this mode function the same way in normal mode. Any implicit or
60853 explicit specification of another user causes an error.
60858 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
60859 not worthwhile to include them in the configuration.
60864 Users who wish to use <filename>.forward</filename> would have to make their home directory and
60865 the file itself accessible to the Exim user. Pipe and append-to-file entries,
60866 and their equivalents in Exim filters, cannot be used. While they could be
60867 enabled in the Exim user’s name, that would be insecure and not very useful.
60872 Unless the local user mailboxes are all owned by the Exim user (possible in
60873 some POP3 or IMAP-only environments):
60875 <orderedlist numeration="arabic">
60878 They must be owned by the Exim group and be writeable by that group. This
60879 implies you must set <option>mode</option> in the appendfile configuration, as well as the
60880 mode of the mailbox files themselves.
60885 You must set <option>no_check_owner</option>, since most or all of the files will not be
60886 owned by the Exim user.
60891 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
60892 on a newly created mailbox when unprivileged. This also implies that new
60893 mailboxes need to be created manually.
60900 These restrictions severely restrict what can be done in local deliveries.
60901 However, there are no restrictions on remote deliveries. If you are running a
60902 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
60903 gives more security at essentially no cost.
60906 If you are using the <option>mua_wrapper</option> facility (see chapter
60907 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
60910 <section id="SECID271">
60911 <title>Delivering to local files</title>
60913 Full details of the checks applied by <command>appendfile</command> before it writes to a file
60914 are given in chapter <xref linkend="CHAPappendfile"/>.
60917 <section id="SECID272">
60918 <title>IPv4 source routing</title>
60920 <indexterm role="concept">
60921 <primary>source routing</primary>
60922 <secondary>in IP packets</secondary>
60924 <indexterm role="concept">
60925 <primary>IP source routing</primary>
60927 Many operating systems suppress IP source-routed packets in the kernel, but
60928 some cannot be made to do this, so Exim does its own check. It logs incoming
60929 IPv4 source-routed TCP calls, and then drops them. Things are all different in
60930 IPv6. No special checking is currently done.
60933 <section id="SECID273">
60934 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
60936 Support for these SMTP commands is disabled by default. If required, they can
60937 be enabled by defining suitable ACLs.
60940 <section id="SECID274">
60941 <title>Privileged users</title>
60943 <indexterm role="concept">
60944 <primary>trusted users</primary>
60946 <indexterm role="concept">
60947 <primary>admin user</primary>
60949 <indexterm role="concept">
60950 <primary>privileged user</primary>
60952 <indexterm role="concept">
60953 <primary>user</primary>
60954 <secondary>trusted</secondary>
60956 <indexterm role="concept">
60957 <primary>user</primary>
60958 <secondary>admin</secondary>
60960 Exim recognizes two sets of users with special privileges. Trusted users are
60961 able to submit new messages to Exim locally, but supply their own sender
60962 addresses and information about a sending host. For other users submitting
60963 local messages, Exim sets up the sender address from the uid, and doesn’t
60964 permit a remote host to be specified.
60967 <indexterm role="option">
60968 <primary><option>-f</option></primary>
60970 However, an untrusted user is permitted to use the <option>-f</option> command line option
60971 in the special form <option>-f <></option> to indicate that a delivery failure for the
60972 message should not cause an error report. This affects the message’s envelope,
60973 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
60974 permitted to use specific forms of address with the <option>-f</option> option by setting
60975 the <option>untrusted_set_sender</option> option.
60978 Trusted users are used to run processes that receive mail messages from some
60979 other mail domain and pass them on to Exim for delivery either locally, or over
60980 the Internet. Exim trusts a caller that is running as root, as the Exim user,
60981 as any user listed in the <option>trusted_users</option> configuration option, or under any
60982 group listed in the <option>trusted_groups</option> option.
60985 Admin users are permitted to do things to the messages on Exim’s queue. They
60986 can freeze or thaw messages, cause them to be returned to their senders, remove
60987 them entirely, or modify them in various ways. In addition, admin users can run
60988 the Exim monitor and see all the information it is capable of providing, which
60989 includes the contents of files on the spool.
60992 <indexterm role="option">
60993 <primary><option>-M</option></primary>
60995 <indexterm role="option">
60996 <primary><option>-q</option></primary>
60998 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
60999 delivery of messages on its queue is restricted to admin users. This
61000 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
61001 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
61002 queue is also restricted to admin users. This restriction can be relaxed by
61003 setting <option>no_queue_list_requires_admin</option>.
61006 Exim recognizes an admin user if the calling process is running as root or as
61007 the Exim user or if any of the groups associated with the calling process is
61008 the Exim group. It is not necessary actually to be running under the Exim
61009 group. However, if admin users who are not root or the Exim user are to access
61010 the contents of files on the spool via the Exim monitor (which runs
61011 unprivileged), Exim must be built to allow group read access to its spool
61015 <section id="SECID275">
61016 <title>Spool files</title>
61018 <indexterm role="concept">
61019 <primary>spool directory</primary>
61020 <secondary>files</secondary>
61022 Exim’s spool directory and everything it contains is owned by the Exim user and
61023 set to the Exim group. The mode for spool files is defined in the
61024 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
61025 any user who is a member of the Exim group can access these files.
61028 <section id="SECID276">
61029 <title>Use of argv[0]</title>
61031 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
61032 of specific strings, Exim assumes certain options. For example, calling Exim
61033 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
61034 to calling it with the option <option>-bS</option>. There are no security implications in
61038 <section id="SECID277">
61039 <title>Use of %f formatting</title>
61041 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
61042 are actually stored in integer variables as 1000 times the load average.
61043 Consequently, their range is limited and so therefore is the length of the
61047 <section id="SECID278">
61048 <title>Embedded Exim path</title>
61050 Exim uses its own path name, which is embedded in the code, only when it needs
61051 to re-exec in order to regain root privilege. Therefore, it is not root when it
61052 does so. If some bug allowed the path to get overwritten, it would lead to an
61053 arbitrary program’s being run as exim, not as root.
61056 <section id="SECID279">
61057 <title>Use of sprintf()</title>
61059 <indexterm role="concept">
61060 <primary><function>sprintf()</function></primary>
61062 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
61063 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc’d store.
61064 The intermediate formatting is done into a large fixed buffer by a function
61065 that runs through the format string itself, and checks the length of each
61066 conversion before performing it, thus preventing buffer overruns.
61069 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
61070 the output buffer is known to be sufficiently long to contain the converted
61074 <section id="SECID280">
61075 <title>Use of debug_printf() and log_write()</title>
61077 Arbitrary strings are passed to both these functions, but they do their
61078 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
61079 the format string itself, and checks the length of each conversion.
61082 <section id="SECID281">
61083 <title>Use of strcat() and strcpy()</title>
61085 These are used only in cases where the output buffer is known to be large
61086 enough to hold the result.
61087 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
61092 <chapter id="CHAPspool">
61093 <title>Format of spool files</title>
61095 <indexterm role="concept" id="IIDforspo1" class="startofrange">
61096 <primary>format</primary>
61097 <secondary>spool files</secondary>
61099 <indexterm role="concept" id="IIDforspo2" class="startofrange">
61100 <primary>spool directory</primary>
61101 <secondary>format of files</secondary>
61103 <indexterm role="concept" id="IIDforspo3" class="startofrange">
61104 <primary>spool files</primary>
61105 <secondary>format of</secondary>
61107 <indexterm role="concept">
61108 <primary>spool files</primary>
61109 <secondary>editing</secondary>
61111 A message on Exim’s queue consists of two files, whose names are the message id
61112 followed by -D and -H, respectively. The data portion of the message is kept in
61113 the -D file on its own. The message’s envelope, status, and headers are all
61114 kept in the -H file, whose format is described in this chapter. Each of these
61115 two files contains the final component of its own name as its first line. This
61116 is insurance against disk crashes where the directory is lost but the files
61117 themselves are recoverable.
61120 Some people are tempted into editing -D files in order to modify messages. You
61121 need to be extremely careful if you do this; it is not recommended and you are
61122 on your own if you do it. Here are some of the pitfalls:
61127 You must ensure that Exim does not try to deliver the message while you are
61128 fiddling with it. The safest way is to take out a write lock on the -D file,
61129 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
61130 place, the lock will be retained. If you write a new file and rename it, the
61131 lock will be lost at the instant of rename.
61136 <indexterm role="variable">
61137 <primary><varname>$body_linecount</varname></primary>
61139 If you change the number of lines in the file, the value of
61140 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect. At
61141 present, this value is not used by Exim, but there is no guarantee that this
61142 will always be the case.
61147 If the message is in MIME format, you must take care not to break it.
61152 If the message is cryptographically signed, any change will invalidate the
61158 All in all, modifying -D files is fraught with danger.
61161 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
61162 its subdirectories when <option>split_spool_directory</option> is set). These are journal
61163 files, used to record addresses to which the message has been delivered during
61164 the course of a delivery attempt. If there are still undelivered recipients at
61165 the end, the -H file is updated, and the -J file is deleted. If, however, there
61166 is some kind of crash (for example, a power outage) before this happens, the -J
61167 file remains in existence. When Exim next processes the message, it notices the
61168 -J file and uses it to update the -H file before starting the next delivery
61171 <section id="SECID282">
61172 <title>Format of the -H file</title>
61174 <indexterm role="concept">
61175 <primary>uid (user id)</primary>
61176 <secondary>in spool file</secondary>
61178 <indexterm role="concept">
61179 <primary>gid (group id)</primary>
61180 <secondary>in spool file</secondary>
61182 The second line of the -H file contains the login name for the uid of the
61183 process that called Exim to read the message, followed by the numerical uid and
61184 gid. For a locally generated message, this is normally the user who sent the
61185 message. For a message received over TCP/IP via the daemon, it is
61186 normally the Exim user.
61189 The third line of the file contains the address of the message’s sender as
61190 transmitted in the envelope, contained in angle brackets. The sender address is
61191 empty for bounce messages. For incoming SMTP mail, the sender address is given
61192 in the MAIL command. For locally generated mail, the sender address is
61193 created by Exim from the login name of the current user and the configured
61194 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
61195 leading <quote>From </quote> line if the caller is trusted, or if the supplied address is
61196 <quote><></quote> or an address that matches <option>untrusted_set_senders</option>.
61199 The fourth line contains two numbers. The first is the time that the message
61200 was received, in the conventional Unix form – the number of seconds since the
61201 start of the epoch. The second number is a count of the number of messages
61202 warning of delayed delivery that have been sent to the sender.
61205 There follow a number of lines starting with a hyphen. These can appear in any
61206 order, and are omitted when not relevant:
61210 <term><option>-acl</option> <<emphasis>number</emphasis>> <<emphasis>length</emphasis>></term>
61213 This item is obsolete, and is not generated from Exim release 4.61 onwards;
61214 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
61215 recognized, to provide backward compatibility. In the old format, a line of
61216 this form is present for every ACL variable that is not empty. The number
61217 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0–9 and
61218 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10–19. The length is the length of
61219 the data string for the variable. The string itself starts at the beginning of
61220 the next line, and is followed by a newline character. It may contain internal
61223 </listitem></varlistentry>
61225 <term><option>-aclc</option> <<emphasis>rest-of-name</emphasis>> <<emphasis>length</emphasis>></term>
61228 A line of this form is present for every ACL connection variable that is
61229 defined. Note that there is a space between <option>-aclc</option> and the rest of the name.
61230 The length is the length of the data string for the variable. The string itself
61231 starts at the beginning of the next line, and is followed by a newline
61232 character. It may contain internal newlines.
61234 </listitem></varlistentry>
61236 <term><option>-aclm</option> <<emphasis>rest-of-name</emphasis>> <<emphasis>length</emphasis>></term>
61239 A line of this form is present for every ACL message variable that is defined.
61240 Note that there is a space between <option>-aclm</option> and the rest of the name. The
61241 length is the length of the data string for the variable. The string itself
61242 starts at the beginning of the next line, and is followed by a newline
61243 character. It may contain internal newlines.
61245 </listitem></varlistentry>
61247 <term><option>-active_hostname</option> <<emphasis>hostname</emphasis>></term>
61250 This is present if, when the message was received over SMTP, the value of
61251 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
61253 </listitem></varlistentry>
61255 <term><option>-allow_unqualified_recipient</option></term>
61258 This is present if unqualified recipient addresses are permitted in header
61259 lines (to stop such addresses from being qualified if rewriting occurs at
61260 transport time). Local messages that were input using <option>-bnq</option> and remote
61261 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
61263 </listitem></varlistentry>
61265 <term><option>-allow_unqualified_sender</option></term>
61268 This is present if unqualified sender addresses are permitted in header lines
61269 (to stop such addresses from being qualified if rewriting occurs at transport
61270 time). Local messages that were input using <option>-bnq</option> and remote messages from
61271 hosts that match <option>sender_unqualified_hosts</option> set this flag.
61273 </listitem></varlistentry>
61275 <term><option>-auth_id</option> <<emphasis>text</emphasis>></term>
61278 The id information for a message received on an authenticated SMTP connection
61279 – the value of the <varname>$authenticated_id</varname> variable.
61281 </listitem></varlistentry>
61283 <term><option>-auth_sender</option> <<emphasis>address</emphasis>></term>
61286 The address of an authenticated sender – the value of the
61287 <varname>$authenticated_sender</varname> variable.
61289 </listitem></varlistentry>
61291 <term><option>-body_linecount</option> <<emphasis>number</emphasis>></term>
61294 This records the number of lines in the body of the message, and is always
61297 </listitem></varlistentry>
61299 <term><option>-body_zerocount</option> <<emphasis>number</emphasis>></term>
61302 This records the number of binary zero bytes in the body of the message, and is
61303 present if the number is greater than zero.
61305 </listitem></varlistentry>
61307 <term><option>-deliver_firsttime</option></term>
61310 This is written when a new message is first added to the spool. When the spool
61311 file is updated after a deferral, it is omitted.
61313 </listitem></varlistentry>
61315 <term><option>-frozen</option> <<emphasis>time</emphasis>></term>
61318 <indexterm role="concept">
61319 <primary>frozen messages</primary>
61320 <secondary>spool data</secondary>
61322 The message is frozen, and the freezing happened at <<emphasis>time</emphasis>>.
61324 </listitem></varlistentry>
61326 <term><option>-helo_name</option> <<emphasis>text</emphasis>></term>
61329 This records the host name as specified by a remote host in a HELO or EHLO
61332 </listitem></varlistentry>
61334 <term><option>-host_address</option> <<emphasis>address</emphasis>>.<<emphasis>port</emphasis>></term>
61337 This records the IP address of the host from which the message was received and
61338 the remote port number that was used. It is omitted for locally generated
61341 </listitem></varlistentry>
61343 <term><option>-host_auth</option> <<emphasis>text</emphasis>></term>
61346 If the message was received on an authenticated SMTP connection, this records
61347 the name of the authenticator – the value of the
61348 <varname>$sender_host_authenticated</varname> variable.
61350 </listitem></varlistentry>
61352 <term><option>-host_lookup_failed</option></term>
61355 This is present if an attempt to look up the sending host’s name from its IP
61356 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
61358 </listitem></varlistentry>
61360 <term><option>-host_name</option> <<emphasis>text</emphasis>></term>
61363 <indexterm role="concept">
61364 <primary>reverse DNS lookup</primary>
61366 <indexterm role="concept">
61367 <primary>DNS</primary>
61368 <secondary>reverse lookup</secondary>
61370 This records the name of the remote host from which the message was received,
61371 if the host name was looked up from the IP address when the message was being
61372 received. It is not present if no reverse lookup was done.
61374 </listitem></varlistentry>
61376 <term><option>-ident</option> <<emphasis>text</emphasis>></term>
61379 For locally submitted messages, this records the login of the originating user,
61380 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
61381 ident value. For messages received over TCP/IP, this records the ident string
61382 supplied by the remote host, if any.
61384 </listitem></varlistentry>
61386 <term><option>-interface_address</option> <<emphasis>address</emphasis>>.<<emphasis>port</emphasis>></term>
61389 This records the IP address of the local interface and the port number through
61390 which a message was received from a remote host. It is omitted for locally
61391 generated messages.
61393 </listitem></varlistentry>
61395 <term><option>-local</option></term>
61398 The message is from a local sender.
61400 </listitem></varlistentry>
61402 <term><option>-localerror</option></term>
61405 The message is a locally-generated bounce message.
61407 </listitem></varlistentry>
61409 <term><option>-local_scan</option> <<emphasis>string</emphasis>></term>
61412 This records the data string that was returned by the <function>local_scan()</function> function
61413 when the message was received – the value of the <varname>$local_scan_data</varname>
61414 variable. It is omitted if no data was returned.
61416 </listitem></varlistentry>
61418 <term><option>-manual_thaw</option></term>
61421 The message was frozen but has been thawed manually, that is, by an explicit
61422 Exim command rather than via the auto-thaw process.
61424 </listitem></varlistentry>
61426 <term><option>-N</option></term>
61429 A testing delivery process was started using the <option>-N</option> option to suppress any
61430 actual deliveries, but delivery was deferred. At any further delivery attempts,
61431 <option>-N</option> is assumed.
61433 </listitem></varlistentry>
61435 <term><option>-received_protocol</option></term>
61438 This records the value of the <varname>$received_protocol</varname> variable, which contains
61439 the name of the protocol by which the message was received.
61441 </listitem></varlistentry>
61443 <term><option>-sender_set_untrusted</option></term>
61446 The envelope sender of this message was set by an untrusted local caller (used
61447 to ensure that the caller is displayed in queue listings).
61449 </listitem></varlistentry>
61451 <term><option>-spam_score_int</option> <<emphasis>number</emphasis>></term>
61454 If a message was scanned by SpamAssassin, this is present. It records the value
61455 of <varname>$spam_score_int</varname>.
61457 </listitem></varlistentry>
61459 <term><option>-tls_certificate_verified</option></term>
61462 A TLS certificate was received from the client that sent this message, and the
61463 certificate was verified by the server.
61465 </listitem></varlistentry>
61467 <term><option>-tls_cipher</option> <<emphasis>cipher name</emphasis>></term>
61470 When the message was received over an encrypted connection, this records the
61471 name of the cipher suite that was used.
61473 </listitem></varlistentry>
61475 <term><option>-tls_peerdn</option> <<emphasis>peer DN</emphasis>></term>
61478 When the message was received over an encrypted connection, and a certificate
61479 was received from the client, this records the Distinguished Name from that
61482 </listitem></varlistentry>
61485 Following the options there is a list of those addresses to which the message
61486 is not to be delivered. This set of addresses is initialized from the command
61487 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
61488 is set; otherwise it starts out empty. Whenever a successful delivery is made,
61489 the address is added to this set. The addresses are kept internally as a
61490 balanced binary tree, and it is a representation of that tree which is written
61491 to the spool file. If an address is expanded via an alias or forward file, the
61492 original address is added to the tree when deliveries to all its child
61493 addresses are complete.
61496 If the tree is empty, there is a single line in the spool file containing just
61497 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
61498 Y or N, followed by an address. The address is the value for the node of the
61499 tree, and the letters indicate whether the node has a left branch and/or a
61500 right branch attached to it, respectively. If branches exist, they immediately
61501 follow. Here is an example of a three-node tree:
61503 <literallayout class="monospaced">
61504 YY darcy@austen.fict.example
61505 NN alice@wonderland.fict.example
61506 NN editor@thesaurus.ref.example
61509 After the non-recipients tree, there is a list of the message’s recipients.
61510 This is a simple list, preceded by a count. It includes all the original
61511 recipients of the message, including those to whom the message has already been
61512 delivered. In the simplest case, the list contains one address per line. For
61515 <literallayout class="monospaced">
61517 editor@thesaurus.ref.example
61518 darcy@austen.fict.example
61520 alice@wonderland.fict.example
61523 However, when a child address has been added to the top-level addresses as a
61524 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
61525 line is of the following form:
61528 <<emphasis>top-level address</emphasis>> <<emphasis>errors_to address</emphasis>> <<emphasis>length</emphasis>>,<<emphasis>parent number</emphasis>>#<<emphasis>flag bits</emphasis>>
61531 The 01 flag bit indicates the presence of the three other fields that follow
61532 the top-level address. Other bits may be used in future to support additional
61533 fields. The <<emphasis>parent number</emphasis>> is the offset in the recipients list of the
61534 original parent of the <quote>one time</quote> address. The first two fields are the
61535 envelope sender that is associated with this address and its length. If the
61536 length is zero, there is no special envelope sender (there are then two space
61537 characters in the line). A non-empty field can arise from a <command>redirect</command> router
61538 that has an <option>errors_to</option> setting.
61541 A blank line separates the envelope and status information from the headers
61542 which follow. A header may occupy several lines of the file, and to save effort
61543 when reading it in, each header is preceded by a number and an identifying
61544 character. The number is the number of characters in the header, including any
61545 embedded newlines and the terminating newline. The character is one of the
61548 <informaltable frame="none">
61549 <tgroup cols="2" colsep="0" rowsep="0">
61550 <colspec colwidth="50pt" align="left"/>
61551 <colspec colwidth="254pt" align="left"/>
61554 <entry><<emphasis>blank</emphasis>></entry>
61555 <entry>header in which Exim has no special interest</entry>
61558 <entry><literal>B</literal></entry>
61559 <entry><emphasis>Bcc:</emphasis> header</entry>
61562 <entry><literal>C</literal></entry>
61563 <entry><emphasis>Cc:</emphasis> header</entry>
61566 <entry><literal>F</literal></entry>
61567 <entry><emphasis>From:</emphasis> header</entry>
61570 <entry><literal>I</literal></entry>
61571 <entry><emphasis>Message-id:</emphasis> header</entry>
61574 <entry><literal>P</literal></entry>
61575 <entry><emphasis>Received:</emphasis> header – P for <quote>postmark</quote></entry>
61578 <entry><literal>R</literal></entry>
61579 <entry><emphasis>Reply-To:</emphasis> header</entry>
61582 <entry><literal>S</literal></entry>
61583 <entry><emphasis>Sender:</emphasis> header</entry>
61586 <entry><literal>T</literal></entry>
61587 <entry><emphasis>To:</emphasis> header</entry>
61590 <entry><literal>*</literal></entry>
61591 <entry>replaced or deleted header</entry>
61597 Deleted or replaced (rewritten) headers remain in the spool file for debugging
61598 purposes. They are not transmitted when the message is delivered. Here is a
61599 typical set of headers:
61601 <literallayout class="monospaced">
61602 111P Received: by hobbit.fict.example with local (Exim 4.00)
61603 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
61604 049 Message-Id: <E14y9EI-00026G-00@hobbit.fict.example>
61605 038* X-rewrote-sender: bb@hobbit.fict.example
61606 042* From: Bilbo Baggins <bb@hobbit.fict.example>
61607 049F From: Bilbo Baggins <B.Baggins@hobbit.fict.example>
61608 099* To: alice@wonderland.fict.example, rdo@foundation,
61609 darcy@austen.fict.example, editor@thesaurus.ref.example
61610 104T To: alice@wonderland.fict.example, rdo@foundation.example,
61611 darcy@austen.fict.example, editor@thesaurus.ref.example
61612 038 Date: Fri, 11 May 2001 10:28:59 +0100
61615 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
61616 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
61617 unqualified domain <emphasis>foundation</emphasis>.
61618 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
61619 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
61620 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
61625 <chapter id="CHID12" revisionflag="changed">
61626 <title>Support for DKIM (DomainKeys Identified Mail) - RFC4871</title>
61627 <titleabbrev>DKIM Support</titleabbrev>
61628 <para revisionflag="changed">
61629 <indexterm role="concept">
61630 <primary>DKIM</primary>
61633 <para revisionflag="changed">
61634 Since version 4.70, DKIM support is compiled into Exim by default. It can be
61635 disabled by setting DISABLE_DKIM=yes in Local/Makefile.
61637 <para revisionflag="changed">
61638 Exim’s DKIM implementation allows to
61640 <orderedlist numeration="arabic" revisionflag="changed">
61642 <para revisionflag="changed">
61643 Sign outgoing messages: This function is implemented in the SMTP transport.
61644 It can co-exist with all other Exim features, including transport filters.
61648 <para revisionflag="changed">
61649 Verify signatures in incoming messages: This is implemented by an additional
61650 ACL (acl_smtp_dkim), which can be called several times per message, with
61651 different signature context.
61655 <para revisionflag="changed">
61656 In typical Exim style, the verification implementation does not include any
61657 default "policy". Instead it enables you to build your own policy using
61658 Exim’s standard controls.
61660 <para revisionflag="changed">
61661 Please note that verification of DKIM signatures in incoming mail is turned
61662 on by default for logging purposes. For each signature in incoming email,
61663 exim will log a line displaying the most important signature details, and the
61664 signature status. Here is an example:
61666 <literallayout class="monospaced" revisionflag="changed">
61667 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]
61669 <para revisionflag="changed">
61670 You might want to turn off DKIM verification processing entirely for internal
61671 or relay mail sources. To do that, set the <option>dkim_disable_verify</option> ACL
61672 control modifier. This should typically be done in the RCPT ACL, at points
61673 where you accept mail from relay sources (internal hosts or authenticated
61676 <section id="SECID513" revisionflag="changed">
61677 <title>Signing outgoing messages</title>
61678 <para revisionflag="changed">
61679 <indexterm role="concept">
61680 <primary>DKIM</primary>
61681 <secondary>signing</secondary>
61684 <para revisionflag="changed">
61685 Signing is implemented by setting private options on the SMTP transport.
61686 These options take (expandable) strings as arguments.
61688 <para revisionflag="changed">
61689 <indexterm role="option">
61690 <primary><option>dkim_domain</option></primary>
61693 <informaltable frame="all" revisionflag="changed">
61694 <tgroup cols="4" colsep="0" rowsep="0">
61695 <colspec colwidth="8*" align="left"/>
61696 <colspec colwidth="6*" align="center"/>
61697 <colspec colwidth="6*" align="center"/>
61698 <colspec colwidth="6*" align="right"/>
61701 <entry><option>dkim_domain</option></entry>
61702 <entry>Use: <emphasis>smtp</emphasis></entry>
61703 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
61704 <entry>Default: <emphasis>unset</emphasis></entry>
61709 <para revisionflag="changed">
61711 The domain you want to sign with. The result of this expanded
61712 option is put into the <option>$dkim_domain</option> expansion variable.
61714 <para revisionflag="changed">
61715 <indexterm role="option">
61716 <primary><option>dkim_selector</option></primary>
61719 <informaltable frame="all" revisionflag="changed">
61720 <tgroup cols="4" colsep="0" rowsep="0">
61721 <colspec colwidth="8*" align="left"/>
61722 <colspec colwidth="6*" align="center"/>
61723 <colspec colwidth="6*" align="center"/>
61724 <colspec colwidth="6*" align="right"/>
61727 <entry><option>dkim_selector</option></entry>
61728 <entry>Use: <emphasis>smtp</emphasis></entry>
61729 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
61730 <entry>Default: <emphasis>unset</emphasis></entry>
61735 <para revisionflag="changed">
61737 This sets the key selector string. You can use the <option>$dkim_domain</option> expansion
61738 variable to look up a matching selector. The result is put in the expansion
61739 variable <option>$dkim_selector</option> which should be used in the <option>dkim_private_key</option>
61740 option along with <option>$dkim_domain</option>.
61742 <para revisionflag="changed">
61743 <indexterm role="option">
61744 <primary><option>dkim_private_key</option></primary>
61747 <informaltable frame="all" revisionflag="changed">
61748 <tgroup cols="4" colsep="0" rowsep="0">
61749 <colspec colwidth="8*" align="left"/>
61750 <colspec colwidth="6*" align="center"/>
61751 <colspec colwidth="6*" align="center"/>
61752 <colspec colwidth="6*" align="right"/>
61755 <entry><option>dkim_private_key</option></entry>
61756 <entry>Use: <emphasis>smtp</emphasis></entry>
61757 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
61758 <entry>Default: <emphasis>unset</emphasis></entry>
61763 <para revisionflag="changed">
61765 This sets the private key to use. You can use the <option>$dkim_domain</option> and
61766 <option>$dkim_selector</option> expansion variables to determine the private key to use.
61767 The result can either
61769 <itemizedlist revisionflag="changed">
61771 <para revisionflag="changed">
61772 be a valid RSA private key in ASCII armor, including line breaks.
61776 <para revisionflag="changed">
61777 start with a slash, in which case it is treated as a file that contains
61782 <para revisionflag="changed">
61783 be "0", "false" or the empty string, in which case the message will not
61784 be signed. This case will not result in an error, even if <option>dkim_strict</option>
61789 <para revisionflag="changed">
61790 <indexterm role="option">
61791 <primary><option>dkim_canon</option></primary>
61794 <informaltable frame="all" revisionflag="changed">
61795 <tgroup cols="4" colsep="0" rowsep="0">
61796 <colspec colwidth="8*" align="left"/>
61797 <colspec colwidth="6*" align="center"/>
61798 <colspec colwidth="6*" align="center"/>
61799 <colspec colwidth="6*" align="right"/>
61802 <entry><option>dkim_canon</option></entry>
61803 <entry>Use: <emphasis>smtp</emphasis></entry>
61804 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
61805 <entry>Default: <emphasis>unset</emphasis></entry>
61810 <para revisionflag="changed">
61812 This option sets the canonicalization method used when signing a message.
61813 The DKIM RFC currently supports two methods: "simple" and "relaxed".
61814 The option defaults to "relaxed" when unset. Note: the current implementation
61815 only supports using the same canonicalization method for both headers and body.
61817 <para revisionflag="changed">
61818 <indexterm role="option">
61819 <primary><option>dkim_strict</option></primary>
61822 <informaltable frame="all" revisionflag="changed">
61823 <tgroup cols="4" colsep="0" rowsep="0">
61824 <colspec colwidth="8*" align="left"/>
61825 <colspec colwidth="6*" align="center"/>
61826 <colspec colwidth="6*" align="center"/>
61827 <colspec colwidth="6*" align="right"/>
61830 <entry><option>dkim_strict</option></entry>
61831 <entry>Use: <emphasis>smtp</emphasis></entry>
61832 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
61833 <entry>Default: <emphasis>unset</emphasis></entry>
61838 <para revisionflag="changed">
61840 This option defines how Exim behaves when signing a message that
61841 should be signed fails for some reason. When the expansion evaluates to
61842 either "1" or "true", Exim will defer. Otherwise Exim will send the message
61843 unsigned. You can use the <option>$dkim_domain</option> and <option>$dkim_selector</option> expansion
61846 <para revisionflag="changed">
61847 <indexterm role="option">
61848 <primary><option>dkim_sign_headers</option></primary>
61851 <informaltable frame="all" revisionflag="changed">
61852 <tgroup cols="4" colsep="0" rowsep="0">
61853 <colspec colwidth="8*" align="left"/>
61854 <colspec colwidth="6*" align="center"/>
61855 <colspec colwidth="6*" align="center"/>
61856 <colspec colwidth="6*" align="right"/>
61859 <entry><option>dkim_sign_headers</option></entry>
61860 <entry>Use: <emphasis>smtp</emphasis></entry>
61861 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
61862 <entry>Default: <emphasis>unset</emphasis></entry>
61867 <para revisionflag="changed">
61869 When set, this option must expand to (or be specified as) a colon-separated
61870 list of header names. Headers with these names will be included in the message
61871 signature. When unspecified, the header names recommended in RFC4871 will be
61875 <section id="SECID514" revisionflag="changed">
61876 <title>Verifying DKIM signatures in incoming mail</title>
61877 <para revisionflag="changed">
61878 <indexterm role="concept">
61879 <primary>DKIM</primary>
61880 <secondary>verification</secondary>
61883 <para revisionflag="changed">
61884 Verification of DKIM signatures in incoming email is implemented via the
61885 <option>acl_smtp_dkim</option> ACL. By default, this ACL is called once for each
61886 syntactically(!) correct signature in the incoming message.
61888 <para revisionflag="changed">
61889 To evaluate the signature in the ACL a large number of expansion variables
61890 containing the signature status and its details are set up during the
61891 runtime of the ACL.
61893 <para revisionflag="changed">
61894 Calling the ACL only for existing signatures is not sufficient to build
61895 more advanced policies. For that reason, the global option
61896 <option>dkim_verify_signers</option>, and a global expansion variable
61897 <option>$dkim_signers</option> exist.
61899 <para revisionflag="changed">
61900 The global option <option>dkim_verify_signers</option> can be set to a colon-separated
61901 list of DKIM domains or identities for which the ACL <option>acl_smtp_dkim</option> is
61902 called. It is expanded when the message has been received. At this point,
61903 the expansion variable <option>$dkim_signers</option> already contains a colon-
61904 separated list of signer domains and identities for the message. When
61905 <option>dkim_verify_signers</option> is not specified in the main configuration,
61908 <literallayout class="monospaced" revisionflag="changed">
61909 dkim_verify_signers = $dkim_signers
61911 <para revisionflag="changed">
61912 This leads to the default behaviour of calling <option>acl_smtp_dkim</option> for each
61913 DKIM signature in the message. Current DKIM verifiers may want to explicitly
61914 call the ACL for known domains or identities. This would be achieved as follows:
61916 <literallayout class="monospaced" revisionflag="changed">
61917 dkim_verify_signers = paypal.com:ebay.com:$dkim_signers
61919 <para revisionflag="changed">
61920 This would result in <option>acl_smtp_dkim</option> always being called for "paypal.com"
61921 and "ebay.com", plus all domains and identities that have signatures in the message.
61922 You can also be more creative in constructing your policy. Example:
61924 <literallayout class="monospaced" revisionflag="changed">
61925 dkim_verify_signers = $sender_address_domain:$dkim_signers
61927 <para revisionflag="changed">
61928 If a domain or identity is listed several times in the (expanded) value of
61929 <option>dkim_verify_signers</option>, the ACL is only called once for that domain or identity.
61931 <para revisionflag="changed">
61932 Inside the <option>acl_smtp_dkim</option>, the following expansion variables are
61933 available (from most to least important):
61935 <variablelist revisionflag="changed">
61936 <varlistentry revisionflag="changed">
61937 <term><option>$dkim_cur_signer</option></term>
61939 <para revisionflag="changed">
61940 The signer that is being evaluated in this ACL run. This can be domain or
61941 an identity. This is one of the list items from the expanded main option
61942 <option>dkim_verify_signers</option> (see above).
61944 </listitem></varlistentry>
61945 <varlistentry revisionflag="changed">
61946 <term><option>$dkim_verify_status</option></term>
61948 <para revisionflag="changed">
61949 A string describing the general status of the signature. One of
61951 <itemizedlist revisionflag="changed">
61953 <para revisionflag="changed">
61954 <option>none</option>: There is no signature in the message for the current domain or
61955 identity (as reflected by <option>$dkim_cur_signer</option>).
61959 <para revisionflag="changed">
61960 <option>invalid</option>: The signature could not be verified due to a processing error.
61961 More detail is available in <option>$dkim_verify_reason</option>.
61965 <para revisionflag="changed">
61966 <option>fail</option>: Verification of the signature failed. More detail is
61967 available in <option>$dkim_verify_reason</option>.
61971 <para revisionflag="changed">
61972 <option>pass</option>: The signature passed verification. It is valid.
61976 </listitem></varlistentry>
61977 <varlistentry revisionflag="changed">
61978 <term><option>$dkim_verify_reason</option></term>
61980 <para revisionflag="changed">
61981 A string giving a litte bit more detail when <option>$dkim_verify_status</option> is either
61982 "fail" or "invalid". One of
61984 <itemizedlist revisionflag="changed">
61986 <para revisionflag="changed">
61987 <option>pubkey_unavailable</option> (when <option>$dkim_verify_status</option>="invalid"): The public
61988 key for the domain could not be retrieved. This may be a temporary problem.
61992 <para revisionflag="changed">
61993 <option>pubkey_syntax</option> (when <option>$dkim_verify_status</option>="invalid"): The public key
61994 record for the domain is syntactically invalid.
61998 <para revisionflag="changed">
61999 <option>bodyhash_mismatch</option> (when <option>$dkim_verify_status</option>="fail"): The calculated
62000 body hash does not match the one specified in the signature header. This
62001 means that the message body was modified in transit.
62005 <para revisionflag="changed">
62006 <option>signature_incorrect</option> (when <option>$dkim_verify_status</option>="fail"): The signature
62007 could not be verified. This may mean that headers were modified,
62008 re-written or otherwise changed in a way which is incompatible with
62009 DKIM verification. It may of course also mean that the signature is forged.
62013 </listitem></varlistentry>
62014 <varlistentry revisionflag="changed">
62015 <term><option>$dkim_domain</option></term>
62017 <para revisionflag="changed">
62018 The signing domain. IMPORTANT: This variable is only populated if there is
62019 an actual signature in the message for the current domain or identity (as
62020 reflected by <option>$dkim_cur_signer</option>).
62022 </listitem></varlistentry>
62023 <varlistentry revisionflag="changed">
62024 <term><option>$dkim_identity</option></term>
62026 <para revisionflag="changed">
62027 The signing identity, if present. IMPORTANT: This variable is only populated
62028 if there is an actual signature in the message for the current domain or
62029 identity (as reflected by <option>$dkim_cur_signer</option>).
62031 </listitem></varlistentry>
62032 <varlistentry revisionflag="changed">
62033 <term><option>$dkim_selector</option></term>
62035 <para revisionflag="changed">
62036 The key record selector string
62038 </listitem></varlistentry>
62039 <varlistentry revisionflag="changed">
62040 <term><option>$dkim_algo</option></term>
62042 <para revisionflag="changed">
62043 The algorithm used. One of ’rsa-sha1’ or ’rsa-sha256’.
62045 </listitem></varlistentry>
62046 <varlistentry revisionflag="changed">
62047 <term><option>$dkim_canon_body</option></term>
62049 <para revisionflag="changed">
62050 The body canonicalization method. One of ’relaxed’ or ’simple’.
62052 </listitem></varlistentry>
62053 <varlistentry revisionflag="changed">
62054 <term><option>dkim_canon_headers</option></term>
62056 <para revisionflag="changed">
62057 The header canonicalization method. One of ’relaxed’ or ’simple’.
62059 </listitem></varlistentry>
62060 <varlistentry revisionflag="changed">
62061 <term><option>$dkim_copiedheaders</option></term>
62063 <para revisionflag="changed">
62064 A transcript of headers and their values which are included in the signature
62065 (copied from the ’z=’ tag of the signature).
62067 </listitem></varlistentry>
62068 <varlistentry revisionflag="changed">
62069 <term><option>$dkim_bodylength</option></term>
62071 <para revisionflag="changed">
62072 The number of signed body bytes. If zero ("0"), the body is unsigned. If no
62073 limit was set by the signer, "9999999999999" is returned. This makes sure
62074 that this variable always expands to an integer value.
62076 </listitem></varlistentry>
62077 <varlistentry revisionflag="changed">
62078 <term><option>$dkim_created</option></term>
62080 <para revisionflag="changed">
62081 UNIX timestamp reflecting the date and time when the signature was created.
62082 When this was not specified by the signer, "0" is returned.
62084 </listitem></varlistentry>
62085 <varlistentry revisionflag="changed">
62086 <term><option>$dkim_expires</option></term>
62088 <para revisionflag="changed">
62089 UNIX timestamp reflecting the date and time when the signer wants the
62090 signature to be treated as "expired". When this was not specified by the
62091 signer, "9999999999999" is returned. This makes it possible to do useful
62092 integer size comparisons against this value.
62094 </listitem></varlistentry>
62095 <varlistentry revisionflag="changed">
62096 <term><option>$dkim_headernames</option></term>
62098 <para revisionflag="changed">
62099 A colon-separated list of names of headers included in the signature.
62101 </listitem></varlistentry>
62102 <varlistentry revisionflag="changed">
62103 <term><option>$dkim_key_testing</option></term>
62105 <para revisionflag="changed">
62106 "1" if the key record has the "testing" flag set, "0" if not.
62108 </listitem></varlistentry>
62109 <varlistentry revisionflag="changed">
62110 <term><option>$dkim_key_nosubdomaining</option></term>
62112 <para revisionflag="changed">
62113 "1" if the key record forbids subdomaining, "0" otherwise.
62115 </listitem></varlistentry>
62116 <varlistentry revisionflag="changed">
62117 <term><option>$dkim_key_srvtype</option></term>
62119 <para revisionflag="changed">
62120 Service type (tag s=) from the key record. Defaults to "*" if not specified
62123 </listitem></varlistentry>
62124 <varlistentry revisionflag="changed">
62125 <term><option>$dkim_key_granularity</option></term>
62127 <para revisionflag="changed">
62128 Key granularity (tag g=) from the key record. Defaults to "*" if not specified
62131 </listitem></varlistentry>
62132 <varlistentry revisionflag="changed">
62133 <term><option>$dkim_key_notes</option></term>
62135 <para revisionflag="changed">
62136 Notes from the key record (tag n=)
62138 </listitem></varlistentry>
62140 <para revisionflag="changed">
62141 In addition, two ACL conditions are provided:
62143 <variablelist revisionflag="changed">
62144 <varlistentry revisionflag="changed">
62145 <term><option>dkim_signers</option></term>
62147 <para revisionflag="changed">
62148 ACL condition that checks a colon-separated list of domains or identities
62149 for a match against the domain or identity that the ACL is currently verifying
62150 (reflected by <option>$dkim_cur_signer</option>). This is typically used to restrict an ACL
62151 verb to a group of domains or identities, like:
62153 <literallayout class="monospaced" revisionflag="changed">
62154 # Warn when message apparently from GMail has no signature at all
62155 warn log_message = GMail sender without DKIM signature
62156 sender_domains = gmail.com
62157 dkim_signers = gmail.com
62160 </listitem></varlistentry>
62161 <varlistentry revisionflag="changed">
62162 <term><option>dkim_status</option></term>
62164 <para revisionflag="changed">
62165 ACL condition that checks a colon-separated list of possible DKIM verification
62166 results agains the actual result of verification. This is typically used
62167 to restrict an ACL verb to a list of verification outcomes, like:
62169 <literallayout class="monospaced" revisionflag="changed">
62170 deny message = Message from Paypal with invalid or missing signature
62171 sender_domains = paypal.com:paypal.de
62172 dkim_signers = paypal.com:paypal.de
62173 dkim_status = none:invalid:fail
62175 <para revisionflag="changed">
62176 The possible status keywords are: ’none’,’invalid’,’fail’ and ’pass’. Please
62177 see the documentation of the <option>$dkim_verify_status</option> expansion variable above
62178 for more information of what they mean.
62180 </listitem></varlistentry>
62185 <chapter id="CHID13">
62186 <title>Adding new drivers or lookup types</title>
62187 <titleabbrev>Adding drivers or lookups</titleabbrev>
62189 <indexterm role="concept">
62190 <primary>adding drivers</primary>
62192 <indexterm role="concept">
62193 <primary>new drivers, adding</primary>
62195 <indexterm role="concept">
62196 <primary>drivers</primary>
62197 <secondary>adding new</secondary>
62199 The following actions have to be taken in order to add a new router, transport,
62200 authenticator, or lookup type to Exim:
62202 <orderedlist numeration="arabic">
62205 Choose a name for the driver or lookup type that does not conflict with any
62206 existing name; I will use <quote>newdriver</quote> in what follows.
62211 Add to <filename>src/EDITME</filename> the line:
62214 <<emphasis>type</emphasis>><literal>_NEWDRIVER=yes</literal>
62217 where <<emphasis>type</emphasis>> is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
62218 code is not to be included in the binary by default, comment this line out. You
62219 should also add any relevant comments about the driver or lookup type.
62224 Add to <filename>src/config.h.defaults</filename> the line:
62226 <literallayout class="monospaced">
62227 #define <type>_NEWDRIVER
62232 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
62233 and create a table entry as is done for all the other drivers and lookup types.
62238 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
62239 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
62240 driver or lookup type and add it to the definition of OBJ.
62245 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
62246 <filename>src</filename>.
62251 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
62252 as for other drivers and lookups.
62257 Then all you need to do is write the code! A good way to start is to make a
62258 proforma by copying an existing module of the same type, globally changing all
62259 occurrences of the name, and cutting out most of the code. Note that any
62260 options you create must be listed in alphabetical order, because the tables are
62261 searched using a binary chop procedure.
62264 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
62265 the interface that is expected.
62269 foot_right_recto="&chaptertitle;"
62270 foot_right_verso="&chaptertitle;"
62274 <index role="option">
62275 <title>Options index</title>
62278 <index role="variable">
62279 <title>Variables index</title>
62282 <index role="concept">
62283 <title>Concept index</title>